CONOPT
Loading...
Searching...
No Matches
jconopt.ConoptModelData Class Reference

Public Member Functions

synchronized void delete ()
 
void swigReleaseOwnership ()
 
void swigTakeOwnership ()
 
 ConoptModelData ()
 
int readMatrix (SWIGTYPE_p_double lower, SWIGTYPE_p_double curr, SWIGTYPE_p_double upper, SWIGTYPE_p_int vsta, SWIGTYPE_p_int type, SWIGTYPE_p_double rhs, SWIGTYPE_p_int esta, SWIGTYPE_p_int colsta, SWIGTYPE_p_int rowno, SWIGTYPE_p_double value, SWIGTYPE_p_int nlflag, int numvar, int numcon, int numnz)
 
void setProblemDimension (long numvar, long numcons, long numnz, long numnlnz)
 
int addConstraint (ConstraintType constype, double rhs, int slackstatus)
 
int addConstraint (ConstraintType constype, double rhs)
 
int addConstraint (ConstraintType constype, double rhs, int[] varindex, double[] value, int[] nlflag, int slackstatus)
 
int addConstraint (ConstraintType constype, double rhs, int[] varindex, double[] value, int[] nlflag)
 
int addVariable (double lower, double upper, double curr, int varstatus)
 
int addVariable (double lower, double upper, double curr)
 
int addVariable (double lower, double upper)
 
int addVariable (double lower, double upper, int[] consindex, double[] value, int[] nlflag, double curr, int varstatus)
 
int addVariable (double lower, double upper, int[] consindex, double[] value, int[] nlflag, double curr)
 
int addVariable (double lower, double upper, int[] consindex, double[] value, int[] nlflag)
 
void setObjectiveElement (ObjectiveElement elem, int elemindex)
 
void setOptimizationSense (Sense sense)
 
void setInitialStatusOption (int inistat)
 
int numVar ()
 
int numCons ()
 
int numHessianNonzeros ()
 
Variable getVariable (int index)
 
Constraint getConstraint (int index)
 
void setSDEvaluationType (SDEvaluationType sdevaltype)
 
void setSDLagrangianStructure (int[] rownum, int[] colnum)
 
int[] getSDLagrangianRowNumbers ()
 
int[] getSDLagrangianColumnNumbers ()
 

Protected Member Functions

 ConoptModelData (long cPtr, boolean cMemoryOwn)
 
void finalize ()
 
void swigDirectorDisconnect ()
 

Static Protected Member Functions

static long getCPtr (ConoptModelData obj)
 
static long swigRelease (ConoptModelData obj)
 

Protected Attributes

transient boolean swigCMemOwn
 

Detailed Description

The Model Data class

Definition at line 15 of file ConoptModelData.java.

Constructor & Destructor Documentation

◆ ConoptModelData() [1/2]

jconopt.ConoptModelData.ConoptModelData ( long cPtr,
boolean cMemoryOwn )
inlineprotected

Definition at line 19 of file ConoptModelData.java.

◆ ConoptModelData() [2/2]

jconopt.ConoptModelData.ConoptModelData ( )
inline

Constructor

Definition at line 74 of file ConoptModelData.java.

Member Function Documentation

◆ getCPtr()

static long jconopt.ConoptModelData.getCPtr ( ConoptModelData obj)
inlinestaticprotected

Definition at line 24 of file ConoptModelData.java.

◆ swigRelease()

static long jconopt.ConoptModelData.swigRelease ( ConoptModelData obj)
inlinestaticprotected

Definition at line 28 of file ConoptModelData.java.

◆ finalize()

void jconopt.ConoptModelData.finalize ( )
inlineprotected

Reimplemented in jconopt.ModelData.

Definition at line 41 of file ConoptModelData.java.

◆ delete()

synchronized void jconopt.ConoptModelData.delete ( )
inline

Reimplemented in jconopt.ModelData.

Definition at line 45 of file ConoptModelData.java.

◆ swigDirectorDisconnect()

void jconopt.ConoptModelData.swigDirectorDisconnect ( )
inlineprotected

Reimplemented in jconopt.ModelData.

Definition at line 55 of file ConoptModelData.java.

◆ swigReleaseOwnership()

void jconopt.ConoptModelData.swigReleaseOwnership ( )
inline

Reimplemented in jconopt.ModelData.

Definition at line 60 of file ConoptModelData.java.

◆ swigTakeOwnership()

void jconopt.ConoptModelData.swigTakeOwnership ( )
inline

Reimplemented in jconopt.ModelData.

Definition at line 65 of file ConoptModelData.java.

