Constructing bound-constrained objects

In OPT++, the standard form for a bound constraint is

\[ x \ge l. \]

However, the user has the option of creating constraints with upper bounds or constraints with lower and upper bounds. The BoundConstraint class contains four constructors.

The first constructor creates a bound constraint in standard form. For example,

   BoundConstraint(int nc, const ColumnVector& lower);
where nc is the number of constraints, and lower is a vector that contains the lower bounds on the constraints.

To define upper bounds on the variables, such as

\[ x \le u, \]

use the following constructor:

   BoundConstraint(int nc, const ColumnVector& bound, 
                   const BoolVector& bdFlag);

Sample code to create

\[ x_i \le i, \forall i=1,2,..,5 \]

appears below.

   bool bdFlag;
   int numOfCons = 5;
   ColumnVector bound(numOfCons);
   bound  << 1.0 << 2.0 << 3.0
          << 4.0 << 5.0;
   bdFlag = false;
   BoundConstraint bc(numOfCons, bound, bdFlag); 

To define lower and upper bounds on the variables, use

   BoundConstraint(int nc, const ColumnVector& lower, 
                   const ColumnVector& upper)
which creates

\[l \le x \le u. \]

By default, the first ColumnVector contains the lower bounds and the second ColumnVector the upper bounds on the constraints.

OPT++ does not support sparse constraints. Therefore, a bound must be given for each variable even if only a subset of the variables have finite bounds. An infinite lower bound is specified by

\[l_i \le -1.0e10. \]

Similarly, an infinite upper bound is specified by

\[u_i \ge 1.0e10. \]

Next Section: Constructing linear constraints | Back to Main Page

Last revised July 13, 2006

Bug Reports    OPT++ Developers    Copyright Information    GNU Lesser General Public License
Documentation, generated by , last revised August 30, 2006.