lines 8-115 of file: example/abs_normal/lp_box.hpp

{xrst_begin lp_box}
{xrst_spell
   maxitr
   rl
   xout
}
abs_normal: Solve a Linear Program With Box Constraints
#######################################################

Syntax
******

| *ok* = ``lp_box`` (
| |tab| *level* , *A* , *b* , *c* , *d* , *maxitr* , *xout*
| )

Prototype
*********
{xrst_literal
   // BEGIN PROTOTYPE
   // END PROTOTYPE
}

Source
******
This following is a link to the source code for this example:
:ref:`lp_box.hpp-name` .

Problem
*******
We are given
:math:`A \in \B{R}^{m \times n}`,
:math:`b \in \B{R}^m`,
:math:`c \in \B{R}^n`,
:math:`d \in \B{R}^n`,
This routine solves the problem

.. math::

   \begin{array}{rl}
   \R{minimize} &
   c^T x \; \R{w.r.t} \; x \in \B{R}^n
   \\
   \R{subject \; to} & A x + b \leq 0 \; \R{and} \; - d \leq x \leq d
   \end{array}

Vector
******
The type *Vector* is a
simple vector with elements of type ``double`` .

level
*****
This value is less that or equal two.
If *level*  == 0 ,
no tracing is printed.
If *level*  >= 1 ,
a trace of the ``lp_box`` operations is printed.
If *level*  >= 2 ,
the objective and primal variables :math:`x` are printed
at each :ref:`simplex_method-name` iteration.
If *level*  == 3 ,
the simplex tableau is printed at each simplex iteration.

A
*
This is a :ref:`row-major<glossary@Row-major Representation>` representation
of the matrix :math:`A` in the problem.

b
*
This is the vector :math:`b` in the problem.

c
*
This is the vector :math:`c` in the problem.

d
*
This is the vector :math:`d` in the problem.
If :math:`d_j` is infinity, there is no limit for the size of
:math:`x_j`.

maxitr
******
This is the maximum number of newton iterations to try before giving up
on convergence.

xout
****
This argument has size is *n* and
the input value of its elements does no matter.
Upon return it is the primal variables
:math:`x` corresponding to the problem solution.

ok
**
If the return value *ok* is true, an optimal solution was found.
{xrst_toc_hidden
   example/abs_normal/lp_box.cpp
   example/abs_normal/lp_box.xrst
}
Example
*******
The file :ref:`lp_box.cpp-name` contains an example and test of
``lp_box`` .

{xrst_end lp_box}