◆ readMatrix()

int jconopt.ConoptModelData.readMatrix ( SWIGTYPE_p_double lower,
SWIGTYPE_p_double curr,
SWIGTYPE_p_double upper,
SWIGTYPE_p_int vsta,
SWIGTYPE_p_int type,
SWIGTYPE_p_double rhs,
SWIGTYPE_p_int esta,
SWIGTYPE_p_int colsta,
SWIGTYPE_p_int rowno,
SWIGTYPE_p_double value,
SWIGTYPE_p_int nlflag,
int numvar,
int numcon,
int numnz )
inline

loads the structure of the model into CONOPT.

Using the C++ interface, there are two ways to load the model into CONOPT.
The first method follows the process used for the Fortran and C interfaces. This involves:

  1. setting the problem dimension by calling setProblemDimension().
  2. set the objective element (constraint or variable) by calling setObjectiveElement().
  3. set the optimisation sense by calling setOptimizationSense().
  4. implementing a readMatrix() method that loads the model using a column-oriented sparse matrix format. For
    more details regarding the parameters of the readMatrix() method, please see API_DEFINING_THE_MODEL_F90

    The second method makes use of the convenience functions included in the C++ interface. Within the
    ConoptModelData the methods addConstraint() and addVariable() are provided. As such, to load the model into
    CONOPT, you must:
  1. write a member function for building the model.
  2. in the build model function, call addVariable() for each variable to be added to the problem.
  3. in the build model function, call addConstraint() for each constraint to be added to the problem. When adding
    a constraint, you should specify the variables (by index), coefficients and non-linear flags (for all
    nonlinear terms).
  4. set the objective element (constraint or variable) by calling setObjectiveElement().
  5. set the optimisation sense by calling setOptimizationSense().
    When the solve method is called, the default readMatrix() method will be called, which will load the model into
    CONOPT as specified by the calls to addVariable() and addConstraint().

    INCLUDEDOC readMatrix_params.dox

Definition at line 107 of file ConoptModelData.java.

◆ setProblemDimension()

void jconopt.ConoptModelData.setProblemDimension ( long numvar,
long numcons,
long numnz,
long numnlnz )
inline

sets the problem dimension. This is called if the user wants to implement a custom readMatrix() method.

NOTE: it is not possible to call setProblemDimension() and addConstraint() or addVariable(). The latter
functions can only be used if the problem dimension is not set and the default readMatrix() method is used.


INGROUP DEFINE_MODEL_XYZ

Parameters
numvarthe number of variables in the problem
numconsthe number of constraints in the problem
numnzthe number of non-zeros in the constraint matrix
numnlnzthe number of nonlinear non-zeros in the constraint matrix

Reimplemented in jconopt.ModelData.

Definition at line 125 of file ConoptModelData.java.

◆ addConstraint() [1/4]

int jconopt.ConoptModelData.addConstraint ( ConstraintType constype,
double rhs,
int slackstatus )
inline

adds a constraint to the problem. The non-zero coefficients are added later


INGROUP DEFINE_MODEL_XYZ

Parameters
constypethe type of constraint, 0: ==, 1: >=, 2: <=, 3: free
rhsthe right hand side
slackstatusinitial status of the slack variables, see IniStat

Reimplemented in jconopt.ModelData.

Definition at line 139 of file ConoptModelData.java.

◆ addConstraint() [2/4]

int jconopt.ConoptModelData.addConstraint ( ConstraintType constype,
double rhs )
inline

adds a constraint to the problem. The non-zero coefficients are added later


INGROUP DEFINE_MODEL_XYZ

Parameters
constypethe type of constraint, 0: ==, 1: >=, 2: <=, 3: free
rhsthe right hand side

Reimplemented in jconopt.ModelData.

Definition at line 153 of file ConoptModelData.java.

◆ addConstraint() [3/4]

int jconopt.ConoptModelData.addConstraint ( ConstraintType constype,
double rhs,
int[] varindex,
double[] value,
int[] nlflag,
int slackstatus )
inline

adds a constraint to the problem. The matrix non-zeros are added based on the supplied variables


INGROUP DEFINE_MODEL_XYZ

Parameters
constypethe type of constraint, 0: ==, 1: >=, 2: <=, 3: free
rhsthe right hand side
varindexthe variables this constraint has non-zero coefficients
valuethe non-zero of the variable
nlflagflag to set whether the variable belongs to a non-linear term
slackstatusinitial status of the slack variables, see IniStat

Reimplemented in jconopt.ModelData.

Definition at line 170 of file ConoptModelData.java.

