Class for representing problems to be solved by Knitro, providing an interface to the problem definition in problem.h.
More...
#include <knitroProblem.h>
|
| KnitroProblem (unsigned nvarIn, unsigned neqIn, unsigned nineqIn, const unsigned nineqSquashIn, const std::vector< babBase::OptimizationVariable > &variables, UbpStructure *structureIn, std::vector< Constraint > *constraintPropertiesIn, std::shared_ptr< DagObj > dagObj) |
| Constructor actually used in ubp.cpp. Initializes the corresponding members. More...
|
|
virtual | ~KnitroProblem () |
| Destructor. More...
|
|
double | evaluateFC (const double *const x, double *const c, double *const objGrad, double *const jac) |
| Function called by Knitro to get values of the objective and constraints at a point x. More...
|
|
int | evaluateGA (const double *const x, double *const objGrad, double *const jac) |
| Function called by Knitro to get derivatives of the objective and constraints at point x. More...
|
|
int | evaluateHess (const double *const x, double objScaler, const double *const lambda, double *const hess) |
| Function called by Knitro to get the hessian of the lagrangian at point x. More...
|
|
|
void | _setObjectiveProperties () |
| Set properties of objective function, i.e., type (linear, quadratic, general) More...
|
|
void | _setVariableProperties () |
| Set properties of variables, i.e., type (continuous, binary, integer) More...
|
|
void | _setConstraintProperties () |
| Set properties of constraints, i.e., bounds and type (linear, quadratic, general) More...
|
|
void | _setDerivativeProperties () |
| Set properties of derivatives, i.e., correct indices for non zeros in Jacobian. More...
|
|
| KnitroProblem (const KnitroProblem &) |
|
KnitroProblem & | operator= (const KnitroProblem &) |
|
Class for representing problems to be solved by Knitro, providing an interface to the problem definition in problem.h.
This class provides an interface between Knitro and the problem definition in problem.h. by evaluating the Model equations and preparing the information required by Knitro. An instance of this class is handed to Knitro as an argument of its KN_solve routine in ubpKnitro.cpp. For more information on the basic interface see https://www.artelys.com/tools/knitro_doc/3_referenceManual/callableLibraryAPI.html#basic-problem-construction .
◆ KnitroProblem() [1/2]
maingo::ubp::KnitroProblem::KnitroProblem |
( |
unsigned |
nvarIn, |
|
|
unsigned |
neqIn, |
|
|
unsigned |
nineqIn, |
|
|
const unsigned |
nineqSquashIn, |
|
|
const std::vector< babBase::OptimizationVariable > & |
variables, |
|
|
UbpStructure * |
structureIn, |
|
|
std::vector< Constraint > * |
constraintPropertiesIn, |
|
|
std::shared_ptr< DagObj > |
dagObj |
|
) |
| |
Constructor actually used in ubp.cpp. Initializes the corresponding members.
- Parameters
-
[in] | nvarIn | is the number of optimization variables |
[in] | neqIn | is the number of equality constraints |
[in] | nineqIn | is the number of inequality constraints |
[in] | nineqSquashIn | is the number of squash inequality constraints which are to be used only if the squash node has been used |
[in] | variables | are the original problem variables |
[in] | structureIn | is a struct containing information on sparsity patterns of the Lagrangian and Hessian |
[in] | constraintPropertiesIn | is a pointer to the constraint properties determined by MAiNGO |
[in] | dagObj | is a pointer to the struct holding the DAG to be evaluated |
◆ ~KnitroProblem()
virtual maingo::ubp::KnitroProblem::~KnitroProblem |
( |
| ) |
|
|
virtual |
◆ KnitroProblem() [2/2]
maingo::ubp::KnitroProblem::KnitroProblem |
( |
const KnitroProblem & |
| ) |
|
|
private |
default copy constructor declared private to prevent use
◆ _setConstraintProperties()
void maingo::ubp::KnitroProblem::_setConstraintProperties |
( |
| ) |
|
|
private |
Set properties of constraints, i.e., bounds and type (linear, quadratic, general)
◆ _setDerivativeProperties()
void maingo::ubp::KnitroProblem::_setDerivativeProperties |
( |
| ) |
|
|
private |
Set properties of derivatives, i.e., correct indices for non zeros in Jacobian.
◆ _setObjectiveProperties()
void maingo::ubp::KnitroProblem::_setObjectiveProperties |
( |
| ) |
|
|
private |
Set properties of objective function, i.e., type (linear, quadratic, general)
◆ _setVariableProperties()
void maingo::ubp::KnitroProblem::_setVariableProperties |
( |
| ) |
|
|
private |
Set properties of variables, i.e., type (continuous, binary, integer)
◆ evaluateFC()
double maingo::ubp::KnitroProblem::evaluateFC |
( |
const double *const |
x, |
|
|
double *const |
c, |
|
|
double *const |
objGrad, |
|
|
double *const |
jac |
|
) |
| |
Function called by Knitro to get values of the objective and constraints at a point x.
- Parameters
-
[in] | x | is the current point |
[out] | c | is the value of constraints |
[out] | objGrad | is the gradient of the objective at x (not set in this function) |
[out] | jac | holds the Jacobian values at x (not set in this function) |
- Returns
- Returns the value of the objective function at x
◆ evaluateGA()
int maingo::ubp::KnitroProblem::evaluateGA |
( |
const double *const |
x, |
|
|
double *const |
objGrad, |
|
|
double *const |
jac |
|
) |
| |
Function called by Knitro to get derivatives of the objective and constraints at point x.
- Parameters
-
[in] | x | is the current point |
[out] | objGrad | is the gradient of the objective at x |
[out] | jac | holds the Jacobian values at x |
- Returns
- Returns the value of the gradients of the objective function at x
◆ evaluateHess()
int maingo::ubp::KnitroProblem::evaluateHess |
( |
const double *const |
x, |
|
|
double |
objScaler, |
|
|
const double *const |
lambda, |
|
|
double *const |
hess |
|
) |
| |
Function called by Knitro to get the hessian of the lagrangian at point x.
- Parameters
-
[in] | x | is the current point |
[in] | objScaler | is value to scale objective component of the Hessian. |
[in] | lambda | contains the values of the dual variables to evaluate. |
[out] | hess | holds the values of non-zero elements of the Hessian to be evaluated at x. |
- Returns
- KTR_RC_CALLBACK_ERR, a KNITRO error code indicating an error in evaluating the second derivatives.
◆ operator=()
default assignment operator declared private to prevent use
◆ _constraintProperties
std::vector<Constraint>* maingo::ubp::KnitroProblem::_constraintProperties |
|
private |
pointer to constraint properties determined by MAiNGO
◆ _neq
unsigned maingo::ubp::KnitroProblem::_neq |
|
private |
◆ _nineq
unsigned maingo::ubp::KnitroProblem::_nineq |
|
private |
◆ _nineqSquash
unsigned maingo::ubp::KnitroProblem::_nineqSquash |
|
private |
number of squash inequalities
◆ _nvar
unsigned maingo::ubp::KnitroProblem::_nvar |
|
private |
◆ _optimizationVariables
optimization variables - needed to set if continuous, integer, binary
◆ _structure
struct storing information on the problem structure
The documentation for this class was generated from the following file: