# Builds and solves a simple inequality-constrained linear program

Jump to: Source code Text output Plots Library index

    echo on

    n = 10;
    A = randn(2*n,n);
    b = randn(2*n,1);
    c = randn(n,1);
    d = randn;
    cvx_begin
       variable x(n)
       dual variables y z
       minimize( c' * x + d )
       subject to
          y : A * x <= b;
    cvx_end

    echo off

    n = 10;
    A = randn(2*n,n);
    b = randn(2*n,1);
    c = randn(n,1);
    d = randn;
    cvx_begin
       variable x(n)
       dual variables y z
       minimize( c' * x + d )
       subject to
          y : A * x <= b;
    cvx_end

    Calling sedumi: 20 variables, 10 equality constraints
       For improved efficiency, sedumi is solving the dual problem.
    ------------------------------------------------------------
    SeDuMi 1.21 by AdvOL, 2005-2008 and Jos F. Sturm, 1998-2003.
    Alg = 2: xz-corrector, Adaptive Step-Differentiation, theta = 0.250, beta = 0.500
    eqs m = 10, order n = 21, dim = 21, blocks = 1
    nnz(A) = 200 + 0, nnz(ADA) = 100, nnz(L) = 55
     it :     b*y       gap    delta  rate   t/tP*  t/tD*   feas cg cg  prec
      0 :            4.71E+00 0.000
      1 :   1.34E+01 1.22E+00 0.000 0.2587 0.9000 0.9000  -1.79  1  1  3.1E+01
      2 :   6.72E+01 3.27E-01 0.000 0.2688 0.9000 0.9000  -0.78  1  1  2.0E+01
      3 :   1.36E+03 1.14E-02 0.000 0.0347 0.9900 0.9900  -0.79  1  1  1.2E+01
      4 :   2.96E+07 5.42E-07 0.077 0.0000 1.0000 1.0000  -1.00  1  1
    Primal infeasible, dual improving direction found.
    iter seconds  |Ax|    [Ay]_+     |x|       |y|
      4      0.0   0.0e+00   0.0e+00   0.0e+00   7.0e-01

    Detailed timing (sec)
       Pre          IPM          Post
    1.000E-02    1.000E-02    0.000E+00
    Max-norms: ||b||=1.576658e+00, ||c|| = 2.453744e+00,
    Cholesky |add|=0, |skip| = 0, ||L.L|| = 1.
    ------------------------------------------------------------
    Status: Unbounded
    Optimal value (cvx_optval): -Inf

    echo off