◆ addConstraint() [4/4]

int jconopt.ConoptModelData.addConstraint ( ConstraintType constype,
double rhs,
int[] varindex,
double[] value,
int[] nlflag )
inline

adds a constraint to the problem. The matrix non-zeros are added based on the supplied variables


INGROUP DEFINE_MODEL_XYZ

Parameters
constypethe type of constraint, 0: ==, 1: >=, 2: <=, 3: free
rhsthe right hand side
varindexthe variables this constraint has non-zero coefficients
valuethe non-zero of the variable
nlflagflag to set whether the variable belongs to a non-linear term

Reimplemented in jconopt.ModelData.

Definition at line 187 of file ConoptModelData.java.

◆ addVariable() [1/6]

int jconopt.ConoptModelData.addVariable ( double lower,
double upper,
double curr,
int varstatus )
inline

adds a variable to the model. The non-zero coefficients are added later.


INGROUP DEFINE_MODEL_XYZ

Parameters
lowerlower bound for the variable
upperupper bound for the variable
currinitial value of the variable, can be set to 0
varstatusinitial status of the variable, see IniStat

Reimplemented in jconopt.ModelData.

Definition at line 202 of file ConoptModelData.java.

◆ addVariable() [2/6]

int jconopt.ConoptModelData.addVariable ( double lower,
double upper,
double curr )
inline

adds a variable to the model. The non-zero coefficients are added later.


INGROUP DEFINE_MODEL_XYZ

Parameters
lowerlower bound for the variable
upperupper bound for the variable
currinitial value of the variable, can be set to 0

Reimplemented in jconopt.ModelData.

Definition at line 217 of file ConoptModelData.java.

◆ addVariable() [3/6]

int jconopt.ConoptModelData.addVariable ( double lower,
double upper )
inline

adds a variable to the model. The non-zero coefficients are added later.


INGROUP DEFINE_MODEL_XYZ

Parameters
lowerlower bound for the variable
upperupper bound for the variable

Reimplemented in jconopt.ModelData.

Definition at line 231 of file ConoptModelData.java.

◆ addVariable() [4/6]

int jconopt.ConoptModelData.addVariable ( double lower,
double upper,
int[] consindex,
double[] value,
int[] nlflag,
double curr,
int varstatus )
inline

adds a variable to the problem. The matrix non-zeros are added based on the supplied constraints.


INGROUP DEFINE_MODEL_XYZ

Parameters
lowerlower bound for the variable
upperupper bound for the variable
consindexthe constraints this variable has non-zero coefficients
valuethe non-zero of the variable
nlflagflag to set whether the variable belongs to a non-linear term
currinitial value of the variable, can be set to 0
varstatusinitial status of the variable, see IniStat

Reimplemented in jconopt.ModelData.

Definition at line 249 of file ConoptModelData.java.

◆ addVariable() [5/6]

int jconopt.ConoptModelData.addVariable ( double lower,
double upper,
int[] consindex,
double[] value,
int[] nlflag,
double curr )
inline

adds a variable to the problem. The matrix non-zeros are added based on the supplied constraints.


INGROUP DEFINE_MODEL_XYZ

Parameters
lowerlower bound for the variable
upperupper bound for the variable
consindexthe constraints this variable has non-zero coefficients
valuethe non-zero of the variable
nlflagflag to set whether the variable belongs to a non-linear term
currinitial value of the variable, can be set to 0

Reimplemented in jconopt.ModelData.

Definition at line 267 of file ConoptModelData.java.

◆ addVariable() [6/6]

int jconopt.ConoptModelData.addVariable ( double lower,
double upper,
int[] consindex,
double[] value,
int[] nlflag )
inline

adds a variable to the problem. The matrix non-zeros are added based on the supplied constraints.


INGROUP DEFINE_MODEL_XYZ

Parameters
lowerlower bound for the variable
upperupper bound for the variable
consindexthe constraints this variable has non-zero coefficients
valuethe non-zero of the variable
nlflagflag to set whether the variable belongs to a non-linear term

Reimplemented in jconopt.ModelData.

Definition at line 284 of file ConoptModelData.java.

◆ setObjectiveElement()

void jconopt.ConoptModelData.setObjectiveElement ( ObjectiveElement elem,
int elemindex )
inline

sets the index for the objective variable or constraint


INGROUP DEFINE_MODEL_XYZ

Reimplemented in jconopt.ModelData.

Definition at line 294 of file ConoptModelData.java.

◆ setOptimizationSense()

void jconopt.ConoptModelData.setOptimizationSense ( Sense sense)
inline

