typedef void (*USERNLNCON0)(int, const ColumnVector&, ColumnVector&, int&);
void trig_constraint(ndim, x, cvalue, result);
typedef void (*USERNLNCON1)(int, int, const ColumnVector&, ColumnVector&, Matrix&, int&);
void rosen_constraint(mode, n, x, cvalue, cJacobian, result);
typedef void (*USERNLNCON2)(int, int, const ColumnVector&, ColumnVector&, Matrix&, OptppArray<SymmetricMatrix>&, int&);
void illum2_constraint(mode, n, x, cvalue, cJacobian, cHessian, result);
There are two NonLinearEquation constructors. The first constructor requires two parameters, a pointer to an NLP object and an integer argument for the number of nonlinear equations, which defaults to one. The right-hand side is set to zero. For example,
NonLinearEquation(NLP* nlprob, int numconstraints = 1);
The second constructor
NonLinearEquation(NLP* nlprob, const ColumnVector& rhs, int numconstraints = 1);
The following code fragment creates
// Number of nonlinear equations int ncnln = 3; ColumnVector b(ncnln); // Create a pointer to an NLP object NLP* nlprob = new NLP( new NLF1(n, ncnln, nleqn, init_nleqn) ); // Initialize the right-hand side of the equations b << 1.0 << 2.0 << 3.0; // Create a set of nonlinear equations NonLinearEquation(nlprob, b, ncnln);
The corresponding constructor is
NonLinearInequality(NLP* nlprob, int numconstraints = 1);
To define a nonzero right-hand side for the inequalities, use the following constructor:
NonLinearInequality(NLP* nlprob, const ColumnVector& rhs, int numconstraints = 1);
If the user wants nonzero upper bounds on the constraints, such as
then they must use the following constructor:
NonLinearInequality(NLP* nlprob, const ColumnVector& rhs, const bool flag, int numconstraints = 1);
To create lower and upper bounds for the constraints, use
NonLinearInequality(NLP* nlprob, const ColumnVector& lower, const ColumnVector& upper, int numconstraints = 1);
OPT++ does not support sparse constraints. Therefore, a bound must be given for each variable even if only a subset of the constraints have finite bounds. An infinite lower bound is specified by
Similarly, an infinite upper bound is specified by
Next Section: Constructing a compound constraint | Back to Main Page
Last revised July 13, 2006