sets the optimisation direction.


INGROUP DEFINE_MODEL_XYZ

Reimplemented in jconopt.ModelData.

Definition at line 304 of file ConoptModelData.java.

◆ setInitialStatusOption()

void jconopt.ConoptModelData.setInitialStatusOption ( int inistat)
inline

the setting to indicate how the initial status of the variables and slack variables will be handled.

The initial status is set in the addVariable() and addConstraint() methods, or in the readMatrix() method if the
classical model input approach is used. By default, the value of inistat is 0, which means that the variable and
slack status is ignored.

If inistat == 1:
The variable status has the following behaviour:

  • 0: The variable is initialized non-basic (if curr = lower or curr = upper) or super-basic, and
  • 1: The variable is initialized basic
    The slack status has the following behaviour:
  • 0: The slack is initialized non-basic (if the constraint is binding in the initial point) or super-basic,
  • 1: The slack is initialized basic

    If inistat == 2:
    The variable status has the following behaviour:
  • 0: The variable is initialized at lower bound
  • 1: The variable is initialized at upper bound
  • 2: The variable is initialized basic, and
  • 3: The variable is initialized superbasic.
    The slack status has the following behaviour:
  • 0: The slack is initialized at lower bound.
  • 1: The slack is initialized at upper bound.
  • 2: The slack is initialized basic, and
  • 3: The slack is initialized superbasic.


    INGROUP DEFINE_MODEL_XYZ

Reimplemented in jconopt.ModelData.

Definition at line 338 of file ConoptModelData.java.

◆ numVar()

int jconopt.ConoptModelData.numVar ( )
inline

returns the number of variables in the model


INGROUP QUERY_MODEL_XYZ

Reimplemented in jconopt.ModelData.

Definition at line 348 of file ConoptModelData.java.

◆ numCons()

int jconopt.ConoptModelData.numCons ( )
inline

returns the number of constraints in the model


INGROUP QUERY_MODEL_XYZ

Reimplemented in jconopt.ModelData.

Definition at line 358 of file ConoptModelData.java.

◆ numHessianNonzeros()

int jconopt.ConoptModelData.numHessianNonzeros ( )
inline

returns the number of non-zeros in the Hessian


INGROUP QUERY_MODEL_XYZ

Reimplemented in jconopt.ModelData.

Definition at line 368 of file ConoptModelData.java.

◆ getVariable()

Variable jconopt.ConoptModelData.getVariable ( int index)
inline

returns a reference to the variable object


INGROUP QUERY_MODEL_XYZ

Reimplemented in jconopt.ModelData.

Definition at line 378 of file ConoptModelData.java.

◆ getConstraint()

Constraint jconopt.ConoptModelData.getConstraint ( int index)
inline

returns a reference to the constraint object


INGROUP QUERY_MODEL_XYZ

Reimplemented in jconopt.ModelData.

Definition at line 388 of file ConoptModelData.java.

◆ setSDEvaluationType()

void jconopt.ConoptModelData.setSDEvaluationType ( SDEvaluationType sdevaltype)
inline

informs CONOPT of the method for evaluating the second derivative


INGROUP DEFINE_SECOND_DERIVATIVE_XYZ

Reimplemented in jconopt.ModelData.

Definition at line 398 of file ConoptModelData.java.

◆ setSDLagrangianStructure()

void jconopt.ConoptModelData.setSDLagrangianStructure ( int[] rownum,
int[] colnum )
inline

sets the structure of the second derivatives of the Lagrangian


INGROUP DEFINE_SECOND_DERIVATIVE_XYZ

Parameters
rownumVector of row numbers of the lower triangular part of the Hessian.
colnumVector of column numbers of the lower triangular part of the Hessian.

Reimplemented in jconopt.ModelData.

Definition at line 411 of file ConoptModelData.java.

◆ getSDLagrangianRowNumbers()

int[] jconopt.ConoptModelData.getSDLagrangianRowNumbers ( )
inline

returns the row numbers in the second derivative of the lagrangian structure

Definition at line 418 of file ConoptModelData.java.

◆ getSDLagrangianColumnNumbers()

int[] jconopt.ConoptModelData.getSDLagrangianColumnNumbers ( )
inline

returns the column numbers in the second derivative of the lagrangian structure

Definition at line 425 of file ConoptModelData.java.

Field Documentation

◆ swigCMemOwn

transient boolean jconopt.ConoptModelData.swigCMemOwn
protected

Definition at line 17 of file ConoptModelData.java.


The documentation for this class was generated from the following file: