Public Member Functions | Public Attributes | Private Member Functions | Private Attributes | List of all members
OSInstance Class Reference

The in-memory representation of an OSiL instance.. More...

#include "OSInstance.h"

Collaboration diagram for OSInstance:
Collaboration graph
[legend]

Public Member Functions

 OSInstance ()
 The OSInstance class constructor. More...
 
 ~OSInstance ()
 The OSInstance class destructor. More...
 
bool IsEqual (OSInstance *that)
 A function to check for the equality of two objects. More...
 
std::string getInstanceName ()
 Get instance name. More...
 
std::string getInstanceSource ()
 Get instance source. More...
 
std::string getInstanceDescription ()
 Get instance description. More...
 
std::string getInstanceCreator ()
 Get instance fileCreator. More...
 
std::string getInstanceLicence ()
 Get instance licence. More...
 
int getVariableNumber ()
 Get number of variables. More...
 
std::string * getVariableNames ()
 Get variable names. More...
 
char * getVariableTypes ()
 Get variable initial values. More...
 
int getNumberOfIntegerVariables ()
 getNumberOfIntegerVariables More...
 
int getNumberOfBinaryVariables ()
 getNumberOfBinaryVariables More...
 
int getNumberOfSemiContinuousVariables ()
 getNumberOfSemiContinuousVariables More...
 
int getNumberOfSemiIntegerVariables ()
 getNumberOfSemiIntegerVariables More...
 
int getNumberOfStringVariables ()
 getNumberOfStringVariables More...
 
double * getVariableLowerBounds ()
 Get variable lower bounds. More...
 
double * getVariableUpperBounds ()
 Get variable upper bounds. More...
 
int getObjectiveNumber ()
 Get number of objectives. More...
 
std::string * getObjectiveNames ()
 Get objective names. More...
 
std::string * getObjectiveMaxOrMins ()
 Get objective maxOrMins. More...
 
intgetObjectiveCoefficientNumbers ()
 Get objective coefficient number. More...
 
double * getObjectiveConstants ()
 Get objective constants. More...
 
double * getObjectiveWeights ()
 Get objective weights. More...
 
SparseVector ** getObjectiveCoefficients ()
 Get objective coefficients. More...
 
double ** getDenseObjectiveCoefficients ()
 getDenseObjectiveCoefficients. More...
 
int getConstraintNumber ()
 Get number of constraints. More...
 
std::string * getConstraintNames ()
 Get constraint names. More...
 
double * getConstraintLowerBounds ()
 Get constraint lower bounds. More...
 
double * getConstraintUpperBounds ()
 Get constraint upper bounds. More...
 
double * getConstraintConstants ()
 Get constraint constants. More...
 
char * getConstraintTypes ()
 Get constraint types. More...
 
int getLinearConstraintCoefficientNumber ()
 Get number of specified (usually nonzero) linear constraint coefficient values. More...
 
bool getLinearConstraintCoefficientMajor ()
 Get whether the constraint coefficients is in column major (true) or row major (false). More...
 
SparseMatrixgetLinearConstraintCoefficientsInColumnMajor ()
 Get linear constraint coefficients in column major. More...
 
SparseMatrixgetLinearConstraintCoefficientsInRowMajor ()
 Get linear constraint coefficients in row major. More...
 
int getNumberOfQuadraticTerms ()
 Get the number of specified (usually nonzero) qTerms in the quadratic coefficients. More...
 
QuadraticTermsgetQuadraticTerms ()
 Get all the quadratic terms in the instance. More...
 
intgetQuadraticRowIndexes ()
 Get the indexes of rows which have a quadratic term. More...
 
int getNumberOfQuadraticRowIndexes ()
 Get the number of rows which have a quadratic term. More...
 
int getNumberOfNonlinearExpressions ()
 Get number of nonlinear expressions. More...
 
Nl ** getNonlinearExpressions ()
 Get the pointers to the roots of all expression trees. More...
 
ScalarExpressionTreegetNonlinearExpressionTree (int rowIdx)
 Get the expression tree for a given row index. More...
 
ScalarExpressionTreegetNonlinearExpressionTreeMod (int rowIdx)
 Get the expression tree for a given row index for the modified expression trees (quadratic terms added) More...
 
std::vector< ExprNode * > getNonlinearExpressionTreeInPostfix (int rowIdx)
 Get the postfix tokens for a given row index. More...
 
std::vector< ExprNode * > getNonlinearExpressionTreeModInPostfix (int rowIdx)
 Get the postfix tokens for a given row index for the modified Expression Tree (quadratic terms added). More...
 
std::vector< ExprNode * > getNonlinearExpressionTreeInPrefix (int rowIdx)
 Get the prefix tokens for a given row index. More...
 
std::string getNonlinearExpressionTreeInInfix (int rowIdx)
 Get the infix representation for a given row (or objective function) index. More...
 
std::vector< ExprNode * > getNonlinearExpressionTreeModInPrefix (int rowIdx)
 Get the prefix tokens for a given row index for the modified Expression Tree (quadratic terms added). More...
 
int getNumberOfNonlinearObjectives ()
 
int getNumberOfNonlinearConstraints ()
 
std::map< int,
ScalarExpressionTree * > 
getAllNonlinearExpressionTrees ()
 
std::map< int,
ScalarExpressionTree * > 
getAllNonlinearExpressionTreesMod ()
 
intgetNonlinearExpressionTreeIndexes ()
 Get all the nonlinear expression tree indexes, i.e., indexes of rows (objectives or constraints) that contain nonlinear expressions. More...
 
int getNumberOfNonlinearExpressionTreeIndexes ()
 Get the number of unique nonlinear expression tree indexes. More...
 
intgetNonlinearExpressionTreeModIndexes ()
 Get all the nonlinear expression tree indexes, i.e., indexes of rows (objectives or constraints) that contain nonlinear expressions after modifying the expression tree to contain quadratic terms. More...
 
int getNumberOfNonlinearExpressionTreeModIndexes ()
 Get the number of unique nonlinear expression tree indexes after modifying the expression tree to contain quadratic terms. More...
 
int getMatrixNumber ()
 Get the number of matrices. More...
 
ENUM_MATRIX_TYPE getMatrixType (int n)
 Get the matrix type. More...
 
ENUM_MATRIX_SYMMETRY getMatrixSymmetry (int n)
 Get the matrix symmetry. More...
 
int getNumberOfColumnsForMatrix (int n)
 Get the number of blocks in the matrix. More...
 
int getNumberOfRowsForMatrix (int n)
 Get the number of rows in the matrix. More...
 
int getNumberOfValuesForMatrix (int n)
 Get the number of (nonzero) values in the matrix. More...
 
std::string getMatrixName (int n)
 Get the name of the matrix. More...
 
bool matrixHasBase (int n)
 Several tools to parse the constructor list of a matrix. More...
 
bool matrixHasElements (int n)
 
bool matrixHasTransformations (int n)
 
bool matrixHasBlocks (int n)
 
int getNumberOfElementConstructors (int n)
 
int getNumberOfTransformationConstructors (int n)
 
int getNumberOfBlocksConstructors (int n)
 
OSMatrixgetMatrix (int n)
 Get the list of constructors of the matrix. More...
 
GeneralSparseMatrixgetMatrixCoefficientsInColumnMajor (int n)
 Get the (nonzero) elements of the matrix in column major form. More...
 
GeneralSparseMatrixgetMatrixCoefficientsInRowMajor (int n)
 Get the (nonzero) elements of the matrix in row major form. More...
 
GeneralSparseMatrixgetMatrixBlockInColumnMajorForm (int n, int columnIdx, int rowIdx)
 Get the (nonzero) elements of the matrix in symmetric block form. More...
 
int getNumberOfMatrixVariables ()
 Get the number of matrix variables. More...
 
int getNumberOfMatrixObjectives ()
 Get the number of matrix objectives. More...
 
int getNumberOfMatrixConstraints ()
 Get the number of matrix constraints. More...
 
int getNumberOfMatrixExpressions ()
 Get the number of matrix-valued expressions. More...
 
MatrixExpression ** getMatrixExpressions ()
 Get the pointers to the roots of all matrix expression trees. More...
 
MatrixExpressionTreegetMatrixExpressionTree (int rowIdx)
 Get the matrix expression tree for a given row index. More...
 
std::vector< ExprNode * > getMatrixExpressionTreeInPostfix (int rowIdx)
 Get the postfix tokens for a given row index. More...
 
std::vector< ExprNode * > getMatrixExpressionTreeModInPostfix (int rowIdx)
 Get the postfix tokens for a given row index for the modified Expression Tree (quadratic terms added). More...
 
std::vector< ExprNode * > getMatrixExpressionTreeInPrefix (int rowIdx)
 Get the prefix tokens for a given row index. More...
 
std::string getMatrixExpressionTreeInInfix (int rowIdx)
 Get the infix representation for a given row (or objective function) index. More...
 
std::map< int,
MatrixExpressionTree * > 
getAllMatrixExpressionTrees ()
 
std::map< int,
MatrixExpressionTree * > 
getAllMatrixExpressionTreesMod ()
 
intgetMatrixExpressionTreeIndexes ()
 Get all the matrix expression tree indexes, i.e. More...
 
int getNumberOfMatrixExpressionTreeIndexes ()
 Get the number of unique matrix expression tree indexes. More...
 
std::string getTimeDomainFormat ()
 Get the format of the time domain ("stages"/"interval") More...
 
int getTimeDomainStageNumber ()
 Get the number of stages that make up the time domain. More...
 
std::string * getTimeDomainStageNames ()
 Get the names of the stages (NULL or empty string ("") if a stage has not been given a name. More...
 
intgetTimeDomainStageNumberOfVariables ()
 Get the number of variables contained in each time stage. More...
 
intgetTimeDomainStageNumberOfConstraints ()
 Get the number of constraints contained in each time stage. More...
 
intgetTimeDomainStageNumberOfObjectives ()
 Get the number of objectives contained in each time stage. More...
 
int ** getTimeDomainStageVarList ()
 Get the list of variables in each stage. More...
 
int ** getTimeDomainStageConList ()
 Get the list of constraints in each stage. More...
 
int ** getTimeDomainStageObjList ()
 Get the list of objectives in each stage. More...
 
double getTimeDomainIntervalStart ()
 Get the start for the time domain interval. More...
 
double getTimeDomainIntervalHorizon ()
 Get the horizon for the time domain interval. More...
 
bool setInstanceName (std::string name)
 set the instance name. More...
 
bool setInstanceSource (std::string source)
 set the instance source. More...
 
bool setInstanceDescription (std::string description)
 set the instance description. More...
 
bool setInstanceCreator (std::string fileCreator)
 set the instance creator. More...
 
bool setInstanceLicence (std::string licence)
 set the instance licence. More...
 
bool setVariableNumber (int number)
 set the number of variables. More...
 
bool addVariable (int index, std::string name, double lowerBound, double upperBound, char type)
 add a variable. More...
 
bool setVariables (int number, std::string *names, double *lowerBounds, double *upperBounds, char *types)
 set all the variable related elements. More...
 
bool setObjectiveNumber (int number)
 set the number of objectives. More...
 
bool addObjective (int index, std::string name, std::string maxOrMin, double constant, double weight, SparseVector *objectiveCoefficients)
 add an objective. More...
 
bool setObjectives (int number, std::string *names, std::string *maxOrMins, double *constants, double *weights, SparseVector **objectitiveCoefficients)
 set all the objectives related elements. More...
 
bool setConstraintNumber (int number)
 set the number of constraints. More...
 
bool addConstraint (int index, std::string name, double lowerBound, double upperBound, double constant)
 add a constraint. More...
 
bool setConstraints (int number, std::string *names, double *lowerBounds, double *upperBounds, double *constants)
 set all the constraint related elements. More...
 
bool setLinearConstraintCoefficients (int numberOfValues, bool isColumnMajor, double *values, int valuesBegin, int valuesEnd, int *indexes, int indexesBegin, int indexesEnd, int *starts, int startsBegin, int startsEnd)
 set linear constraint coefficients More...
 
bool copyLinearConstraintCoefficients (int numberOfValues, bool isColumnMajor, double *values, int valuesBegin, int valuesEnd, int *indexes, int indexesBegin, int indexesEnd, int *starts, int startsBegin, int startsEnd)
 copy linear constraint coefficients: perform a deep copy of the sparse matrix More...
 
bool setNumberOfQuadraticTerms (int nq)
 set the number of quadratic terms More...
 
bool setQuadraticCoefficients (int number, int *rowIndexes, int *varOneIndexes, int *varTwoIndexes, double *coefficients, int begin, int end)
 set quadratic coefficients into the QuadraticCoefficients->qTerm data structure More...
 
bool setQuadraticTermsInNonlinearExpressions (int number, int *rowIndexes, int *varOneIndexes, int *varTwoIndexes, double *coefficients)
 set quadratic terms in nonlinearExpressions More...
 
bool setNonlinearExpressions (int nexpr, Nl **root)
 set nonlinear expressions More...
 
bool setMatrixNumber (int number)
 set the number of matrices More...
 
bool addMatrix (int index, std::string name, int numberOfRows, int numberOfColumns, ENUM_MATRIX_SYMMETRY symmetry, ENUM_MATRIX_TYPE matrixType, unsigned int inumberOfChildren, MatrixNode **m_mChildren)
 add a matrix. More...
 
bool setConeNumber (int number)
 set the number of cones More...
 
bool addCone (int index, int numberOfRows, int numberOfColumns, ENUM_CONE_TYPE coneType, std::string name, int numberOfOtherIndexes=0, int *otherIndexes=NULL)
 add a cone. More...
 
bool addCone (int index, int numberOfRows, int numberOfColumns, ENUM_CONE_TYPE coneType, std::string name, int numberOfComponents, int *components, int numberOfOtherIndexes=0, int *otherIndexes=NULL)
 add a cone. More...
 
bool addCone (int index, int numberOfRows, int numberOfColumns, ENUM_CONE_TYPE coneType, std::string name, int referenceIdx, int numberOfOtherIndexes=0, int *otherIndexes=NULL)
 add a cone. More...
 
bool addCone (int index, int numberOfRows, int numberOfColumns, ENUM_CONE_TYPE coneType, std::string name, std::string semidefiniteness, int numberOfOtherIndexes=0, int *otherIndexes=NULL)
 add a cone. More...
 
bool addCone (int index, int numberOfRows, int numberOfColumns, ENUM_CONE_TYPE coneType, std::string name, int distortionMatrixIdx, double normFactor, int axisDirection, int numberOfOtherIndexes=0, int *otherIndexes=NULL)
 add a cone. More...
 
bool addCone (int index, int numberOfRows, int numberOfColumns, ENUM_CONE_TYPE coneType, std::string name, int distortionMatrixIdx, double normFactor, int firstAxisDirection, int secondAxisDirection, int numberOfOtherIndexes=0, int *otherIndexes=NULL)
 add a cone. More...
 
bool addCone (int index, int numberOfRows, int numberOfColumns, ENUM_CONE_TYPE coneType, std::string name, int distortionMatrixIdx, double normFactor, int axisDirection, double pNorm, int numberOfOtherIndexes=0, int *otherIndexes=NULL)
 add a cone. More...
 
bool addCone (int index, int numberOfRows, int numberOfColumns, ENUM_CONE_TYPE coneType, std::string name, int maxDegree, int numberOfUB, double *ub, int numberOfLB, double *lb, int numberOfOtherIndexes=0, int *otherIndexes=NULL)
 add a cone. More...
 
std::string printModel ()
 Print the infix representation of the problem. More...
 
std::string printModel (int rowIdx)
 Print the infix representation of the row (which could be an an objective function row) indexed by rowIdx. More...
 
bool initializeNonLinearStructures ()
 Initialize the data structures for the nonlinear API. More...
 
double calculateFunctionValue (int idx, double *x, bool new_x)
 Calculate the function value for function (constraint or objective) indexed by idx. More...
 
double * calculateAllConstraintFunctionValues (double *x, double *objLambda, double *conLambda, bool new_x, int highestOrder)
 Calculate all of the constraint function values. More...
 
double * calculateAllConstraintFunctionValues (double *x, bool new_x)
 Calculate all of the constraint function values, we are overloading this function and this version of the method will not use any AD and will evaluate function values from the OS Expression Tree. More...
 
double * calculateAllObjectiveFunctionValues (double *x, double *objLambda, double *conLambda, bool new_x, int highestOrder)
 Calculate all of the objective function values. More...
 
double * calculateAllObjectiveFunctionValues (double *x, bool new_x)
 Calculate all of the objective function values, we are overloading this function and this version of the method will not use any AD and will evaluate function values from the OS Expression Tree. More...
 
SparseJacobianMatrixcalculateAllConstraintFunctionGradients (double *x, double *objLambda, double *conLambda, bool new_x, int highestOrder)
 Calculate the gradient of all constraint functions. More...
 
SparseVectorcalculateConstraintFunctionGradient (double *x, double *objLambda, double *conLambda, int idx, bool new_x, int highestOrder)
 Calculate the gradient of the constraint function indexed by idx. More...
 
SparseVectorcalculateConstraintFunctionGradient (double *x, int idx, bool new_x)
 Calculate the gradient of the constraint function indexed by idx this function is overloaded. More...
 
double ** calculateAllObjectiveFunctionGradients (double *x, double *objLambda, double *conLambda, bool new_x, int highestOrder)
 Calculate the gradient of all objective functions. More...
 
double * calculateObjectiveFunctionGradient (double *x, double *objLambda, double *conLambda, int objIdx, bool new_x, int highestOrder)
 Calculate the gradient of the objective function indexed by objIdx. More...
 
double * calculateObjectiveFunctionGradient (double *x, int objIdx, bool new_x)
 Calculate the gradient of the objective function indexed by objIdx this function is overloaded. More...
 
SparseHessianMatrixcalculateLagrangianHessian (double *x, double *objLambda, double *conLambda, bool new_x, int highestOrder)
 Calculate the Hessian of the Lagrangian Expression Tree This method will build the CppAD expression tree for only the first iteration Use this method on if the value of x does not affect the operations sequence. More...
 
SparseHessianMatrixcalculateHessian (double *x, int idx, bool new_x)
 Calculate the Hessian of a constraint or objective function. More...
 
bool getSparseJacobianFromColumnMajor ()
 
bool getSparseJacobianFromRowMajor ()
 
ScalarExpressionTreegetLagrangianExpTree ()
 
std::map< int, intgetAllNonlinearVariablesIndexMap ()
 
SparseHessianMatrixgetLagrangianHessianSparsityPattern ()
 
bool addQTermsToExressionTree ()
 
bool addQTermsToExpressionTree ()
 This method adds quadratic terms into the array of expression trees. More...
 
SparseJacobianMatrixgetJacobianSparsityPattern ()
 
void duplicateExpressionTreesMap ()
 duplicate the map of expression trees. More...
 
bool createOSADFun (std::vector< double > vdX)
 Create the a CppAD Function object: this is a function where the domain is the set of variables for the problem and the range is the objective function plus constraints. More...
 
std::vector< double > forwardAD (int p, std::vector< double > vdX)
 Perform an AD forward sweep. More...
 
std::vector< double > reverseAD (int p, std::vector< double > vdlambda)
 Perform an AD reverse sweep. More...
 
int getADSparsityHessian ()
 end revised AD code More...
 
bool getIterateResults (double *x, double *objLambda, double *conLambda, bool new_x, int highestOrder)
 end revised AD code More...
 
bool getZeroOrderResults (double *x, double *objLambda, double *conLambda)
 Calculate function values. More...
 
bool getFirstOrderResults (double *x, double *objLambda, double *conLambda)
 Calculate first derivatives. More...
 
bool getSecondOrderResults (double *x, double *objLambda, double *conLambda)
 Calculate second derivatives. More...
 
bool initForAlgDiff ()
 This should be called by nonlinear solvers using callback functions. More...
 
bool initObjGradients ()
 This should be called by initForAlgDiff() More...
 
bool setTimeDomain (std::string format)
 This sets the format of the time domain ("stages"/"interval"/"none") More...
 
bool setTimeDomainStages (int number, std::string *names)
 This sets the number (and optionally names) of the time stages. More...
 
bool setTimeDomainStageVariablesOrdered (int numberOfStages, int *numberOfVariables, int *startIdx)
 This sets the variables associated with each time domain stage in temporal order. More...
 
bool setTimeDomainStageVariablesUnordered (int numberOfStages, int *numberOfVariables, int **varIndex)
 This sets the variables associated with each time domain stage in srbitrary order. More...
 
bool setTimeDomainStageConstraintsOrdered (int numberOfStages, int *numberOfConstraints, int *startIdx)
 This sets the constraints associated with each time domain stage in temporal order. More...
 
bool setTimeDomainStageConstraintsUnordered (int numberOfStages, int *numberOfConstraints, int **conIndex)
 This sets the constraints associated with each time domain stage in srbitrary order. More...
 
bool setTimeDomainStageObjectivesOrdered (int numberOfStages, int *numberOfObjectives, int *startIdx)
 This sets the objectives associated with each time domain stage in temporal order. More...
 
bool setTimeDomainStageObjectivesUnordered (int numberOfStages, int *numberOfObjectives, int **varIndex)
 This sets the objectives associated with each time domain stage in arbitrary order. More...
 
bool setTimeDomainInterval (double start, double horizon)
 This sets the start and end of the time interval. More...
 
 OSInstance ()
 The OSInstance class constructor. More...
 
 ~OSInstance ()
 The OSInstance class destructor. More...
 
std::string getInstanceName ()
 Get instance name. More...
 
std::string getInstanceSource ()
 Get instance source. More...
 
std::string getInstanceDescription ()
 Get instance description. More...
 
int getVariableNumber ()
 Get variable number. More...
 
std::string * getVariableNames ()
 Get variable names. More...
 
char * getVariableTypes ()
 Get variable initial values. More...
 
int getNumberOfIntegerVariables ()
 getNumberOfIntegerVariables More...
 
int getNumberOfBinaryVariables ()
 getNumberOfBinaryVariables More...
 
double * getVariableLowerBounds ()
 Get variable lower bounds. More...
 
double * getVariableUpperBounds ()
 Get variable upper bounds. More...
 
int getObjectiveNumber ()
 Get objective number. More...
 
std::string * getObjectiveNames ()
 Get objective names. More...
 
std::string * getObjectiveMaxOrMins ()
 Get objective maxOrMins. More...
 
intgetObjectiveCoefficientNumbers ()
 Get objective coefficient number. More...
 
double * getObjectiveConstants ()
 Get objective constants. More...
 
double * getObjectiveWeights ()
 Get objective weights. More...
 
SparseVector ** getObjectiveCoefficients ()
 Get objective coefficients. More...
 
double ** getDenseObjectiveCoefficients ()
 getDenseObjectiveCoefficients. More...
 
int getConstraintNumber ()
 Get constraint number. More...
 
std::string * getConstraintNames ()
 Get constraint names. More...
 
double * getConstraintLowerBounds ()
 Get constraint lower bounds. More...
 
double * getConstraintUpperBounds ()
 Get constraint upper bounds. More...
 
char * getConstraintTypes ()
 Get constraint types. More...
 
int getLinearConstraintCoefficientNumber ()
 Get number of specified (usually nonzero) linear constraint coefficient values. More...
 
bool getLinearConstraintCoefficientMajor ()
 Get whether the constraint coefficients is in column major (true) or row major (false). More...
 
SparseMatrixgetLinearConstraintCoefficientsInColumnMajor ()
 Get linear constraint coefficients in column major. More...
 
SparseMatrixgetLinearConstraintCoefficientsInRowMajor ()
 Get linear constraint coefficients in row major. More...
 
int getNumberOfQuadraticTerms ()
 Get the number of specified (usually nonzero) qTerms in the quadratic coefficients. More...
 
QuadraticTermsgetQuadraticTerms ()
 Get all the quadratic terms in the instance. More...
 
intgetQuadraticRowIndexes ()
 Get the indexes of rows which have a quadratic term. More...
 
int getNumberOfQuadraticRowIndexes ()
 Get the number of rows which have a quadratic term. More...
 
int getNumberOfNonlinearExpressions ()
 Get number of nonlinear expressions. More...
 
OSExpressionTreegetNonlinearExpressionTree (int rowIdx)
 Get the expression tree for a given row index. More...
 
OSExpressionTreegetNonlinearExpressionTreeMod (int rowIdx)
 Get the expression tree for a given row index for the modified expression trees (quadratic terms added) More...
 
std::vector< OSnLNode * > getNonlinearExpressionTreeInPostfix (int rowIdx)
 Get the postfix tokens for a given row index. More...
 
std::vector< OSnLNode * > getNonlinearExpressionTreeModInPostfix (int rowIdx)
 Get the postfix tokens for a given row index for the modified Expression Tree (quadratic terms added). More...
 
std::vector< OSnLNode * > getNonlinearExpressionTreeInPrefix (int rowIdx)
 Get the prefix tokens for a given row index. More...
 
std::vector< OSnLNode * > getNonlinearExpressionTreeModInPrefix (int rowIdx)
 Get the prefix tokens for a given row index for the modified Expression Tree (quadratic terms added). More...
 
int getNumberOfNonlinearObjectives ()
 
int getNumberOfNonlinearConstraints ()
 
std::map< int, OSExpressionTree * > getAllNonlinearExpressionTrees ()
 
std::map< int, OSExpressionTree * > getAllNonlinearExpressionTreesMod ()
 
intgetNonlinearExpressionTreeIndexes ()
 Get all the nonlinear expression tree indexes, i.e. More...
 
int getNumberOfNonlinearExpressionTreeIndexes ()
 Get the number of unique Nonlinear expression tree indexes. More...
 
intgetNonlinearExpressionTreeModIndexes ()
 Get all the nonlinear expression tree indexes, i.e. More...
 
int getNumberOfNonlinearExpressionTreeModIndexes ()
 Get the number of unique Nonlinear expression tree indexes after modifying the expression tree to contain quadratic terms. More...
 
std::string getTimeDomainFormat ()
 Get the format of the time domain ("stages"/"interval") More...
 
int getTimeDomainStageNumber ()
 Get the number of stages that make up the time domain. More...
 
std::string * getTimeDomainStageNames ()
 Get the names of the stages (NULL or empty string ("") if a stage has not been given a name. More...
 
intgetTimeDomainStageNumberOfVariables ()
 Get the number of variables contained in each time stage. More...
 
intgetTimeDomainStageNumberOfConstraints ()
 Get the number of constraints contained in each time stage. More...
 
intgetTimeDomainStageNumberOfObjectives ()
 Get the number of objectives contained in each time stage. More...
 
int ** getTimeDomainStageVarList ()
 Get the list of variables in each stage. More...
 
int ** getTimeDomainStageConList ()
 Get the list of constraints in each stage. More...
 
int ** getTimeDomainStageObjList ()
 Get the list of objectives in each stage. More...
 
double getTimeDomainIntervalStart ()
 Get the start for the time domain interval. More...
 
double getTimeDomainIntervalHorizon ()
 Get the horizon for the time domain interval. More...
 
bool setInstanceSource (std::string source)
 set the instance source. More...
 
bool setInstanceDescription (std::string description)
 set the instance description. More...
 
bool setInstanceName (std::string name)
 set the instance name. More...
 
bool setVariableNumber (int number)
 set the variable number. More...
 
bool addVariable (int index, std::string name, double lowerBound, double upperBound, char type)
 add a variable. More...
 
bool setVariables (int number, std::string *names, double *lowerBounds, double *upperBounds, char *types)
 set all the variable related elements. More...
 
bool setObjectiveNumber (int number)
 set the objective number. More...
 
bool addObjective (int index, std::string name, std::string maxOrMin, double constant, double weight, SparseVector *objectiveCoefficients)
 add an objective. More...
 
bool setObjectives (int number, std::string *names, std::string *maxOrMins, double *constants, double *weights, SparseVector **objectitiveCoefficients)
 set all the objectives related elements. More...
 
bool setConstraintNumber (int number)
 set the constraint number. More...
 
bool addConstraint (int index, std::string name, double lowerBound, double upperBound, double constant)
 add a constraint. More...
 
bool setConstraints (int number, std::string *names, double *lowerBounds, double *upperBounds, double *constants)
 set all the constraint related elements. More...
 
bool setLinearConstraintCoefficients (int numberOfValues, bool isColumnMajor, double *values, int valuesBegin, int valuesEnd, int *indexes, int indexesBegin, int indexesEnd, int *starts, int startsBegin, int startsEnd)
 set linear constraint coefficients More...
 
bool setQuadraticTerms (int number, int *rowIndexes, int *varOneIndexes, int *varTwoIndexes, double *coefficients, int begin, int end)
 set quadratic terms More...
 
bool setQuadraticTermsInNonlinearExpressions (int number, int *rowIndexes, int *varOneIndexes, int *varTwoIndexes, double *coefficients)
 set quadratic terms in nonlinearExpressions More...
 
bool initializeNonLinearStructures ()
 Initialize the data structures for the nonlinear API. More...
 
double calculateFunctionValue (int idx, double *x, bool new_x)
 Calculate the function value for function (constraint or objective) indexed by idx. More...
 
double * calculateAllConstraintFunctionValues (double *x, double *objLambda, double *conLambda, bool new_x, int highestOrder)
 Calculate all of the constraint function values. More...
 
double * calculateAllConstraintFunctionValues (double *x, bool new_x)
 Calculate all of the constraint function values, we are overloading this function and this version of the method will not use any AD and will evaluate function values from the OS Expression Tree. More...
 
double * calculateAllObjectiveFunctionValues (double *x, double *objLambda, double *conLambda, bool new_x, int highestOrder)
 Calculate all of the objective function values. More...
 
double * calculateAllObjectiveFunctionValues (double *x, bool new_x)
 Calculate all of the objective function values, we are overloading this function and this version of the method will not use any AD and will evaluate function values from the OS Expression Tree. More...
 
SparseJacobianMatrixcalculateAllConstraintFunctionGradients (double *x, double *objLambda, double *conLambda, bool new_x, int highestOrder)
 Calculate the gradient of all constraint functions. More...
 
SparseVectorcalculateConstraintFunctionGradient (double *x, double *objLambda, double *conLambda, int idx, bool new_x, int highestOrder)
 Calculate the gradient of the constraint function indexed by idx. More...
 
SparseVectorcalculateConstraintFunctionGradient (double *x, int idx, bool new_x)
 Calculate the gradient of the constraint function indexed by idx this function is overloaded. More...
 
double ** calculateAllObjectiveFunctionGradients (double *x, double *objLambda, double *conLambda, bool new_x, int highestOrder)
 Calculate the gradient of all objective functions. More...
 
double * calculateObjectiveFunctionGradient (double *x, double *objLambda, double *conLambda, int objIdx, bool new_x, int highestOrder)
 Calculate the gradient of the objective function indexed by objIdx. More...
 
double * calculateObjectiveFunctionGradient (double *x, int objIdx, bool new_x)
 Calculate the gradient of the objective function indexed by objIdx this function is overloaded. More...
 
SparseHessianMatrixcalculateLagrangianHessian (double *x, double *objLambda, double *conLambda, bool new_x, int highestOrder)
 Calculate the Hessian of the Lagrangian Expression Tree This method will build the CppAD expression tree for only the first iteration Use this method on if the value of x does not affect the operations sequence. More...
 
SparseHessianMatrixcalculateHessian (double *x, int idx, bool new_x)
 Calculate the Hessian of a constraint or objective function. More...
 
bool getSparseJacobianFromColumnMajor ()
 
bool getSparseJacobianFromRowMajor ()
 
OSExpressionTreegetLagrangianExpTree ()
 
std::map< int, intgetAllNonlinearVariablesIndexMap ()
 
SparseHessianMatrixgetLagrangianHessianSparsityPattern ()
 
bool addQTermsToExressionTree ()
 
SparseJacobianMatrixgetJacobianSparsityPattern ()
 
void duplicateExpressionTreesMap ()
 duplicate the map of expression trees. More...
 
bool createOSADFun (std::vector< double > vdX)
 Create the a CppAD Function object: this is a function where the domain is the set of variables for the problem and the range is the objective function plus constraints. More...
 
std::vector< double > forwardAD (int p, std::vector< double > vdX)
 Perform an AD forward sweep. More...
 
std::vector< double > reverseAD (int p, std::vector< double > vdlambda)
 Perform an AD reverse sweep. More...
 
int getADSparsityHessian ()
 end revised AD code More...
 
bool getIterateResults (double *x, double *objLambda, double *conLambda, bool new_x, int highestOrder)
 end revised AD code More...
 
bool getZeroOrderResults (double *x, double *objLambda, double *conLambda)
 Calculate function values. More...
 
bool getFirstOrderResults (double *x, double *objLambda, double *conLambda)
 Calculate first derivatives. More...
 
bool getSecondOrderResults (double *x, double *objLambda, double *conLambda)
 Calculate second derivatives. More...
 
bool initForAlgDiff ()
 This should be called by nonlinear solvers using callback functions. More...
 
bool initObjGradients ()
 This should be called by initForAlgDiff() More...
 
bool setTimeDomain (std::string format)
 This sets the format of the time domain ("stages"/"interval"/"none") More...
 
bool setTimeDomainStages (int number, std::string *names)
 This sets the number (and optionally names) of the time stages. More...
 
bool setTimeDomainStageVariablesOrdered (int numberOfStages, int *numberOfVariables, int *startIdx)
 This sets the variables associated with each time domain stage in temporal order. More...
 
bool setTimeDomainStageVariablesUnordered (int numberOfStages, int *numberOfVariables, int **varIndex)
 This sets the variables associated with each time domain stage in srbitrary order. More...
 
bool setTimeDomainStageConstraintsOrdered (int numberOfStages, int *numberOfConstraints, int *startIdx)
 This sets the constraints associated with each time domain stage in temporal order. More...
 
bool setTimeDomainStageConstraintsUnordered (int numberOfStages, int *numberOfConstraints, int **conIndex)
 This sets the constraints associated with each time domain stage in srbitrary order. More...
 
bool setTimeDomainStageObjectivesOrdered (int numberOfStages, int *numberOfObjectives, int *startIdx)
 This sets the objectives associated with each time domain stage in temporal order. More...
 
bool setTimeDomainStageObjectivesUnordered (int numberOfStages, int *numberOfObjectives, int **varIndex)
 This sets the objectives associated with each time domain stage in arbitrary order. More...
 
bool setTimeDomainInterval (double start, double horizon)
 This sets the start and end of the time interval. More...
 

Public Attributes

GeneralFileHeaderinstanceHeader
 the instanceHeader is implemented as a general file header object to allow sharing of classes between schemas More...
 
InstanceDatainstanceData
 A pointer to an InstanceData object. More...
 
bool bVariablesModified
 bVariablesModified is true if the variables data has been modified. More...
 
bool bObjectivesModified
 bObjectivesModified is true if the objective function data has been modified. More...
 
bool bConstraintsModified
 bConstraintsModified is true if the constraints data has been modified. More...
 
bool bAMatrixModified
 bAMatrixModified is true if the A matrix data has been modified. More...
 
bool bUseExpTreeForFunEval
 bUseExpTreeForFunEval is set to true if you wish to use the OS Expression Tree for function evaluations instead of AD – false by default. More...
 
InstanceHeaderinstanceHeader
 A pointer to an InstanceHeader object. More...
 

Private Member Functions

bool processVariables ()
 process variables. More...
 
bool processObjectives ()
 process objectives. More...
 
bool processConstraints ()
 process constraints. More...
 
bool processLinearConstraintCoefficients ()
 process linear constraint coefficients. More...
 
bool processMatrices ()
 process matrices. More...
 
bool processVariables ()
 process variables. More...
 
bool processObjectives ()
 process objectives. More...
 
bool processConstraints ()
 process constraints. More...
 
bool processLinearConstraintCoefficients ()
 process linear constraint coefficients. More...
 

Private Attributes

std::string m_sInstanceName
 -—— data items for InstanceHeader -—— More...
 
std::string m_sInstanceSource
 m_sInstanceSource holds the instance source. More...
 
std::string m_sInstanceDescription
 m_sInstanceDescription holds the instance description. More...
 
std::string m_sInstanceCreator
 m_sInstanceSource holds the instance source. More...
 
std::string m_sInstanceLicence
 m_sInstanceDescription holds the instance fileCreator info. More...
 
bool m_bProcessVariables
 -—— data items for Variables -—— More...
 
int m_iVariableNumber
 m_iVariableNumber holds the variable number. More...
 
int m_iNumberOfIntegerVariables
 m_iNumberOfIntegerVariables holds the number of integer variables. More...
 
int m_iNumberOfBinaryVariables
 m_iNumberOfBinaryVariables holds the number of binary variables. More...
 
int m_iNumberOfSemiContinuousVariables
 m_iNumberOfSemiContinuousVariables holds the number of semi-continuous variables. More...
 
int m_iNumberOfSemiIntegerVariables
 m_iNumberOfSemiIntegerVariables holds the number of semi-integer variables. More...
 
int m_iNumberOfStringVariables
 m_iNumberOfStringVariables holds the number of string-valued variables. More...
 
std::string * m_msVariableNames
 m_msVariableNames holds an array of variable names. More...
 
char * m_mcVariableTypes
 m_mcVariableTypes holds a char array of variable types (default = 'C'). More...
 
double * m_mdVariableLowerBounds
 m_mdVariableLowerBounds holds a double array of variable lower bounds (default = 0.0). More...
 
double * m_mdVariableUpperBounds
 m_mdVariableUpperBounds holds a double array of variable upper bounds (default = INF). More...
 
bool m_bProcessObjectives
 -—— data items for Objectives -—— More...
 
int m_iObjectiveNumber
 m_iObjectiveNumber is the number of objective functions. More...
 
int m_iObjectiveNumberNonlinear
 m_iObjectiveNumber is the number of objective functions with a nonlinear term. More...
 
std::string * m_msObjectiveNames
 m_msObjectiveNames holds an array of objective names. More...
 
std::string * m_msMaxOrMins
 m_msMaxOrMins holds a std::string array of objective maxOrMins ("max" or "min"). More...
 
intm_miNumberOfObjCoef
 m_miNumberOfObjCoef holds an integer array of number of objective coefficients (default = 0). More...
 
double * m_mdObjectiveConstants
 m_mdObjectiveConstants holds an array of objective constants (default = 0.0). More...
 
double * m_mdObjectiveWeights
 m_mdObjectiveWeights holds an array of objective weights (default = 1.0). More...
 
SparseVector ** m_mObjectiveCoefficients
 m_mObjectiveCoefficients holds an array of objective coefficients, one set of objective coefficients for each objective. More...
 
bool m_bGetDenseObjectives
 m_bGetDenseObjectives holds whether the dense objective functions are processed. More...
 
double ** m_mmdDenseObjectiveCoefficients
 m_mmdDenseObjectiveCoefficients holds an array of pointers, each pointer points to a vector of dense objective function coefficients More...
 
bool m_bProcessConstraints
 -—— data items for Constraints -—— More...
 
int m_iConstraintNumber
 m_iConstraintNumber is the number of constraints. More...
 
int m_iConstraintNumberNonlinear
 m_iConstraintNumberNonlinear is the number of constraints that have a nonlinear term. More...
 
std::string * m_msConstraintNames
 m_msConstraintNames holds an array of constraint names. More...
 
double * m_mdConstraintLowerBounds
 m_mdConstraintLowerBounds holds an array of constraint lower bounds (default = -INF). More...
 
double * m_mdConstraintUpperBounds
 m_mdConstraintUpperBounds holds an array of constraint upper bounds (default = INF). More...
 
double * m_mdConstraintConstants
 m_mdConstraintConstants holds an array of constraint constants (default = 0.0). More...
 
char * m_mcConstraintTypes
 m_mcConstraintTypes holds a char array of constraint types (R for range; L for <=; G for >=; E for =; U for unconstrained) More...
 
bool m_bProcessLinearConstraintCoefficients
 -—— data items for linear constraint coefficients -—— More...
 
int m_iLinearConstraintCoefficientNumber
 m_iLinearConstraintCoefficientNumber holds the number of specified (usually nonzero) linear constraint coefficient values. More...
 
bool m_bColumnMajor
 m_bColumnMajor holds whether the linear constraint coefficients are stored in column major (if m_bColumnMajor = true) or row major. More...
 
SparseMatrixm_linearConstraintCoefficientsInColumnMajor
 m_linearConstraintCoefficientsInColumnMajor holds the standard three-array data structure for linear constraint coefficients (starts, indexes and values) in column major. More...
 
SparseMatrixm_linearConstraintCoefficientsInRowMajor
 m_linearConstraintCoefficientsInRowMajor holds the standard three-array data structure for linear constraint coefficients (starts, indexes and values) in row major. More...
 
int m_iNumberOfQuadraticRowIndexes
 -—— data items for quadratic coefficients -—— More...
 
bool m_bQuadraticRowIndexesProcessed
 m_bQuadraticRowIndexesProcessed is true if getQuadraticRowIndexes() has been called. More...
 
intm_miQuadRowIndexes
 m_miQuadRowIndexes is an integer pointer to the distinct row indexes with a quadratic term. More...
 
bool m_bProcessQuadraticTerms
 m_bProcessQuadraticTerms holds whether the quadratic terms are processed. More...
 
int m_iQuadraticTermNumber
 m_iQuadraticTermNumber holds the number of specified (usually nonzero) qTerms in the quadratic coefficients. More...
 
QuadraticTermsm_quadraticTerms
 m_quadraticTerms holds the data structure for all the quadratic terms in the instance. More...
 
bool m_bQTermsAdded
 m_bQTermsAdded is true if we added the quadratic terms to the expression tree More...
 
int m_iNumberOfNonlinearExpressionTreeIndexes
 -—— data items for nonlinear expressions -—— More...
 
bool m_bNonlinearExpressionTreeIndexesProcessed
 m_bNonlinearExpressionTreeIndexesProcessed is true if getNonlinearExpressionTreeIndexes() has been called. More...
 
intm_miNonlinearExpressionTreeIndexes
 m_miNonlinearExpressionTreeIndexes is an integer pointer to the distinct rows indexes in the nonlinear expression tree map. More...
 
int m_iNumberOfNonlinearExpressionTreeModIndexes
 m_iNumberOfNonlinearExpressionTreeModIndexes holds the number of distinct rows and objectives with nonlinear terms including quadratic terms added to the nonlinear expression trees. More...
 
bool m_bNonlinearExpressionTreeModIndexesProcessed
 m_bNonlinearExpressionTreeModIndexesProcessed is true if getNonlinearExpressionTreeModIndexes has been called. More...
 
intm_miNonlinearExpressionTreeModIndexes
 m_miNonlinearExpressionTreeModIndexes is an integer pointer to the distinct rows indexes in the modified expression tree map. More...
 
bool m_binitForAlgDiff
 -—— data items for automatic differentiation -—— More...
 
unsigned int m_iNumberOfNonlinearVariables
 m_iNumberOfNonlinearVariables is the number of variables that appear in a nonlinear expression. More...
 
bool m_bProcessNonlinearExpressions
 m_bProcessNonlinearExpressions holds whether the nonlinear expressions are processed. More...
 
int m_iNonlinearExpressionNumber
 m_iNonlinearExpressionNumber holds the number of nonlinear expressions. More...
 
intm_miNonlinearExpressionIndexes
 m_miNonlinearExpressionIndexes holds an integer array of nonlinear expression indexes, negative indexes correspond to objectives. More...
 
bool m_bProcessExpressionTrees
 m_bProcessExpressionTrees is true if the expression trees have been processed. More...
 
bool m_bProcessExpressionTreesMod
 m_bProcessExpressionTreesMod is true if the modified expression trees have been processed. More...
 
double * m_mdConstraintFunctionValues
 m_mdConstraintFunctionValues holds a double array of constraint function values – the size of the array is equal to getConstraintNumber(). More...
 
double * m_mdObjectiveFunctionValues
 m_mdObjectiveFunctionValues holds a double array of objective function values – the size of the array is equal to getObjectiveNumber(). More...
 
int m_iJacValueSize
 m_iJacValueSize is the number of nonzero partial derivates in the Jacobian. More...
 
intm_miJacStart
 m_miJacStart holds a int array of starts for the Jacobian matrix in sparse form (row major). More...
 
intm_miJacIndex
 m_miJacIndex holds a int array of variable indices for the Jacobian matrix in sparse form (row major). More...
 
double * m_mdJacValue
 m_mdJacValue holds a double array of partial derivatives for the Jacobian matrix in sparse form (row major). More...
 
intm_miJacNumConTerms
 m_miJacNumConTerms holds a int array of the number of constant terms (gradient does not change) for the Jacobian matrix in sparse form (row major). More...
 
SparseJacobianMatrixm_sparseJacMatrix
 m_sparseJacMatrix is the Jacobian matrix stored in sparse matrix format More...
 
int m_iHighestTaylorCoeffOrder
 m_iHighestTaylorCoeffOrder is the order of highest calculated Taylor coefficient More...
 
std::map< int,
ScalarExpressionTree * > 
m_mapExpressionTrees
 m_mapExpressionTrees holds a hash map of scalar-valued expression tree pointers. More...
 
std::map< int, intm_mapOSADFunRangeIndex
 m_mapOSADFunRangeIndex is an inverse of the previous map. More...
 
std::map< int,
MatrixExpressionTree * > 
m_mapMatrixExpressionTrees
 m_mapMatrixExpressionTrees holds a hash map of matrix-valued expression tree pointers. More...
 
ScalarExpressionTreem_LagrangianExpTree
 m_LagrangianExpTree is an ScalarExpressionTree object that is the expression tree for the Lagrangian function. More...
 
bool m_bLagrangianExpTreeCreated
 m_bLagrangianHessionCreated is true if a Lagrangian function for the Hessian has been created More...
 
SparseHessianMatrixm_LagrangianSparseHessian
 m_LagrangianSparseHessian is the Hessian Matrix of the Lagrangian function in sparse format More...
 
bool m_bLagrangianSparseHessianCreated
 m_bLagrangianSparseHessianCreated is true if the sparse Hessian Matrix for the Lagrangian was created More...
 
std::map< int, intm_mapAllNonlinearVariablesIndex
 m_mapAllNonlinearVariablesIndexMap is a map of the variables in the Lagrangian function More...
 
intm_miNonLinearVarsReverseMap
 m_miNonLinearVarsReverseMap maps the nonlinear variable number back into the original variable space More...
 
bool m_bAllNonlinearVariablesIndex
 m_bAllNonlinearVariablesIndexMap is true if the map of the variables in the Lagrangian function has been constructed More...
 
std::map< int,
ScalarExpressionTree * > 
m_mapExpressionTreesMod
 m_mapExpressionTreesMod holds a map of expression trees, with the key being the row index and value being the expression tree representing a modification of the nonlinear expression of that row. More...
 
bool m_bOSADFunIsCreated
 m_bOSADFunIsCreated is true if we have created the OSInstanc OSAD Function More...
 
bool m_bCppADTapesBuilt
 is true if a CppAD Expresion Tree has been built for each row and objective with a nonlinear expression. More...
 
bool m_bCppADMustReTape
 is true if a CppAD Expresion Tree has an expression that can change depending on the value of the input, e.g. More...
 
bool m_bDuplicateExpressionTreesMap
 m_bDuplicateExpressionTreeMap is true if m_mapExpressionTrees was duplicated. More...
 
bool m_bNonLinearStructuresInitialized
 m_bNonLinearStructuresInitialized is true if initializeNonLinearStructures() has been called. More...
 
bool m_bSparseJacobianCalculated
 m_bSparseJacobianCalculated is true if getJacobianSparsityPattern() has been called. More...
 
std::map< int, std::vector
< OSnLNode * > > 
m_mapExpressionTreesInPostfix
 m_mapExpressionTreesInPostfix holds a hash map of expression trees in postfix format, with the key being the row index and value being the expression tree representing the nonlinear expression of that row. More...
 
int m_iHighestOrderEvaluated
 m_iHighestOrderEvaluated is the highest order derivative of the current iterate More...
 
double ** m_mmdObjGradient
 m_mdObjGradient holds an array of pointers, each pointer points to gradient of one objective function (as a dense array of double) More...
 
std::vector< double > m_vdX
 -—— data vectors for nonlinear optimization -—— More...
 
std::vector< double > m_vdYval
 m_vdYval is a vector of function values More...
 
std::vector< bool > m_vbLagHessNonz
 m_vbLagHessNonz is a boolean vector holding the nonzero pattern of the Lagrangian of the Hessian More...
 
std::vector< double > m_vdYjacval
 m_vdYval is a vector equal to a column or row of the Jacobian More...
 
std::vector< double > m_vdw
 m_vdYval is a vector of derivatives – output from a reverse sweep More...
 
std::vector< double > m_vdLambda
 m_vdYval is a vector of Lagrange multipliers More...
 
std::vector< double > m_vdDomainUnitVec
 m_vdDomainUnitVec is a unit vector in the domain space More...
 
std::vector< double > m_vdRangeUnitVec
 m_vdRangeUnitVec is a unit vector in the range space More...
 
bool m_bProcessMatrices
 -—— data items for matrices -—— More...
 
int m_iMatrixNumber
 m_iMatrixNumber holds the number of matrices More...
 
ENUM_MATRIX_SYMMETRYm_miMatrixSymmetry
 m_miMatrixSymmetry holds the symmetry property of each matrix. More...
 
ENUM_MATRIX_TYPEm_miMatrixType
 m_miMatrixType holds the type of each matrix. More...
 
intm_miMatrixNumberOfColumns
 m_miMatrixNumberOfColumns holds the number of columns for each matrix. More...
 
intm_miMatrixNumberOfRows
 m_miMatrixNumberOfRows holds the number of rows for each matrix. More...
 
std::string * m_msMatrixNames
 m_msMatrixNames holds the names of the matrices More...
 
OSMatrix ** m_mMatrix
 m_mMatrix holds the list of constructors for each matrix. More...
 
int m_iMatrixVarNumber
 -—— data items for matrix programming -—— More...
 
int m_iMatrixObjNumber
 m_iMatrixObjNumber holds the number of matrix objectives More...
 
int m_iMatrixConNumber
 m_iMatrixConNumber holds the number of matrix constraints More...
 
int m_iMatrixExpressionNumber
 m_iMatrixExpressionNumber holds the number of matrix expressions More...
 
bool m_bProcessTimeDomain
 -—— data items for time domain -—— More...
 
bool m_bProcessTimeStages
 m_bProcessTimeStages holds whether the time stages have been processed. More...
 
bool m_bProcessTimeInterval
 m_bProcessTimeInterval holds whether a time interval has been processed. More...
 
bool m_bFiniteTimeStages
 m_bFiniteTimeStages holds whether the time domain has the form of finite (discrete) stages. More...
 
int m_iNumberOfTimeStages
 m_iNumberOfTimeStages holds the number of discrete stages More...
 
std::string m_sTimeDomainFormat
 m_sTimeDomainFormat holds the format ("stages"/"interval") of the time domain. More...
 
std::string * m_msTimeDomainStageNames
 m_msTimeDomainStageNames holds the names of the time stages. More...
 
intm_miTimeDomainStageVariableNumber
 m_miTimeDomainStageVariableNumber holds the number of variables in each stage. More...
 
int ** m_mmiTimeDomainStageVarList
 m_mmiTimeDomainStageVarList holds the list of variables in each stage. More...
 
intm_miTimeDomainStageConstraintNumber
 m_miTimeDomainStageConstraintNumber holds the number of constraints in each stage. More...
 
int ** m_mmiTimeDomainStageConList
 m_mmiTimeDomainStageConList holds the list of constraints in each stage. More...
 
intm_miTimeDomainStageObjectiveNumber
 m_miTimeDomainStageObjectiveNumber holds the number of objectives in each stage. More...
 
int ** m_mmiTimeDomainStageObjList
 m_mmiTimeDomainStageObjList holds the list of objectives in each stage. More...
 
std::map< int, OSExpressionTree * > m_mapExpressionTrees
 m_mapExpressionTrees holds a hash map of expression tree pointers, with the key being the row index and value being the expression tree representing the nonlinear expression of that row. More...
 
OSExpressionTreem_LagrangianExpTree
 m_LagrangianExpTree is an OSExpressionTree object that is the expression tree for the Lagrangian function. More...
 
std::map< int, OSExpressionTree * > m_mapExpressionTreesMod
 m_mapExpressionTreesMod holds a map of expression trees, with the key being the row index and value being the expression tree representing a modification of the nonlinear expression of that row. More...
 

Detailed Description

The in-memory representation of an OSiL instance..

Remarks

1. Elements become objects of class type (the ComplexType is the class)

2. The attributes, children of the element, and text correspond to members of the class. (Note text does not have a name and becomes .value)

3. Model groups such as choice and sequence and all correspond to arrays

  1. anything specific to XML such as base64, multi, incr do not go into classes
  2. The root OSnLNode of each <nl> element is called ExpressionTree
  3. Root is not called osil it is called osinstance

The OSInstance class is composed of two objects: the header object instanceHeader and the data object instanceData

Remarks

1. Elements become objects of class type (the ComplexType is the class)

2. The attributes, children of the element, and text correspond to members of the class. (Note text does not have a name and becomes .value)

3. Model groups such as choice and sequence and all correspond to arrays

  1. anything specific to XML such as base64, multi, incr do not go into classes
  2. The root OSnLNode of each <nl> element is called ExpressionTree
  3. Root is not called osil it is called osinstance

The OSInstance class is composed of two objects: an InstanceHeader object and and InstanceData object

Definition at line 2262 of file OSInstance.h.

Constructor & Destructor Documentation

OSInstance::OSInstance ( )

The OSInstance class constructor.

Definition at line 36 of file OSInstance.cpp.

OSInstance::~OSInstance ( )

The OSInstance class destructor.

Definition at line 167 of file OSInstance.cpp.

OSInstance::OSInstance ( )

The OSInstance class constructor.

OSInstance::~OSInstance ( )

The OSInstance class destructor.

Member Function Documentation

bool OSInstance::IsEqual ( OSInstance that)

A function to check for the equality of two objects.

Definition at line 8030 of file OSInstance.cpp.

bool OSInstance::processVariables ( )
private

process variables.

Returns
true if the variables are processed.
Exceptions
Exceptionif the elements in variables are logically inconsistent.

Definition at line 2032 of file OSInstance.cpp.

bool OSInstance::processObjectives ( )
private

process objectives.

Returns
true if the objectives are processed.
Exceptions
Exceptionif the elements in objectives are logically inconsistent.

Definition at line 2189 of file OSInstance.cpp.

bool OSInstance::processConstraints ( )
private

process constraints.

Returns
true if the constraints are processed.
Exceptions
Exceptionif the elements in constraints are logically inconsistent.

Definition at line 2341 of file OSInstance.cpp.

bool OSInstance::processLinearConstraintCoefficients ( )
private

process linear constraint coefficients.

Returns
true if the linear constraint coefficients are processed.
Exceptions
Exceptionif the elements in linear constraint coefficients are logically inconsistent.

Definition at line 2454 of file OSInstance.cpp.

bool OSInstance::processMatrices ( )
private

process matrices.

Returns
true if the matrices have been processed.
Exceptions
Exceptionif the declaration of any matrix is logically inconsistent.

Definition at line 3315 of file OSInstance.cpp.

string OSInstance::getInstanceName ( )

Get instance name.

the get() methods

Returns
instance name. Null or empty std::string ("") if there is no instance name.

Definition at line 1963 of file OSInstance.cpp.

string OSInstance::getInstanceSource ( )

Get instance source.

Returns
instance source. Null or empty std::string ("") if there is no instance source.

Definition at line 1974 of file OSInstance.cpp.

string OSInstance::getInstanceDescription ( )

Get instance description.

Returns
instance description. Null or empty std::string ("") if there is no instance description.

Definition at line 1985 of file OSInstance.cpp.

string OSInstance::getInstanceCreator ( )

Get instance fileCreator.

Returns
instance fileCreator. Null or empty std::string ("") if there is no instance file creator.

Definition at line 1996 of file OSInstance.cpp.

string OSInstance::getInstanceLicence ( )

Get instance licence.

Returns
instance licence. Null or empty std::string ("") if there is no instance licence.

Definition at line 2007 of file OSInstance.cpp.

int OSInstance::getVariableNumber ( )

Get number of variables.

Returns
number of variables.

Definition at line 2018 of file OSInstance.cpp.

string * OSInstance::getVariableNames ( )

Get variable names.

Returns
a std::string array of variable names, null if no variable names.
Exceptions
Exceptionif the elements in variables are logically inconsistent.

Definition at line 2119 of file OSInstance.cpp.

char * OSInstance::getVariableTypes ( )

Get variable initial values.

Returns
a double array of variable initial values, null if no initial variable values.
Exceptions
Exceptionif the elements in variables are logically inconsistent. – now deprecated Get variable initial std::string values.
Returns
a std::string array of variable initial values, null if no initial variable std::string values.
Exceptions
Exceptionif the elements in variables are logically inconsistent. – now deprecated Get variable types.
  • C for Continuous
  • B for Binary
  • I for Integer
  • S for String
Returns
a char array of variable types.
Exceptions
Exceptionif the elements in variables are logically inconsistent.

Definition at line 2125 of file OSInstance.cpp.

int OSInstance::getNumberOfIntegerVariables ( )

getNumberOfIntegerVariables

Returns
an integer which is the number of I variables.

Definition at line 2137 of file OSInstance.cpp.

int OSInstance::getNumberOfBinaryVariables ( )

getNumberOfBinaryVariables

Returns
an integer which is the number of B variables.

Definition at line 2131 of file OSInstance.cpp.

int OSInstance::getNumberOfSemiContinuousVariables ( )

getNumberOfSemiContinuousVariables

Returns
an integer which is the number of D variables.

Definition at line 2143 of file OSInstance.cpp.

int OSInstance::getNumberOfSemiIntegerVariables ( )

getNumberOfSemiIntegerVariables

Returns
an integer which is the number of J variables.

Definition at line 2149 of file OSInstance.cpp.

int OSInstance::getNumberOfStringVariables ( )

getNumberOfStringVariables

Returns
an integer which is the number of S variables.

Definition at line 2155 of file OSInstance.cpp.

double * OSInstance::getVariableLowerBounds ( )

Get variable lower bounds.

Returns
a double array of variable lower bounds.
Exceptions
Exceptionif the elements in variables are logically inconsistent.

Definition at line 2161 of file OSInstance.cpp.

double * OSInstance::getVariableUpperBounds ( )

Get variable upper bounds.

Returns
a double array of variable upper bounds.
Exceptions
Exceptionif the elements in variables are logically inconsistent.

Definition at line 2167 of file OSInstance.cpp.

int OSInstance::getObjectiveNumber ( )

Get number of objectives.

Returns
number of objectives.

Definition at line 2174 of file OSInstance.cpp.

string * OSInstance::getObjectiveNames ( )

Get objective names.

Returns
a std::string array of objective names. Null if no objective names.
Exceptions
Exceptionif the elements in objectives are logically inconsistent.

Definition at line 2252 of file OSInstance.cpp.

string * OSInstance::getObjectiveMaxOrMins ( )

Get objective maxOrMins.

One maxOrMin for each objective.

Returns
a std::string array of objective maxOrMins ("max" or "min"), null if no objectives.
Exceptions
Exceptionif the elements in objectives are logically inconsistent.

Definition at line 2258 of file OSInstance.cpp.

int * OSInstance::getObjectiveCoefficientNumbers ( )

Get objective coefficient number.

One number for each objective.

Returns
an integer array of size of which is equal to number of objectives, each element of the array is the number of nonzero coefficients in that objective function, null if no objectives.
Exceptions
Exceptionif the elements in objectives are logically inconsistent.

Definition at line 2264 of file OSInstance.cpp.

double * OSInstance::getObjectiveConstants ( )

Get objective constants.

One constant for each objective.

Returns
a double array of objective constants, null if no objectives.
Exceptions
Exceptionif the elements in objectives are logically inconsistent.

Definition at line 2270 of file OSInstance.cpp.

double * OSInstance::getObjectiveWeights ( )

Get objective weights.

One weight for each objective.

Returns
a double array of objective weights, null if no objectives.
Exceptions
Exceptionif the elements in objectives are logically inconsistent.

Definition at line 2276 of file OSInstance.cpp.

SparseVector ** OSInstance::getObjectiveCoefficients ( )

Get objective coefficients.

One set of objective coefficients for each objective.

See Also
org.optimizationservices.oscommon.datastructure.SparseVector
Returns
an array of objective coefficients, null if no objectives. Each member of the array is of type ObjectiveCoefficients. The ObjectiveCoefficients class contains two arrays: variableIndexes is an integer array and values is a double array of coefficient values.
Exceptions
Exceptionif the elements in objectives are logically inconsistent.

Definition at line 2283 of file OSInstance.cpp.

double ** OSInstance::getDenseObjectiveCoefficients ( )

getDenseObjectiveCoefficients.

Returns
an vector of pointers, each pointer points to a dense vector of ObjectiveCoefficients.

Definition at line 2290 of file OSInstance.cpp.

int OSInstance::getConstraintNumber ( )

Get number of constraints.

Returns
number of constraints.

Definition at line 2327 of file OSInstance.cpp.

string * OSInstance::getConstraintNames ( )

Get constraint names.

Returns
a std::string array of constraint names, null if no constraint names.
Exceptions
Exceptionif the elements in constraints are logically inconsistent.

Definition at line 2406 of file OSInstance.cpp.

double * OSInstance::getConstraintLowerBounds ( )

Get constraint lower bounds.

Returns
a double array of constraint lower bounds, null if no constraints.
Exceptions
Exceptionif the elements in constraints are logically inconsistent.

Definition at line 2419 of file OSInstance.cpp.

double * OSInstance::getConstraintUpperBounds ( )

Get constraint upper bounds.

Returns
a double array of constraint upper bounds, null if no constraints.
Exceptions
Exceptionif the elements in constraints are logically inconsistent.

Definition at line 2425 of file OSInstance.cpp.

double * OSInstance::getConstraintConstants ( )

Get constraint constants.

Returns
a double array of constraint constants, null if no constraints.
Exceptions
Exceptionif the elements in constraints are logically inconsistent.

Definition at line 2431 of file OSInstance.cpp.

char * OSInstance::getConstraintTypes ( )

Get constraint types.

The constraint types are not part of the OSiL schema, but they are used in solver interfaces such as OSLindoSolver.cpp.

  • R for range constraint lb <= constraint <= ub
  • L for less than constraint -INF <= con <= ub or con <= ub
  • G for greater than constraint lb <= con <= INF or con >= lb
  • E for equal to constraint lb <= con <= ub where lb = ub or con = lb (or con = ub)
  • U for unconstrained constraint -INF <= con <= INF
Returns
a char array of constraint types, null if no constraints.
Exceptions
Exceptionif the elements in constraints are logically inconsistent.

Definition at line 2413 of file OSInstance.cpp.

int OSInstance::getLinearConstraintCoefficientNumber ( )

Get number of specified (usually nonzero) linear constraint coefficient values.

Returns
number of specified (usually nonzero) linear constraint coefficient values.

Definition at line 2438 of file OSInstance.cpp.

bool OSInstance::getLinearConstraintCoefficientMajor ( )

Get whether the constraint coefficients is in column major (true) or row major (false).

Returns
whether the constraint coefficients is in column major (true) or row major (false).
Exceptions
Exceptionif the elements in linear constraint coefficients are logically inconsistent.

Definition at line 2518 of file OSInstance.cpp.

SparseMatrix * OSInstance::getLinearConstraintCoefficientsInColumnMajor ( )

Get linear constraint coefficients in column major.

Returns
a sparse matrix representation of linear constraint coefficients in column major, null if no linear constraint coefficients.
Exceptions
Exceptionif the elements in linear constraint coefficients are logically inconsistent.
See Also
org.optimizationservices.oscommon.datastructure.SparseMatrix

Definition at line 2524 of file OSInstance.cpp.

SparseMatrix * OSInstance::getLinearConstraintCoefficientsInRowMajor ( )

Get linear constraint coefficients in row major.

Returns
a sparse matrix representation of linear constraint coefficients in row major, null if no linear constraint coefficients.
Exceptions
Exceptionif the elements in linear constraint coefficients are logically inconsistent.
See Also
org.optimizationservices.oscommon.datastructure.SparseMatrix

Definition at line 2544 of file OSInstance.cpp.

int OSInstance::getNumberOfQuadraticTerms ( )

Get the number of specified (usually nonzero) qTerms in the quadratic coefficients.

Returns
qTerm number.

Definition at line 2565 of file OSInstance.cpp.

QuadraticTerms * OSInstance::getQuadraticTerms ( )

Get all the quadratic terms in the instance.

Returns
the QuadraticTerms data structure for all quadratic terms in the instance, null if no quadratic terms. The QuadraticTerms contains four arrays: rowIndexes, varOneIndexes, varTwoIndexes, coefficients.
Exceptions
Exceptionif the elements in quadratic coefficients are logically inconsistent.
See Also
org.optimizationservices.oscommon.datastructure.QuadraticTerms

Definition at line 2579 of file OSInstance.cpp.

int * OSInstance::getQuadraticRowIndexes ( )

Get the indexes of rows which have a quadratic term.

Returns
an integer pointer to the row indexes of rows with quadratic terms, objectives functions have index < 0 NULL if there are no quadratic terms.

Definition at line 2620 of file OSInstance.cpp.

int OSInstance::getNumberOfQuadraticRowIndexes ( )

Get the number of rows which have a quadratic term.

Returns
an integer which is the number of distinct rows (including obj) with quadratic terms,

Definition at line 2614 of file OSInstance.cpp.

int OSInstance::getNumberOfNonlinearExpressions ( )

Get number of nonlinear expressions.

Returns
the number of nonlinear expressions.

Definition at line 2656 of file OSInstance.cpp.

Nl ** OSInstance::getNonlinearExpressions ( )

Get the pointers to the roots of all expression trees.

Returns
an array of pointers to Nl objects

Definition at line 2670 of file OSInstance.cpp.

ScalarExpressionTree * OSInstance::getNonlinearExpressionTree ( int  rowIdx)

Get the expression tree for a given row index.

Returns
an expression tree

Definition at line 2761 of file OSInstance.cpp.

ScalarExpressionTree * OSInstance::getNonlinearExpressionTreeMod ( int  rowIdx)

Get the expression tree for a given row index for the modified expression trees (quadratic terms added)

Returns
an expression tree

Definition at line 2773 of file OSInstance.cpp.

std::vector< ExprNode * > OSInstance::getNonlinearExpressionTreeInPostfix ( int  rowIdx)

Get the postfix tokens for a given row index.

Returns
a vector of pointers to ExprNodes in postfix, if rowIdx does not index a row with a nonlinear term throw an exception
Remarks
The root node of the expression tree is of type OSnLNode

Definition at line 2785 of file OSInstance.cpp.

std::vector< ExprNode * > OSInstance::getNonlinearExpressionTreeModInPostfix ( int  rowIdx)

Get the postfix tokens for a given row index for the modified Expression Tree (quadratic terms added).

Returns
a vector of pointers to ExprNodes in postfix, if rowIdx does not index a row with a nonlinear term throw an exception

Definition at line 3146 of file OSInstance.cpp.

std::vector< ExprNode * > OSInstance::getNonlinearExpressionTreeInPrefix ( int  rowIdx)

Get the prefix tokens for a given row index.

Returns
a vector of pointers to ExprNodes in prefix, if rowIdx does not index a row with a nonlinear term throw an exception

Definition at line 3172 of file OSInstance.cpp.

std::string OSInstance::getNonlinearExpressionTreeInInfix ( int  rowIdx)

Get the infix representation for a given row (or objective function) index.

Parameters
rowIdxis the index of the row we want to express in infix.
Returns
a string representation of the tree, if rowIdx does not index a row with a nonlinear term throw an exception

Definition at line 2809 of file OSInstance.cpp.

std::vector< ExprNode * > OSInstance::getNonlinearExpressionTreeModInPrefix ( int  rowIdx)

Get the prefix tokens for a given row index for the modified Expression Tree (quadratic terms added).

Returns
a vector of pointers to ExprNodes in prefix, if rowIdx does not index a row with a nonlinear term throw an exception

Definition at line 3196 of file OSInstance.cpp.

int OSInstance::getNumberOfNonlinearObjectives ( )
Returns
the number of Objectives with a nonlinear term

Definition at line 2753 of file OSInstance.cpp.

int OSInstance::getNumberOfNonlinearConstraints ( )
Returns
the number of Constraints with a nonlinear term

Definition at line 2746 of file OSInstance.cpp.

std::map< int, ScalarExpressionTree * > OSInstance::getAllNonlinearExpressionTrees ( )
Returns
a map: the key is the row index and the value is the corresponding expression tree
Remarks
If there are several expressions in a single row, this method combines them by adding OSnLPlus nodes

Definition at line 3221 of file OSInstance.cpp.

std::map< int, ScalarExpressionTree * > OSInstance::getAllNonlinearExpressionTreesMod ( )
Returns
a map: the key is the row index and the value is the corresponding expression tree

Definition at line 3290 of file OSInstance.cpp.

int * OSInstance::getNonlinearExpressionTreeIndexes ( )

Get all the nonlinear expression tree indexes, i.e., indexes of rows (objectives or constraints) that contain nonlinear expressions.

Returns
a pointer to an integer array of nonlinear expression tree indexes.

Definition at line 2687 of file OSInstance.cpp.

int OSInstance::getNumberOfNonlinearExpressionTreeIndexes ( )

Get the number of unique nonlinear expression tree indexes.

Returns
the number of unique nonlinear expression tree indexes.

Definition at line 2681 of file OSInstance.cpp.

int * OSInstance::getNonlinearExpressionTreeModIndexes ( )

Get all the nonlinear expression tree indexes, i.e., indexes of rows (objectives or constraints) that contain nonlinear expressions after modifying the expression tree to contain quadratic terms.

Returns
a pointer to an integer array of nonlinear expression tree indexes (including quadratic terms).

Definition at line 2720 of file OSInstance.cpp.

int OSInstance::getNumberOfNonlinearExpressionTreeModIndexes ( )

Get the number of unique nonlinear expression tree indexes after modifying the expression tree to contain quadratic terms.

Returns
the number of unique nonlinear expression tree indexes (including quadratic terms).

Definition at line 2714 of file OSInstance.cpp.

int OSInstance::getMatrixNumber ( )

Get the number of matrices.

Returns
the number of matrices.

Definition at line 3301 of file OSInstance.cpp.

ENUM_MATRIX_TYPE OSInstance::getMatrixType ( int  n)

Get the matrix type.

Returns
the type of elements contained in the matrix.
Parameters
nis the index number associated with the matrix.
Remarks
only the most general element type is returned. (e.g., if matrix contains both constants and general expressions, matrix type is ENUM_MATRIX_TYPE_general
for possible types see OSParameters.h
ENUM_MATRIX_SYMMETRY OSInstance::getMatrixSymmetry ( int  n)

Get the matrix symmetry.

Returns
the type of symmetry found in the matrix.
Parameters
nis the index number associated with the matrix.
Remarks
for possible symmetry types see OSParameters.h
int OSInstance::getNumberOfColumnsForMatrix ( int  n)

Get the number of blocks in the matrix.

Parameters
nis the index number associated with the matrix.
Returns
the number of blocks. Get the number of columns in the matrix.
Parameters
nis the index number associated with the matrix.
Returns
the number of columns.
int OSInstance::getNumberOfRowsForMatrix ( int  n)

Get the number of rows in the matrix.

Parameters
nis the index number associated with the matrix.
Returns
the number of rows.
int OSInstance::getNumberOfValuesForMatrix ( int  n)

Get the number of (nonzero) values in the matrix.

Parameters
nis the index number associated with the matrix.
Returns
the number of values.
std::string OSInstance::getMatrixName ( int  n)

Get the name of the matrix.

Parameters
nis the index number associated with the matrix.
Returns
the matrix name.
bool OSInstance::matrixHasBase ( int  n)

Several tools to parse the constructor list of a matrix.

Parameters
nis the index number associated with the matrix.

Definition at line 3442 of file OSInstance.cpp.

bool OSInstance::matrixHasElements ( int  n)

Definition at line 3450 of file OSInstance.cpp.

bool OSInstance::matrixHasTransformations ( int  n)

Definition at line 3458 of file OSInstance.cpp.

bool OSInstance::matrixHasBlocks ( int  n)

Definition at line 3466 of file OSInstance.cpp.

int OSInstance::getNumberOfElementConstructors ( int  n)

Definition at line 3474 of file OSInstance.cpp.

int OSInstance::getNumberOfTransformationConstructors ( int  n)

Definition at line 3482 of file OSInstance.cpp.

int OSInstance::getNumberOfBlocksConstructors ( int  n)

Definition at line 3490 of file OSInstance.cpp.

OSMatrix* OSInstance::getMatrix ( int  n)

Get the list of constructors of the matrix.

Parameters
nis the index number associated with the matrix.
Returns
the matrix constructors.
GeneralSparseMatrix * OSInstance::getMatrixCoefficientsInColumnMajor ( int  n)

Get the (nonzero) elements of the matrix in column major form.

Parameters
nis the index number associated with the matrix.
Returns
the (nonzero) matrix elements.

Definition at line 3499 of file OSInstance.cpp.

GeneralSparseMatrix * OSInstance::getMatrixCoefficientsInRowMajor ( int  n)

Get the (nonzero) elements of the matrix in row major form.

Parameters
nis the index number associated with the matrix.
Returns
the (nonzero) matrix elements.

Definition at line 3517 of file OSInstance.cpp.

GeneralSparseMatrix* OSInstance::getMatrixBlockInColumnMajorForm ( int  n,
int  columnIdx,
int  rowIdx 
)

Get the (nonzero) elements of the matrix in symmetric block form.

Parameters
nis the index number associated with the matrix.
Returns
the (nonzero) matrix elements. Get a block of the matrix (in symmetric column major form).
Parameters
nis the index number associated with the matrix.
columnIdxis the column index of the block's location
rowIdxis the row index of the block's location
Returns
the (nonzero) matrix elements on column major form.
Remarks
if the block in this location is empty, return NULL.
int OSInstance::getNumberOfMatrixVariables ( )

Get the number of matrix variables.

Returns
the number of matrix variables

Definition at line 3536 of file OSInstance.cpp.

int OSInstance::getNumberOfMatrixObjectives ( )

Get the number of matrix objectives.

Returns
the number of matrix objectives

Definition at line 3551 of file OSInstance.cpp.

int OSInstance::getNumberOfMatrixConstraints ( )

Get the number of matrix constraints.

Returns
the number of matrix constraints

Definition at line 3566 of file OSInstance.cpp.

int OSInstance::getNumberOfMatrixExpressions ( )

Get the number of matrix-valued expressions.

Returns
the number of matrix-valued variables

Definition at line 3581 of file OSInstance.cpp.

MatrixExpression** OSInstance::getMatrixExpressions ( )

Get the pointers to the roots of all matrix expression trees.

Returns
an array of pointers to MatrixExpression objects
MatrixExpressionTree* OSInstance::getMatrixExpressionTree ( int  rowIdx)

Get the matrix expression tree for a given row index.

Returns
a matrix expression tree
std::vector<ExprNode*> OSInstance::getMatrixExpressionTreeInPostfix ( int  rowIdx)

Get the postfix tokens for a given row index.

Returns
a vector of pointers to OSnLNodes in postfix, if rowIdx does not index a row with a nonlinear term throw an exception
std::vector<ExprNode*> OSInstance::getMatrixExpressionTreeModInPostfix ( int  rowIdx)

Get the postfix tokens for a given row index for the modified Expression Tree (quadratic terms added).

Returns
a vector of pointers to OSnLNodes in postfix, if rowIdx does not index a row with a nonlinear term throw an exception
std::vector<ExprNode*> OSInstance::getMatrixExpressionTreeInPrefix ( int  rowIdx)

Get the prefix tokens for a given row index.

Returns
a vector of pointers to OSnLNodes in prefix, if rowIdx does not index a row with a nonlinear term throw an exception
std::string OSInstance::getMatrixExpressionTreeInInfix ( int  rowIdx)

Get the infix representation for a given row (or objective function) index.

Parameters
rowIdxis the index of the row we want to express in infix.
Returns
a string representation of the tree, if rowIdx does not index a row with a nonlinear term throw an exception
std::map<int, MatrixExpressionTree* > OSInstance::getAllMatrixExpressionTrees ( )
Returns
a map: the key is the row index and the value is the corresponding expression tree
std::map<int, MatrixExpressionTree* > OSInstance::getAllMatrixExpressionTreesMod ( )
Returns
a map: the key is the row index and the value is the corresponding expression tree
int* OSInstance::getMatrixExpressionTreeIndexes ( )

Get all the matrix expression tree indexes, i.e.

indexes of matrix objectives or matrix constraints that contain matrix expressions.

Returns
a pointer to an integer array of matrix expression tree indexes.
int OSInstance::getNumberOfMatrixExpressionTreeIndexes ( )

Get the number of unique matrix expression tree indexes.

Returns
the number of unique matrix expression tree indexes.
std::string OSInstance::getTimeDomainFormat ( )

Get the format of the time domain ("stages"/"interval")

Returns
the format of the time domain.

Definition at line 4197 of file OSInstance.cpp.

int OSInstance::getTimeDomainStageNumber ( )

Get the number of stages that make up the time domain.

Returns
the number of time stages.

Definition at line 4208 of file OSInstance.cpp.

std::string * OSInstance::getTimeDomainStageNames ( )

Get the names of the stages (NULL or empty string ("") if a stage has not been given a name.

Returns
the names of time stages.

Definition at line 4226 of file OSInstance.cpp.

int * OSInstance::getTimeDomainStageNumberOfVariables ( )

Get the number of variables contained in each time stage.

Returns
a vector of size numberOfStages.

Definition at line 4245 of file OSInstance.cpp.

int * OSInstance::getTimeDomainStageNumberOfConstraints ( )

Get the number of constraints contained in each time stage.

Returns
a vector of size numberOfStages.

Definition at line 4263 of file OSInstance.cpp.

int * OSInstance::getTimeDomainStageNumberOfObjectives ( )

Get the number of objectives contained in each time stage.

Returns
a vector of size numberOfStages.

Definition at line 4281 of file OSInstance.cpp.

int ** OSInstance::getTimeDomainStageVarList ( )

Get the list of variables in each stage.

Returns
one array of integers for each stage.

Definition at line 4299 of file OSInstance.cpp.

int ** OSInstance::getTimeDomainStageConList ( )

Get the list of constraints in each stage.

Returns
one array of integers for each stage.

Definition at line 4337 of file OSInstance.cpp.

int ** OSInstance::getTimeDomainStageObjList ( )

Get the list of objectives in each stage.

Returns
one array of integers for each stage.

Definition at line 4375 of file OSInstance.cpp.

double OSInstance::getTimeDomainIntervalStart ( )

Get the start for the time domain interval.

Returns
start end of the time interval.

Definition at line 4411 of file OSInstance.cpp.

double OSInstance::getTimeDomainIntervalHorizon ( )

Get the horizon for the time domain interval.

Returns
the end of the time interval.

Definition at line 4422 of file OSInstance.cpp.

bool OSInstance::setInstanceName ( std::string  name)

set the instance name.

Parameters
nameholds the instance name.
Returns
whether the instance name was set successfully.
bool OSInstance::setInstanceSource ( std::string  source)

set the instance source.

Parameters
sourceholds the instance source.
Returns
whether the instance source was set successfully.
bool OSInstance::setInstanceDescription ( std::string  description)

set the instance description.

Parameters
descriptionholds the instance description.
Returns
whether the instance description was set successfully.
bool OSInstance::setInstanceCreator ( std::string  fileCreator)

set the instance creator.

Parameters
fileCreatorholds the instance creator.
Returns
whether the instance creator was set successfully.

Definition at line 4456 of file OSInstance.cpp.

bool OSInstance::setInstanceLicence ( std::string  licence)

set the instance licence.

Parameters
licenceholds the instance licence.
Returns
whether the instance licence was set successfully.

Definition at line 4462 of file OSInstance.cpp.

bool OSInstance::setVariableNumber ( int  number)

set the number of variables.

Parameters
numberholds the number of variables.
Returns
whether the number was set successfully.

Definition at line 4469 of file OSInstance.cpp.

bool OSInstance::addVariable ( int  index,
std::string  name,
double  lowerBound,
double  upperBound,
char  type 
)

add a variable.

In order to use the add method, the setVariableNumber must first be called so that the number of variables is known ahead of time to allocate appropriate memory. If a variable with the given variable index already exists, the old variable will be replaced.

Parameters
indexholds the variable index. It is required.
nameholds the variable name; use null or empty std::string ("") if no variable name.
lowerBoundholds the variable lower bound; use -OSDBL_MAX if no lower bound.
upperBoundholds the variable upper bound; use OSDBL_MAX if no upper bound.
typeholds the variable type character: C for Continuous, B for Binary, I for Integer, S for String, D for semi-continuous, J for semi-integer (i.e., either 0 or integer >=n).
Returns
whether the variable was added successfully.
bool OSInstance::setVariables ( int  number,
std::string *  names,
double *  lowerBounds,
double *  upperBounds,
char *  types 
)

set all the variable related elements.

All the previous variable-related elements will be deleted.

Parameters
numberholds the number of variables. It is required.
namesholds a std::string array of variable names; use null if no variable names.
lowerBoundsholds a double array of variable lower bounds; use null if all lower bounds are 0; use -OSDBL_MAX if no lower bound for a specific variable in the array.
upperBoundsholds a double array of variable upper bounds; use null if no upper bounds; use OSDBL_MAX if no upper bound for a specific variable in the array.
typesholds a char array of variable types; use null if all variables are continuous; for a specfic variable in the array use C for Continuous, B for Binary, I for Integer, S for String, D for semi-continuous, J for semi-integer (i.e., either 0 or integer >=n).
initsholds a double array of varible initial values; use null if no initial values. – deprecated
initsStringholds a std::string array of varible initial values; use null if no initial std::string values. – deprecated
Returns
whether the variables were set successfully.
bool OSInstance::setObjectiveNumber ( int  number)

set the number of objectives.

Parameters
numberholds the number of objectives.
Returns
whether the number of objectives was set successfully.

Definition at line 4558 of file OSInstance.cpp.

bool OSInstance::addObjective ( int  index,
std::string  name,
std::string  maxOrMin,
double  constant,
double  weight,
SparseVector objectiveCoefficients 
)

add an objective.

In order to use the add method, the setObjectiveNumber must first be called so that the objective number is known ahead of time to allocate appropriate memory. If a objective with the given objective index already exists, the old objective will be replaced. Objective index will start from -1, -2, -3, ... down, with -1 corresponding to the first objective.

Parameters
indexholds the objective index. Remember the first objective index is -1, second -2, ...
nameholds the objective name; use null or empty std::string ("") if no objective name.
maxOrMinholds the objective sense or direction; it can only take two values: "max" or "min".
constantholds the objective constant; use 0.0 if no objective constant.
weightholds the objective weight; use 1.0 if no objective weight.
objectiveCoefficientsholds the objective coefficients (null if no objective coefficients) in a sparse representation that holds two arrays: index array and a value array.
Returns
whether the objective was added successfully.
bool OSInstance::setObjectives ( int  number,
std::string *  names,
std::string *  maxOrMins,
double *  constants,
double *  weights,
SparseVector **  objectitiveCoefficients 
)

set all the objectives related elements.

All the previous objective-related elements will be deleted.

Parameters
numberholds the number of objectives. It is required.
namesholds a std::string array of objective names; use null if no objective names.
maxOrMinsholds a std::string array of objective objective senses or directions: "max" or "min"; use null if all objectives are "min".
constantsholds a double array of objective constants; use null if all objective constants are 0.0.
weightsholds a double array of objective weights; use null if all objective weights are 1.0.
objectiveCoefficientsholds an array of objective coefficients, (null if no objective has any coefficients) For each objective, the coefficients are stored in a sparse representation that holds two arrays: index array and a value array. If for a specific objective, there are no objective coefficients, use null for the corresponding array member.
Returns
whether the objectives were set successfully.
bool OSInstance::setConstraintNumber ( int  number)

set the number of constraints.

Parameters
numberholds the number of constraints.
Returns
whether the number of constraints was set successfully.

Definition at line 4672 of file OSInstance.cpp.

bool OSInstance::addConstraint ( int  index,
std::string  name,
double  lowerBound,
double  upperBound,
double  constant 
)

add a constraint.

In order to use the add method, the setConstraintNumber must first be called so that the constraint number is known ahead of time to allocate appropriate memory. If a constraint with the given constraint index already exists, the old constraint will be replaced.

Parameters
indexholds the constraint index. It is required.
nameholds the constraint name; use null or empty std::string ("") if no constraint name.
lowerBoundholds the constraint lower bound; use -OSDBL_MAX if no lower bound.
upperBoundholds the constraint upper bound; use OSDBL_MAX if no upper bound.
Returns
whether the constraint was added successfully.
bool OSInstance::setConstraints ( int  number,
std::string *  names,
double *  lowerBounds,
double *  upperBounds,
double *  constants 
)

set all the constraint related elements.

All the previous constraint-related elements will be deleted.

Parameters
numberholds the number of constraints. It is required.
namesholds a std::string array of constraint names; use null if no constraint names.
lowerBoundsholds a double array of constraint lower bounds; use null if no lower bounds; use -OSDBL_MAX if no lower bound for a specific constraint in the array.
upperBoundsholds a double array of constraint upper bounds; use null if no upper bounds; use OSDBL_MAX if no upper bound for a specific constraint in the array.
Returns
whether the constraints were set successfully.
bool OSInstance::setLinearConstraintCoefficients ( int  numberOfValues,
bool  isColumnMajor,
double *  values,
int  valuesBegin,
int  valuesEnd,
int indexes,
int  indexesBegin,
int  indexesEnd,
int starts,
int  startsBegin,
int  startsEnd 
)

set linear constraint coefficients

Parameters
numberOfValuesholds the number of specified coefficient values (usually nonzero) in the coefficient matrix.
isColumnMajorholds whether the coefficient matrix is stored in column major (true) or row major (false).
valuesholds a double array coefficient values in the matrix.
valuesBeginholds the begin index of the values array to copy from (usually 0).
valuesEndholds the end index of the values array to copy till (usually values.length - 1).
indexesholds an integer array column/row indexes for each value in the values array.
indexesBeginholds the begin index of the indexes array to copy from (usually 0).
indexesEndholds the end index of the indexes array to copy till (usually indexes.length - 1).
startsholds an integer array start indexes in the matrix; the first value of starts should always be 0.
startsBeginholds the begin index of the starts array to copy from (usually 0).
startsEndholds the end index of the starts array to copy till (usually starts.length - 1).
Returns
whether the linear constraint coefficients were set successfully.

Definition at line 4755 of file OSInstance.cpp.

bool OSInstance::copyLinearConstraintCoefficients ( int  numberOfValues,
bool  isColumnMajor,
double *  values,
int  valuesBegin,
int  valuesEnd,
int indexes,
int  indexesBegin,
int  indexesEnd,
int starts,
int  startsBegin,
int  startsEnd 
)

copy linear constraint coefficients: perform a deep copy of the sparse matrix

Parameters
numberOfValuesholds the number of specified coefficient values (usually nonzero) in the coefficient matrix.
isColumnMajorholds whether the coefficient matrix is stored in column major (true) or row major (false).
valuesholds a double array coefficient values in the matrix.
valuesBeginholds the begin index of the values array to copy from (usually 0).
valuesEndholds the end index of the values array to copy till (usually values.length - 1).
indexesholds an integer array column/row indexes for each value in the values array.
indexesBeginholds the begin index of the indexes array to copy from (usually 0).
indexesEndholds the end index of the indexes array to copy till (usually indexes.length - 1).
startsholds an integer array start indexes in the matrix; the first value of starts should always be 0.
startsBeginholds the begin index of the starts array to copy from (usually 0).
startsEndholds the end index of the starts array to copy till (usually starts.length - 1).
Returns
whether the linear constraint coefficients were copied successfully.

Definition at line 4820 of file OSInstance.cpp.

bool OSInstance::setNumberOfQuadraticTerms ( int  nq)

set the number of quadratic terms

Parameters
nqholds the number of quadratic terms.
Returns
whether the number of quadratic terms was set successfully.

Definition at line 4907 of file OSInstance.cpp.

bool OSInstance::setQuadraticCoefficients ( int  number,
int rowIndexes,
int varOneIndexes,
int varTwoIndexes,
double *  coefficients,
int  begin,
int  end 
)

set quadratic coefficients into the QuadraticCoefficients->qTerm data structure

Parameters
numberholds the number of quadratic terms.
rowIndexesholds an integer array of row indexes of all the quadratic terms. A negative integer corresponds to an objective row, e.g. -1 for 1st objective and -2 for 2nd.
varOneIndexesholds an integer array of the first variable indexes of all the quadratic terms.
varTwoIndexesholds an integer array of the second variable indexes of all the quadratic terms.
coefficientsholds an array of double containing all the quadratic term coefficients.
beginholds the begin index of all the arrays to copy from (usually = 0).
endholds the end index of all the arrays to copy till (usually = array length -1).
Returns
whether the quadratic terms were set successfully.

Definition at line 4920 of file OSInstance.cpp.

bool OSInstance::setQuadraticTermsInNonlinearExpressions ( int  number,
int rowIndexes,
int varOneIndexes,
int varTwoIndexes,
double *  coefficients 
)

set quadratic terms in nonlinearExpressions

Parameters
numberholds the number of quadratic terms.
rowIndexesholds an integer array of row indexes of all the quadratic terms. A negative integer corresponds to an objective row, e.g. -1 for 1st objective and -2 for 2nd.
varOneIndexesholds an integer array of the first variable indexes of all the quadratic terms.
varTwoIndexesholds an integer array of the second variable indexes of all the quadratic terms.
coefficientsholds a double array all the quadratic term coefficients.
Returns
whether the quadratic terms were set successfully.

Definition at line 4958 of file OSInstance.cpp.

bool OSInstance::setNonlinearExpressions ( int  nexpr,
Nl **  root 
)

set nonlinear expressions

Parameters
nexprholds the number of nonlinear expressions.
rootholds a pointer array to the root nodes of all the nonlinear expressions.
Returns
whether the nonlinear expressions were set successfully.

Definition at line 4996 of file OSInstance.cpp.

bool OSInstance::setMatrixNumber ( int  number)

set the number of matrices

Parameters
numberholds the number of matrices
Returns
whether the number of matrices was set successfully.

Definition at line 5240 of file OSInstance.cpp.

bool OSInstance::addMatrix ( int  index,
std::string  name,
int  numberOfRows,
int  numberOfColumns,
ENUM_MATRIX_SYMMETRY  symmetry,
ENUM_MATRIX_TYPE  matrixType,
unsigned int  inumberOfChildren,
MatrixNode **  m_mChildren 
)

add a matrix.

In order to use the add method, the setMatrixNumber must first be called so that the number of matrices is known ahead of time to allocate appropriate memory. If a matrix with the given matrix index already exists, the old matrix will be replaced.

Parameters
indexholds the matrix index. It is required.
nameholds the matrix name; use null or empty std::string ("") if no matrix name.
numberOfRowsholds the number of rows. It is required. Use 1 for column vectors.
numberOfColumnsholds the number of columns. It is required. Use 1 for row vectors.
symmetryholds the type of symmetry used in the definition of the matrix. For more information see the enumeration ENUM_MATRIX_SYMMETRY in OSGeneral.h. If no symmetry, use ENUM_MATRIX_SYMMETRY_none.
matrixTypetracks the type of elements contained in this matrix. For more information see the enumeration ENUM_MATRIX_TYPE in OSGeneral.h. If unsure, use ENUM_MATRIX_TYPE_unknown.
inumberOfChildrenis the number of MatrixNode child elements, i.e., the number of matrix constructors in the m_mChildren array.
m_mChildrenis the array of matrix constructors used in the definition of this matrix.
Returns
whether the matrix was added successfully.

Definition at line 5255 of file OSInstance.cpp.

bool OSInstance::setConeNumber ( int  number)

set the number of cones

Parameters
numberholds the number of cones
Returns
whether the number of cones was set successfully.

Definition at line 5267 of file OSInstance.cpp.

bool OSInstance::addCone ( int  index,
int  numberOfRows,
int  numberOfColumns,
ENUM_CONE_TYPE  coneType,
std::string  name,
int  numberOfOtherIndexes = 0,
int otherIndexes = NULL 
)

add a cone.

In order to use the add method, the setConeNumber must first be called so that the number of cones is known ahead of time to allocate appropriate memory. If a cone with the given cone index already exists, the old cone will be replaced.

Remarks
This method has different signatures to cater for different types of cones. This signature is used for cones that require basic information only.
Parameters
indexholds the cone index. It is required.
numberOfRowsholds the number of rows. It is required.
numberOfColumnsholds the number of columns. It is required.
coneTypeholds the cone type. For more information consult the enumeration ENUM_CONE_TYPE further up in this file. This argument is required and must be one of ENUM_CONE_TYPE_nonnegative, ENUM_CONE_TYPE_nonpositive, ENUM_CONE_TYPE_copositiveMatrices, ENUM_CONE_TYPE_completelyPositiveMatrices.
nameholds the cone name; use null or empty std::string ("") if no cone name.
numberOfOtherIndexesholds the number of other indexes if the cone contains higher-dimensional tensors. This argument is optional and can be omitted. It defaults to 0.
otherIndexesholds the array of other indexes if the cone contains higher-dimensional tensors. This argument is optional and can be omitted. It defaults to null.
Returns
whether the cone was added successfully.

Definition at line 5280 of file OSInstance.cpp.

bool OSInstance::addCone ( int  index,
int  numberOfRows,
int  numberOfColumns,
ENUM_CONE_TYPE  coneType,
std::string  name,
int  numberOfComponents,
int components,
int  numberOfOtherIndexes = 0,
int otherIndexes = NULL 
)

add a cone.

In order to use the add method, the setConeNumber must first be called so that the number of cones is known ahead of time to allocate appropriate memory. If a cone with the given cone index already exists, the old cone will be replaced.

Remarks
This method has different signatures to cater for different types of cones. This signature is used for product and intersection cones.
Parameters
indexholds the cone index. It is required.
numberOfRowsholds the number of rows. It is required.
numberOfColumnsholds the number of columns. It is required.
coneTypeholds the cone type. For more information consult the enumeration ENUM_CONE_TYPE further up in this file. This argument is required and must be one of ENUM_CONE_TYPE_product, ENUM_CONE_TYPE_intersection.
nameholds the cone name; use null or empty std::string ("") if no cone name.
numberOfComponentsholds the number of components of this cone.
componentsholds the indexes of the components of this cone.
numberOfOtherIndexesholds the number of other indexes if the cone contains higher-dimensional tensors. This argument is optional and can be omitted. It defaults to 0.
otherIndexesholds the array of other indexes if the cone contains higher-dimensional tensors. This argument is optional and can be omitted. It defaults to null.
Returns
whether the cone was added successfully.

Definition at line 5333 of file OSInstance.cpp.

bool OSInstance::addCone ( int  index,
int  numberOfRows,
int  numberOfColumns,
ENUM_CONE_TYPE  coneType,
std::string  name,
int  referenceIdx,
int  numberOfOtherIndexes = 0,
int otherIndexes = NULL 
)

add a cone.

In order to use the add method, the setConeNumber must first be called so that the number of cones is known ahead of time to allocate appropriate memory. If a cone with the given cone index already exists, the old cone will be replaced.

Remarks
This method has different signatures to cater for different types of cones. This signature is used for positive or negative cones that reference another cone or matrix.
Parameters
indexholds the cone index. It is required.
numberOfRowsholds the number of rows. It is required.
numberOfColumnsholds the number of columns. It is required.
coneTypeholds the cone type. For more information consult the enumeration ENUM_CONE_TYPE further up in this file. This argument is required and must be one of ENUM_CONE_TYPE_dual, ENUM_CONE_TYPE_polar, ENUM_CONE_TYPE_polyhedral.
nameholds the cone name; use null or empty std::string ("") if no cone name.
referenceIdxholds the index of a cone or matrix used in the definition of this cone.
numberOfOtherIndexesholds the number of other indexes if the cone contains higher-dimensional tensors. This argument is optional and can be omitted. It defaults to 0.
otherIndexesholds the array of other indexes if the cone contains higher-dimensional tensors. This argument is optional and can be omitted. It defaults to null.
Returns
whether the cone was added successfully.

Definition at line 5375 of file OSInstance.cpp.

bool OSInstance::addCone ( int  index,
int  numberOfRows,
int  numberOfColumns,
ENUM_CONE_TYPE  coneType,
std::string  name,
std::string  semidefiniteness,
int  numberOfOtherIndexes = 0,
int otherIndexes = NULL 
)

add a cone.

In order to use the add method, the setConeNumber must first be called so that the number of cones is known ahead of time to allocate appropriate memory. If a cone with the given cone index already exists, the old cone will be replaced.

Remarks
This method has different signatures to cater for different types of cones. This signature is used for positive or negative semidefinite cones.
Parameters
indexholds the cone index. It is required.
numberOfRowsholds the number of rows. It is required.
numberOfColumnsholds the number of columns. It is required.
coneTypeholds the cone type. For more information consult the enumeration ENUM_CONE_TYPE further up in this file. This argument is required and must be ENUM_CONE_TYPE_semidefinite.
nameholds the cone name; use null or empty std::string ("") if no cone name.
semidefinitenessdistinguishes positive and negative semidefinite cones. It must be either "positive" or "negative".
numberOfOtherIndexesholds the number of other indexes if the cone contains higher-dimensional tensors. This argument is optional and can be omitted. It defaults to 0.
otherIndexesholds the array of other indexes if the cone contains higher-dimensional tensors. This argument is optional and can be omitted. It defaults to null.
Returns
whether the cone was added successfully.

Definition at line 5424 of file OSInstance.cpp.

bool OSInstance::addCone ( int  index,
int  numberOfRows,
int  numberOfColumns,
ENUM_CONE_TYPE  coneType,
std::string  name,
int  distortionMatrixIdx,
double  normFactor,
int  axisDirection,
int  numberOfOtherIndexes = 0,
int otherIndexes = NULL 
)

add a cone.

In order to use the add method, the setConeNumber must first be called so that the number of cones is known ahead of time to allocate appropriate memory. If a cone with the given cone index already exists, the old cone will be replaced.

Remarks
This method has different signatures to cater for different types of cones. This signature is used for quadratic cones.
Parameters
indexholds the cone index. It is required.
numberOfRowsholds the number of rows. It is required.
numberOfColumnsholds the number of columns. It is required.
coneTypeholds the cone type. For more information consult the enumeration ENUM_CONE_TYPE further up in this file. This argument is required and must be ENUM_CONE_TYPE_quadratic.
nameholds the cone name; use null or empty std::string ("") if no cone name.
distortionMatrixIdxholds the index of a distortion matrix. Use -1 if there is none.
normFactorholds a scale factor for the norm. Use 1 if there is none.
axisDirectionholds the index of the axis direction. The most usual value is 0.
numberOfOtherIndexesholds the number of other indexes if the cone contains higher-dimensional tensors. This argument is optional and can be omitted. It defaults to 0.
otherIndexesholds the array of other indexes if the cone contains higher-dimensional tensors. This argument is optional and can be omitted. It defaults to null.
Returns
whether the cone was added successfully.

Definition at line 5447 of file OSInstance.cpp.

bool OSInstance::addCone ( int  index,
int  numberOfRows,
int  numberOfColumns,
ENUM_CONE_TYPE  coneType,
std::string  name,
int  distortionMatrixIdx,
double  normFactor,
int  firstAxisDirection,
int  secondAxisDirection,
int  numberOfOtherIndexes = 0,
int otherIndexes = NULL 
)

add a cone.

In order to use the add method, the setConeNumber must first be called so that the number of cones is known ahead of time to allocate appropriate memory. If a cone with the given cone index already exists, the old cone will be replaced.

Remarks
This method has different signatures to cater for different types of cones. This signature is used for rotated quadratic cones.
Parameters
indexholds the cone index. It is required.
numberOfRowsholds the number of rows. It is required.
numberOfColumnsholds the number of columns. It is required.
coneTypeholds the cone type. For more information consult the enumeration ENUM_CONE_TYPE further up in this file. This argument is required and must be ENUM_CONE_TYPE_rotatedQuadratic.
nameholds the cone name; use null or empty std::string ("") if no cone name.
distortionMatrixIdxholds the index of a distortion matrix. Use -1 if there is none.
normFactorholds a scale factor for the norm. Use 1 if there is none.
firstAxisDirectionholds the index of the first axis direction. The most usual value is 0.
secondAxisDirectionholds the index of the second axis direction. The most usual value is 1.
numberOfOtherIndexesholds the number of other indexes if the cone contains higher-dimensional tensors. This argument is optional and can be omitted. It defaults to 0.
otherIndexesholds the array of other indexes if the cone contains higher-dimensional tensors. This argument is optional and can be omitted. It defaults to null.
Returns
whether the cone was added successfully.

Definition at line 5473 of file OSInstance.cpp.

bool OSInstance::addCone ( int  index,
int  numberOfRows,
int  numberOfColumns,
ENUM_CONE_TYPE  coneType,
std::string  name,
int  distortionMatrixIdx,
double  normFactor,
int  axisDirection,
double  pNorm,
int  numberOfOtherIndexes = 0,
int otherIndexes = NULL 
)

add a cone.

In order to use the add method, the setConeNumber must first be called so that the number of cones is known ahead of time to allocate appropriate memory. If a cone with the given cone index already exists, the old cone will be replaced.

Remarks
This method has different signatures to cater for different types of cones. This signature is used for normed cones.
Parameters
indexholds the cone index. It is required.
numberOfRowsholds the number of rows. It is required.
numberOfColumnsholds the number of columns. It is required.
coneTypeholds the cone type. For more information consult the enumeration ENUM_CONE_TYPE further up in this file. This argument is required and must be ENUM_CONE_TYPE_normed.
nameholds the cone name; use null or empty std::string ("") if no cone name.
distortionMatrixIdxholds the index of a distortion matrix. Use -1 if there is none.
normFactorholds a scale factor for the norm. Use 1 if there is none.
pNormholds the norm descriptor. It must be greater than or equal to 1.
numberOfOtherIndexesholds the number of other indexes if the cone contains higher-dimensional tensors. This argument is optional and can be omitted. It defaults to 0.
otherIndexesholds the array of other indexes if the cone contains higher-dimensional tensors. This argument is optional and can be omitted. It defaults to null.
Returns
whether the cone was added successfully.

Definition at line 5504 of file OSInstance.cpp.

bool OSInstance::addCone ( int  index,
int  numberOfRows,
int  numberOfColumns,
ENUM_CONE_TYPE  coneType,
std::string  name,
int  maxDegree,
int  numberOfUB,
double *  ub,
int  numberOfLB,
double *  lb,
int  numberOfOtherIndexes = 0,
int otherIndexes = NULL 
)

add a cone.

In order to use the add method, the setConeNumber must first be called so that the number of cones is known ahead of time to allocate appropriate memory. If a cone with the given cone index already exists, the old cone will be replaced.

Remarks
This method has different signatures to cater for different types of cones. This signature is used for cones of nonnegative polynomials and similar cones.
Parameters
indexholds the cone index. It is required.
numberOfRowsholds the number of rows. It is required.
numberOfColumnsholds the number of columns. It is required.
coneTypeholds the cone type. For more information consult the enumeration ENUM_CONE_TYPE further up in this file. This argument is required and must be ENUM_CONE_TYPE_nonnegativePolynomials. ENUM_CONE_TYPE_sumOfSquaresPolynomials. ENUM_CONE_TYPE_moment.
nameholds the cone name; use null or empty std::string ("") if no cone name.
maxDegreeholds the maximum degree of the polynomials. Use 1, 2, 3, ..., INF.
numberOfUBholds the number of (box-type) upper bound constraints. Use 0 if there are none.
ubholds the upper bound values. Use null if there are no upper bounds.
numberOfLBholds the number of (box-type) lower bound constraints. Use 0 if there are none.
lbholds the lower bound values. Use null if there are no lower bounds.
numberOfOtherIndexesholds the number of other indexes if the cone contains higher-dimensional tensors. This argument is optional and can be omitted. It defaults to 0.
otherIndexesholds the array of other indexes if the cone contains higher-dimensional tensors. This argument is optional and can be omitted. It defaults to null.
Returns
whether the cone was added successfully.

Definition at line 5533 of file OSInstance.cpp.

std::string OSInstance::printModel ( )

Print the infix representation of the problem.

Returns
a string with the infix representation

Definition at line 5585 of file OSInstance.cpp.

std::string OSInstance::printModel ( int  rowIdx)

Print the infix representation of the row (which could be an an objective function row) indexed by rowIdx.

Parameters
rowIdxis the index of the row we want to express in infix.
Returns
a string with the infix representation

Definition at line 5652 of file OSInstance.cpp.

bool OSInstance::initializeNonLinearStructures ( )

Initialize the data structures for the nonlinear API.

Returns
true if we have initialized the nonlinear data strucutres.

Definition at line 5022 of file OSInstance.cpp.

double OSInstance::calculateFunctionValue ( int  idx,
double *  x,
bool  new_x 
)

Calculate the function value for function (constraint or objective) indexed by idx.

Parameters
idxis the index on the constraint (0, 1, 2, 3, ...) or objective function (-1, -2, -3, ...).
xis a pointer (double array) to the current variable values
new_xis false if any evaluation method was previously called for the current x has been evaluated for the current iterate x use a value of false if not sure
Returns
the function value as a double.

Definition at line 5769 of file OSInstance.cpp.

double * OSInstance::calculateAllConstraintFunctionValues ( double *  x,
double *  objLambda,
double *  conLambda,
bool  new_x,
int  highestOrder 
)

Calculate all of the constraint function values.

Parameters
xis a pointer (double array) to the current variable values
objLambdais the Lagrange multiplier on the objective function
conLambdais pointer (double array) of Lagrange multipliers on the constratins
new_xis false if any evaluation method was previously called for the current x for the current iterate
highestOrderis the highest order of the derivative being calculated
Returns
a double array of constraint function values – the size of the array is equal to getConstraintNumber().

Definition at line 5834 of file OSInstance.cpp.

double * OSInstance::calculateAllConstraintFunctionValues ( double *  x,
bool  new_x 
)

Calculate all of the constraint function values, we are overloading this function and this version of the method will not use any AD and will evaluate function values from the OS Expression Tree.

Parameters
xis a pointer (double array) to the current variable values
new_xis false if any evaluation method was previously called for the current iterate
Returns
a double array of constraint function values – the size of the array is equal to getConstraintNumber().

Definition at line 5850 of file OSInstance.cpp.

double * OSInstance::calculateAllObjectiveFunctionValues ( double *  x,
double *  objLambda,
double *  conLambda,
bool  new_x,
int  highestOrder 
)

Calculate all of the objective function values.

Parameters
xis a pointer (double array) to the current variable values
objLambdais the Lagrange multiplier on the objective function
conLambdais pointer (double array) of Lagrange multipliers on the constratins
new_xis false if any evaluation method was previously called for the current iterate
highestOrderis the highest order of the derivative being calculated
Returns
a double array of objective function values – the size of the array is equal to getObjectiveNumber().

Definition at line 5873 of file OSInstance.cpp.

double * OSInstance::calculateAllObjectiveFunctionValues ( double *  x,
bool  new_x 
)

Calculate all of the objective function values, we are overloading this function and this version of the method will not use any AD and will evaluate function values from the OS Expression Tree.

Parameters
xis a pointer (double array) to the current variable values
new_xis false if any evaluation method was previously called for the current iterate
Returns
a double array of objective function values – the size of the array is equal to getObjectiveNumber().

Definition at line 5889 of file OSInstance.cpp.

SparseJacobianMatrix * OSInstance::calculateAllConstraintFunctionGradients ( double *  x,
double *  objLambda,
double *  conLambda,
bool  new_x,
int  highestOrder 
)

Calculate the gradient of all constraint functions.

Parameters
xis a pointer (double array) to the current variable values
objLambdais the Lagrange multiplier on the objective function
conLambdais pointer (double array) of Lagrange multipliers on the constratins
new_xis false if any evaluation method was previously called for the current iterate
highestOrderis the highest order of the derivative being calculated
Returns
a pointer a SparseJacobianMatrix.

Definition at line 5912 of file OSInstance.cpp.

SparseVector * OSInstance::calculateConstraintFunctionGradient ( double *  x,
double *  objLambda,
double *  conLambda,
int  idx,
bool  new_x,
int  highestOrder 
)

Calculate the gradient of the constraint function indexed by idx.

Parameters
xis a pointer (double array) to the current variable values
objLambdais the Lagrange multiplier on the objective function
conLambdais pointer (double array) of Lagrange multipliers on the constratins idx is the index of the constraint function gradient
new_xis false if any evaluation method was previously called for the current iterate
highestOrderis the highest order of the derivative being calculated
Returns
a pointer to a sparse vector of doubles.

Definition at line 5931 of file OSInstance.cpp.

SparseVector * OSInstance::calculateConstraintFunctionGradient ( double *  x,
int  idx,
bool  new_x 
)

Calculate the gradient of the constraint function indexed by idx this function is overloaded.

Parameters
xis a pointer (double array) to the current variable values idx is the index of the constraint function gradient
new_xis false if any evaluation method was previously called for the current iterate
highestOrderis the highest order of the derivative being calculated
Returns
a pointer to a sparse vector of doubles.

Definition at line 5962 of file OSInstance.cpp.

double ** OSInstance::calculateAllObjectiveFunctionGradients ( double *  x,
double *  objLambda,
double *  conLambda,
bool  new_x,
int  highestOrder 
)

Calculate the gradient of all objective functions.

Parameters
xis a pointer (double array) to the current variable values
objLambdais the Lagrange multiplier on the objective function
conLambdais pointer (double array) of Lagrange multipliers on the constratins
new_xis false if any evaluation method was previously called for the current iterate
highestOrderis the highest order of the derivative being calculated
Returns
an array of pointer to dense objective function gradients.

Definition at line 5991 of file OSInstance.cpp.

double * OSInstance::calculateObjectiveFunctionGradient ( double *  x,
double *  objLambda,
double *  conLambda,
int  objIdx,
bool  new_x,
int  highestOrder 
)

Calculate the gradient of the objective function indexed by objIdx.

Parameters
xis a pointer (double array) to the current variable values
objLambdais the Lagrange multiplier on the objective function
conLambdais pointer (double array) of Lagrange multipliers on the constratins objIdx is the index of the objective function being optimized
new_xis false if any evaluation method was previously called for the current iterate
highestOrderis the highest order of the derivative being calculated
Returns
a pointer to a dense vector of doubles.

Definition at line 6017 of file OSInstance.cpp.

double * OSInstance::calculateObjectiveFunctionGradient ( double *  x,
int  objIdx,
bool  new_x 
)

Calculate the gradient of the objective function indexed by objIdx this function is overloaded.

Parameters
xis a pointer (double array) to the current variable values
objIdxis the index of the objective function being optimized
new_xis false if any evaluation method was previously called for the current iterate
Returns
a pointer to a dense vector of doubles.

Definition at line 6081 of file OSInstance.cpp.

SparseHessianMatrix * OSInstance::calculateLagrangianHessian ( double *  x,
double *  objLambda,
double *  conLambda,
bool  new_x,
int  highestOrder 
)

Calculate the Hessian of the Lagrangian Expression Tree This method will build the CppAD expression tree for only the first iteration Use this method on if the value of x does not affect the operations sequence.

Parameters
xis a pointer (double array) to the current variable values
objLambdais the Lagrange multiplier on the objective function
conLambdais pointer (double array) of Lagrange multipliers on the constratins
new_xis false if any evaluation method was previously called for the current iterate
highestOrderis the highest order of the derivative being calculated
Returns
a pointer a SparseHessianMatrix. Each array member corresponds to one constraint gradient.

Definition at line 6135 of file OSInstance.cpp.

SparseHessianMatrix * OSInstance::calculateHessian ( double *  x,
int  idx,
bool  new_x 
)

Calculate the Hessian of a constraint or objective function.

Parameters
xis a pointer (double array) to the current variable values
new_xis false if any evaluation method was previously called for the current iterate idx is the index of the either a constraint or objective function Hessian
Returns
a pointer a SparseVector. Each array member corresponds to one constraint gradient.

Definition at line 6153 of file OSInstance.cpp.

bool OSInstance::getSparseJacobianFromColumnMajor ( )
Returns
true if successful in generating the constraints gradient.

Definition at line 6197 of file OSInstance.cpp.

bool OSInstance::getSparseJacobianFromRowMajor ( )
Returns
true if successful in generating the constraints gradient.

Definition at line 6376 of file OSInstance.cpp.

ScalarExpressionTree * OSInstance::getLagrangianExpTree ( )
Returns
a pointer to the ExpressionTree for the Lagrangian function of current instance we only take the Lagrangian of the rows with nonlinear terms

Definition at line 6542 of file OSInstance.cpp.

std::map< int, int > OSInstance::getAllNonlinearVariablesIndexMap ( )
Returns
a pointer to a map of the indices of all of the variables that appear in the Lagrangian function

Definition at line 6595 of file OSInstance.cpp.

SparseHessianMatrix * OSInstance::getLagrangianHessianSparsityPattern ( )
Returns
a pointer to a SparseHessianMatrix with the nonzero structure of the Lagrangian Expression Tree

Definition at line 6641 of file OSInstance.cpp.

bool OSInstance::addQTermsToExressionTree ( )
Returns
true if successful in adding the qTerms to the ExpressionTree.
Remarks
due to the typo in the name of the method, this has been flagged as obsolescent and is being replaced by addQTermsToExpressionTree() – see below

Definition at line 5102 of file OSInstance.cpp.

bool OSInstance::addQTermsToExpressionTree ( )

This method adds quadratic terms into the array of expression trees.

There is at most one expression tree per row (see getAllNonlinearExpressionTrees)

Returns
true if successful in adding the qTerms to the ExpressionTree.

Definition at line 5107 of file OSInstance.cpp.

SparseJacobianMatrix * OSInstance::getJacobianSparsityPattern ( )
Returns
pointer to a SparseJacobianMatrix.

Definition at line 5058 of file OSInstance.cpp.

void OSInstance::duplicateExpressionTreesMap ( )

duplicate the map of expression trees.

Definition at line 6710 of file OSInstance.cpp.

bool OSInstance::createOSADFun ( std::vector< double >  vdX)

Create the a CppAD Function object: this is a function where the domain is the set of variables for the problem and the range is the objective function plus constraints.

Parameters
vdXis a vector of doubles holding the current primal variable values the size of x should equal instanceData->variables->numberOfVariables
Returns
if successfully created

Definition at line 7660 of file OSInstance.cpp.

std::vector< double > OSInstance::forwardAD ( int  p,
std::vector< double >  vdX 
)

Perform an AD forward sweep.

Parameters
pis the highest order Taylor coefficient
vdXis a vector of doubles of the current primal variable values the size of vdX m_iNumberOfNonlinearVariables
Returns
a double vector equal to the dimension of the range space the result of the forward p sweep

Definition at line 7717 of file OSInstance.cpp.

std::vector< double > OSInstance::reverseAD ( int  p,
std::vector< double >  vdlambda 
)

Perform an AD reverse sweep.

Parameters
pis the order of the sweep
vdlambdais a vector of doubles of the current dual (lagrange) variable values the size of lambda should equal number of objective functions plus number of constraints
Returns
a double vector equal to the n*p

Definition at line 7742 of file OSInstance.cpp.

int OSInstance::getADSparsityHessian ( )

end revised AD code

Call the AD routine to fill in m_vbLagHessNonz and determine the nonzeros.

Returns
the number of nonzeros in the Hessian

Definition at line 7766 of file OSInstance.cpp.

bool OSInstance::getIterateResults ( double *  x,
double *  objLambda,
double *  conLambda,
bool  new_x,
int  highestOrder 
)

end revised AD code

Get the information for each iteration. Get the functions values, Jacobian and Hessian of the Lagrangian

Parameters
xis a pointer of doubles of primal values for the current iteration
objLambdais is a pointer of doubles of the current dual (Lagrange) multipliers on the objective functions
conLambdais a pointer of doubles of the current dual (Lagrange) multipliers on the constraints
new_xis false if any evaluation method was previously called
highestOrderis the highest order derivative to be calculated
Returns
true if successful

Definition at line 6728 of file OSInstance.cpp.

bool OSInstance::getZeroOrderResults ( double *  x,
double *  objLambda,
double *  conLambda 
)

Calculate function values.

Parameters
xis a pointer of doubles of primal values for the current iteration
objLambdais is a pointer of doubles of the current dual (Lagrange) multipliers on the objective functions
conLambdais a pointer of doubles of the current dual (Lagrange) multipliers on the constraints
Returns
true if successful

Definition at line 6804 of file OSInstance.cpp.

bool OSInstance::getFirstOrderResults ( double *  x,
double *  objLambda,
double *  conLambda 
)

Calculate first derivatives.

Parameters
xis a pointer of doubles of primal values for the current iteration
objLambdais is a pointer of doubles of the current dual (Lagrange) multipliers on the objective functions
conLambdais a pointer of doubles of the current dual (Lagrange) multipliers on the constraints
Returns
true if successful

if the number of columns exceeds the number of rows we will get the Jacobian by row, however, if the number of rows exceeds the number of columns we get the Jacobian by column

Definition at line 6870 of file OSInstance.cpp.

bool OSInstance::getSecondOrderResults ( double *  x,
double *  objLambda,
double *  conLambda 
)

Calculate second derivatives.

Parameters
xis a pointer of doubles of primal values for the current iteration
objLambdais is a pointer of doubles of the current dual (Lagrange) multipliers on the objective functions
conLambdais a pointer of doubles of the current dual (Lagrange) multipliers on the constraints
Returns
true if successful

Definition at line 6994 of file OSInstance.cpp.

bool OSInstance::initForAlgDiff ( )

This should be called by nonlinear solvers using callback functions.

initForAlgDiff will initialize the correct nonlinear structures in preparation for using the algorithmic differentiation routines.

Returns
true if successful

Definition at line 7107 of file OSInstance.cpp.

bool OSInstance::initObjGradients ( )

This should be called by initForAlgDiff()

initObjGradients will initialize the objective function gradients to be equal to the coefficients given in the <coef> section of the OSiL instance

Returns
true if successful

Definition at line 7143 of file OSInstance.cpp.

bool OSInstance::setTimeDomain ( std::string  format)

This sets the format of the time domain ("stages"/"interval"/"none")

end revised AD test code

set methods for matrices object set methods for cones object set methods for timeDomain object

Definition at line 7187 of file OSInstance.cpp.

bool OSInstance::setTimeDomainStages ( int  number,
std::string *  names 
)

This sets the number (and optionally names) of the time stages.

set time domain stages

Definition at line 7237 of file OSInstance.cpp.

bool OSInstance::setTimeDomainStageVariablesOrdered ( int  numberOfStages,
int numberOfVariables,
int startIdx 
)

This sets the variables associated with each time domain stage in temporal order.

set time domain stage variables in temporal order

(I.e., for each stage numberOfVariables gives the number of variables accociated with this stage and startIdx gives the first variable in this stage.)

Definition at line 7323 of file OSInstance.cpp.

bool OSInstance::setTimeDomainStageVariablesUnordered ( int  numberOfStages,
int numberOfVariables,
int **  varIndex 
)

This sets the variables associated with each time domain stage in srbitrary order.

set time domain stage variables in arbitrary order

(I.e., for each stage numberOfVariables gives the number of variables accociated with this stage and varIndex[i] gives the index of each variable in stage[i].)

Definition at line 7365 of file OSInstance.cpp.

bool OSInstance::setTimeDomainStageConstraintsOrdered ( int  numberOfStages,
int numberOfConstraints,
int startIdx 
)

This sets the constraints associated with each time domain stage in temporal order.

set time domain stage constraints in temporal order

(I.e., for each stage numberOfConstraints gives the number of constraints accociated with this stage and startIdx gives the first constraint in this stage.)

Definition at line 7431 of file OSInstance.cpp.

bool OSInstance::setTimeDomainStageConstraintsUnordered ( int  numberOfStages,
int numberOfConstraints,
int **  conIndex 
)

This sets the constraints associated with each time domain stage in srbitrary order.

set time domain stage constraints in arbitrary order

(I.e., for each stage numberOfConstraints gives the number of constraints accociated with this stage and conIndex[i] gives the index of each constraint in stage[i].)

Definition at line 7473 of file OSInstance.cpp.

bool OSInstance::setTimeDomainStageObjectivesOrdered ( int  numberOfStages,
int numberOfObjectives,
int startIdx 
)

This sets the objectives associated with each time domain stage in temporal order.

set time domain stage objectives in temporal order

(I.e., for each stage numberOfObjectives gives the number of objectives accociated with this stage and startIdx gives the first objective in this stage.)

Definition at line 7539 of file OSInstance.cpp.

bool OSInstance::setTimeDomainStageObjectivesUnordered ( int  numberOfStages,
int numberOfObjectives,
int **  varIndex 
)

This sets the objectives associated with each time domain stage in arbitrary order.

set time domain stage objectives in arbitrary order

(I.e., for each stage numberOfObjectives gives the number of objectives accociated with this stage and objIndex[i] gives the index of each objective in stage[i].)

Definition at line 7582 of file OSInstance.cpp.

bool OSInstance::setTimeDomainInterval ( double  start,
double  horizon 
)

This sets the start and end of the time interval.

set time domain interval

Definition at line 7646 of file OSInstance.cpp.

bool OSInstance::processVariables ( )
private

process variables.

Returns
true if the variables are processed.
Exceptions
Exceptionif the elements in variables are logically inconsistent.
bool OSInstance::processObjectives ( )
private

process objectives.

Returns
true if the objectives are processed.
Exceptions
Exceptionif the elements in objectives are logically inconsistent.
bool OSInstance::processConstraints ( )
private

process constraints.

Returns
true if the constraints are processed.
Exceptions
Exceptionif the elements in constraints are logically inconsistent.
bool OSInstance::processLinearConstraintCoefficients ( )
private

process linear constraint coefficients.

Returns
true if the linear constraint coefficients are processed.
Exceptions
Exceptionif the elements in linear constraint coefficients are logically inconsistent.
std::string OSInstance::getInstanceName ( )

Get instance name.

Returns
instance name. Null or empty std::string ("") if there is no instance name.
std::string OSInstance::getInstanceSource ( )

Get instance source.

Returns
instance source. Null or empty std::string ("") if there is no instance source.
std::string OSInstance::getInstanceDescription ( )

Get instance description.

Returns
instance description. Null or empty std::string ("") if there is no instance description.
int OSInstance::getVariableNumber ( )

Get variable number.

Returns
variable number.
std::string* OSInstance::getVariableNames ( )

Get variable names.

Returns
a std::string array of variable names, null if no variable names.
Exceptions
Exceptionif the elements in variables are logically inconsistent.
char* OSInstance::getVariableTypes ( )

Get variable initial values.

Returns
a double array of variable initial values, null if no initial variable values.
Exceptions
Exceptionif the elements in variables are logically inconsistent. – now deprecated Get variable initial std::string values.
Returns
a std::string array of variable initial values, null if no initial variable std::string values.
Exceptions
Exceptionif the elements in variables are logically inconsistent. – now deprecated Get variable types.
  • C for Continuous
  • B for Binary
  • I for Integer
  • S for String
Returns
a char array of variable types.
Exceptions
Exceptionif the elements in variables are logically inconsistent.
int OSInstance::getNumberOfIntegerVariables ( )

getNumberOfIntegerVariables

Returns
an integer which is the number of I variables.
int OSInstance::getNumberOfBinaryVariables ( )

getNumberOfBinaryVariables

Returns
an integer which is the number of B variables.
double* OSInstance::getVariableLowerBounds ( )

Get variable lower bounds.

Returns
a double array of variable lower bounds.
Exceptions
Exceptionif the elements in variables are logically inconsistent.
double* OSInstance::getVariableUpperBounds ( )

Get variable upper bounds.

Returns
a double array of variable upper bounds.
Exceptions
Exceptionif the elements in variables are logically inconsistent.
int OSInstance::getObjectiveNumber ( )

Get objective number.

Returns
objective number.
std::string* OSInstance::getObjectiveNames ( )

Get objective names.

Returns
a std::string array of objective names. Null if no objective names.
Exceptions
Exceptionif the elements in objectives are logically inconsistent.
std::string* OSInstance::getObjectiveMaxOrMins ( )

Get objective maxOrMins.

One maxOrMin for each objective.

Returns
a std::string array of objective maxOrMins ("max" or "min"), null if no objectives.
Exceptions
Exceptionif the elements in objectives are logically inconsistent.
int* OSInstance::getObjectiveCoefficientNumbers ( )

Get objective coefficient number.

One number for each objective.

Returns
an integer array of size of which is equal to number of objectives, each element of the array is the number of nonzero coefficients in that objective function, null if no objectives.
Exceptions
Exceptionif the elements in objectives are logically inconsistent.
double* OSInstance::getObjectiveConstants ( )

Get objective constants.

One constant for each objective.

Returns
a double array of objective constants, null if no objectives.
Exceptions
Exceptionif the elements in objectives are logically inconsistent.
double* OSInstance::getObjectiveWeights ( )

Get objective weights.

One weight for each objective.

Returns
a double array of objective weights, null if no objectives.
Exceptions
Exceptionif the elements in objectives are logically inconsistent.
SparseVector** OSInstance::getObjectiveCoefficients ( )

Get objective coefficients.

One set of objective coefficients for each objective.

See Also
org.optimizationservices.oscommon.datastructure.SparseVector
Returns
an array of objective coefficients, null if objective coefficients. Each member of the array is of type ObjectiveCoefficients. The ObjectiveCoefficients class contains two arrays: variableIndexes is an integer array and values is a double array of coefficient values.
Exceptions
Exceptionif the elements in objectives are logically inconsistent.
double** OSInstance::getDenseObjectiveCoefficients ( )

getDenseObjectiveCoefficients.

Returns
an vector of pointers, each pointer points to a dense vector of ObjectiveCoefficients.
int OSInstance::getConstraintNumber ( )

Get constraint number.

Returns
constraint number.
std::string* OSInstance::getConstraintNames ( )

Get constraint names.

Returns
a std::string array of constraint names, null if no constraint names.
Exceptions
Exceptionif the elements in constraints are logically inconsistent.
double* OSInstance::getConstraintLowerBounds ( )

Get constraint lower bounds.

Returns
a double array of constraint lower bounds, null if no constraints.
Exceptions
Exceptionif the elements in constraints are logically inconsistent.
double* OSInstance::getConstraintUpperBounds ( )

Get constraint upper bounds.

Returns
a double array of constraint upper bounds, null if constraints.
Exceptions
Exceptionif the elements in constraints are logically inconsistent.
char* OSInstance::getConstraintTypes ( )

Get constraint types.

  • R for range constraint lb <= constraint <= ub
  • L for less than constraint -INF <= con <= ub or con <= ub
  • G for greater than constraint lb <= con <= INF or con >= lb
  • E for equal to constraint lb <= con <= ub where lb = ub or con = lb/ub
  • U for unconstrained constraint -INF <= con <= INF
Returns
a char array of constraint types, null if constraints.
Exceptions
Exceptionif the elements in constraints are logically inconsistent.
int OSInstance::getLinearConstraintCoefficientNumber ( )

Get number of specified (usually nonzero) linear constraint coefficient values.

Returns
number of specified (usually nonzero) linear constraint coefficient values.
bool OSInstance::getLinearConstraintCoefficientMajor ( )

Get whether the constraint coefficients is in column major (true) or row major (false).

Returns
whether the constraint coefficients is in column major (true) or row major (false).
Exceptions
Exceptionif the elements in linear constraint coefficients are logically inconsistent.
SparseMatrix* OSInstance::getLinearConstraintCoefficientsInColumnMajor ( )

Get linear constraint coefficients in column major.

Returns
a sparse matrix reprsentation of linear constraint coefficients in column major, null if no linear constraint coefficients.
Exceptions
Exceptionif the elements in linear constraint coefficients are logically inconsistent.
See Also
org.optimizationservices.oscommon.datastructure.SparseMatrix
SparseMatrix* OSInstance::getLinearConstraintCoefficientsInRowMajor ( )

Get linear constraint coefficients in row major.

Returns
a sparse matrix reprsentation of linear constraint coefficients in row major, null if no linear constraint coefficients.
Exceptions
Exceptionif the elements in linear constraint coefficients are logically inconsistent.
See Also
org.optimizationservices.oscommon.datastructure.SparseMatrix
int OSInstance::getNumberOfQuadraticTerms ( )

Get the number of specified (usually nonzero) qTerms in the quadratic coefficients.

Returns
qTerm number.
QuadraticTerms* OSInstance::getQuadraticTerms ( )

Get all the quadratic terms in the instance.

Returns
the QuadraticTerms data structure for all quadratic terms in the instance, null if no quadratic terms. The QuadraticTerms contains four arrays: rowIndexes, varOneIndexes, varTwoIndexes, coefficients.
Exceptions
Exceptionif the elements in quadratic coefficients are logically inconsistent.
See Also
org.optimizationservices.oscommon.datastructure.QuadraticTerms
int* OSInstance::getQuadraticRowIndexes ( )

Get the indexes of rows which have a quadratic term.

Returns
an integer pointer to the row indexes of rows with quadratic terms, objectives functions have index < 0 NULL if there are no quadratic terms.
int OSInstance::getNumberOfQuadraticRowIndexes ( )

Get the number of rows which have a quadratic term.

Returns
an integer which is the number of distinct rows (including obj) with quadratic terms,
int OSInstance::getNumberOfNonlinearExpressions ( )

Get number of nonlinear expressions.

Returns
the number of nonlinear expressions.
OSExpressionTree* OSInstance::getNonlinearExpressionTree ( int  rowIdx)

Get the expression tree for a given row index.

Returns
an expression tree
OSExpressionTree* OSInstance::getNonlinearExpressionTreeMod ( int  rowIdx)

Get the expression tree for a given row index for the modified expression trees (quadratic terms added)

Returns
an expression tree
std::vector<OSnLNode*> OSInstance::getNonlinearExpressionTreeInPostfix ( int  rowIdx)

Get the postfix tokens for a given row index.

Returns
a vector of pointers to OSnLNodes in postfix, if rowIdx does not index a row with a nonlinear term throw an exception
std::vector<OSnLNode*> OSInstance::getNonlinearExpressionTreeModInPostfix ( int  rowIdx)

Get the postfix tokens for a given row index for the modified Expression Tree (quadratic terms added).

Returns
a vector of pointers to OSnLNodes in postfix, if rowIdx does not index a row with a nonlinear term throw an exception
std::vector<OSnLNode*> OSInstance::getNonlinearExpressionTreeInPrefix ( int  rowIdx)

Get the prefix tokens for a given row index.

Returns
a vector of pointers to OSnLNodes in prefix, if rowIdx does not index a row with a nonlinear term throw an exception
std::vector<OSnLNode*> OSInstance::getNonlinearExpressionTreeModInPrefix ( int  rowIdx)

Get the prefix tokens for a given row index for the modified Expression Tree (quadratic terms added).

Returns
a vector of pointers to OSnLNodes in prefix, if rowIdx does not index a row with a nonlinear term throw an exception
int OSInstance::getNumberOfNonlinearObjectives ( )
Returns
the number of Objectives with a nonlinear term
int OSInstance::getNumberOfNonlinearConstraints ( )
Returns
the number of Constraints with a nonlinear term
std::map<int, OSExpressionTree* > OSInstance::getAllNonlinearExpressionTrees ( )
Returns
a map: the key is the row index and the value is the corresponding expression tree
std::map<int, OSExpressionTree* > OSInstance::getAllNonlinearExpressionTreesMod ( )
Returns
a map: the key is the row index and the value is the corresponding expression tree
int* OSInstance::getNonlinearExpressionTreeIndexes ( )

Get all the nonlinear expression tree indexes, i.e.

indexes of rows (objectives or constraints) that contain nonlinear expressions.

Returns
a pointer to an integer array of nonlinear expression tree indexes.
int OSInstance::getNumberOfNonlinearExpressionTreeIndexes ( )

Get the number of unique Nonlinear expression tree indexes.

Returns
the number of unique nonlinear expression tree indexes.
int* OSInstance::getNonlinearExpressionTreeModIndexes ( )

Get all the nonlinear expression tree indexes, i.e.

indexes of rows (objetives or constraints) that contain nonlinear expressions after modifying the expression tree to contain quadratic terms.

Returns
a pointer to an integer array of nonlinear expression tree indexes (including quadratic terms).
int OSInstance::getNumberOfNonlinearExpressionTreeModIndexes ( )

Get the number of unique Nonlinear expression tree indexes after modifying the expression tree to contain quadratic terms.

Returns
the number of unique nonlinear expression tree indexes (including quadratic terms).
std::string OSInstance::getTimeDomainFormat ( )

Get the format of the time domain ("stages"/"interval")

Returns
the format of the time domain.
int OSInstance::getTimeDomainStageNumber ( )

Get the number of stages that make up the time domain.

Returns
the number of time stages.
std::string* OSInstance::getTimeDomainStageNames ( )

Get the names of the stages (NULL or empty string ("") if a stage has not been given a name.

Returns
the names of time stages.
int* OSInstance::getTimeDomainStageNumberOfVariables ( )

Get the number of variables contained in each time stage.

Returns
a vector of size numberOfStages.
int* OSInstance::getTimeDomainStageNumberOfConstraints ( )

Get the number of constraints contained in each time stage.

Returns
a vector of size numberOfStages.
int* OSInstance::getTimeDomainStageNumberOfObjectives ( )

Get the number of objectives contained in each time stage.

Returns
a vector of size numberOfStages.
int** OSInstance::getTimeDomainStageVarList ( )

Get the list of variables in each stage.

Returns
one array of integers for each stage.
int** OSInstance::getTimeDomainStageConList ( )

Get the list of constraints in each stage.

Returns
one array of integers for each stage.
int** OSInstance::getTimeDomainStageObjList ( )

Get the list of objectives in each stage.

Returns
one array of integers for each stage.
double OSInstance::getTimeDomainIntervalStart ( )

Get the start for the time domain interval.

Returns
start end of the time interval.
double OSInstance::getTimeDomainIntervalHorizon ( )

Get the horizon for the time domain interval.

Returns
the end of the time interval.
bool OSInstance::setInstanceSource ( std::string  source)

set the instance source.

Parameters
sourceholds the instance source.
Returns
whether the instance source is set successfully.
bool OSInstance::setInstanceDescription ( std::string  description)

set the instance description.

Parameters
descriptionholds the instance description.
Returns
whether the instance description is set successfully.
bool OSInstance::setInstanceName ( std::string  name)

set the instance name.

Parameters
nameholds the instance name.
Returns
whether the instance name is set successfully.
bool OSInstance::setVariableNumber ( int  number)

set the variable number.

Parameters
numberholds the variable number.
Returns
whether the variable number is set successfully.
bool OSInstance::addVariable ( int  index,
std::string  name,
double  lowerBound,
double  upperBound,
char  type 
)

add a variable.

In order to use the add method, the setVariableNumber must first be called so that the variable number is known ahead of time to assign appropriate memory. If a variable with the given variable index already exists, the old variable will be replaced.

Parameters
indexholds the variable index. It is required.
nameholds the variable name; use null or empty std::string ("") if no variable name.
lowerBoundholds the variable lower bound; use Double.NEGATIVE_INFINITY if no lower bound.
upperBoundholds the variable upper bound; use Double.POSITIVE_INFINITY if no upper bound.
typeholds the variable type character, B for Binary, I for Integer, S for String, C or any other char for Continuous)
initholds the double variable initial value; use Double.NaN if no initial value – deprecated
initStringholds the std::string variable initial value; use null or empty std::string ("") if no initial std::string value – deprecated
Returns
whether the variable is added successfully.
bool OSInstance::setVariables ( int  number,
std::string *  names,
double *  lowerBounds,
double *  upperBounds,
char *  types 
)

set all the variable related elements.

All the previous variable-related elements will be deleted.

Parameters
numberholds the number of variables. It is required.
namesholds a std::string array of variable names; use null if no variable names.
lowerBoundsholds a double array of variable lower bounds; use null if all lower bounds are 0; use Double.NEGATIVE_INFINITY if no lower bound for a specific variable in the array.
upperBoundsholds a double array of variable upper bounds; use null if no upper bounds; use Double.POSITIVE_INFINITY if no upper bound for a specific variable in the array.
typesholds a char array of variable types; use null if all variables are continuous; for a specfic variable in the array use B for Binary, I for Integer, S for String, C or any other char for Continuous,)
initsholds a double array of varible initial values; use null if no initial values. – deprecated
initsStringholds a std::string array of varible initial values; use null if no initial std::string values. – deprecated
Returns
whether the variables are set successfully.
bool OSInstance::setObjectiveNumber ( int  number)

set the objective number.

Parameters
numberholds the objective number.
Returns
whether the objective number is set successfully.
bool OSInstance::addObjective ( int  index,
std::string  name,
std::string  maxOrMin,
double  constant,
double  weight,
SparseVector objectiveCoefficients 
)

add an objective.

In order to use the add method, the setObjectiveNumber must first be called so that the objective number is known ahead of time to assign appropriate memory. If a objective with the given objective index already exists, the old objective will be replaced. Objective index will start from -1, -2, -3, ... down, with -1 corresponding to the first objective.

Parameters
indexholds the objective index. Remember the first objective index is -1, second -2, ...
nameholds the objective name; use null or empty std::string ("") if no objective name.
maxOrMinholds the objective sense or direction; it can only take two values: "max" or "min".
constantholds the objective constant; use 0.0 if no objective constant.
weightholds the objective weight; use 1.0 if no objective weight.
objectiveCoefficientsholds the objective coefficients (null if no objective coefficients) in a sparse representation that holds two arrays: index array and a value array.
Returns
whether the objective is added successfully.
bool OSInstance::setObjectives ( int  number,
std::string *  names,
std::string *  maxOrMins,
double *  constants,
double *  weights,
SparseVector **  objectitiveCoefficients 
)

set all the objectives related elements.

All the previous objective-related elements will be deleted.

Parameters
numberholds the number of objectives. It is required.
namesholds a std::string array of objective names; use null if no objective names.
maxOrMinsholds a std::string array of objective objective senses or directions: "max" or "min"; use null if all objectives are "min".
constantsholds a double array of objective constants; use null if all objective constants are 0.0.
weightsholds a double array of objective weights; use null if all objective weights are 1.0.
objectitiveCoefficientsholds an array of objective coefficients, (null if no objective have any coefficeints) For each objective, the coefficients are stored in a sparse representation that holds two arrays: index array and a value array. If for a specific objective, there are no objecitve coefficients, use null for the corresponding array member.
Returns
whether the objectives are set successfully.
bool OSInstance::setConstraintNumber ( int  number)

set the constraint number.

Parameters
numberholds the constraint number.
Returns
whether the constraint number is set successfully.
bool OSInstance::addConstraint ( int  index,
std::string  name,
double  lowerBound,
double  upperBound,
double  constant 
)

add a constraint.

In order to use the add method, the setConstraintNumber must first be called so that the constraint number is known ahead of time to assign appropriate memory. If a constraint with the given constraint index already exists, the old constraint will be replaced.

Parameters
indexholds the constraint index. It is required.
nameholds the constraint name; use null or empty std::string ("") if no constraint name.
lowerBoundholds the constraint lower bound; use Double.NEGATIVE_INFINITY if no lower bound.
upperBoundholds the constraint upper bound; use Double.POSITIVE_INFINITY if no upper bound.
Returns
whether the constraint is added successfully.
bool OSInstance::setConstraints ( int  number,
std::string *  names,
double *  lowerBounds,
double *  upperBounds,
double *  constants 
)

set all the constraint related elements.

All the previous constraint-related elements will be deleted.

Parameters
numberholds the number of constraints. It is required.
namesholds a std::string array of constraint names; use null if no constraint names.
lowerBoundsholds a double array of constraint lower bounds; use null if no lower bounds; use Double.NEGATIVE_INFINITY if no lower bound for a specific constraint in the array.
upperBoundsholds a double array of constraint upper bounds; use null if no upper bounds; use Double.POSITIVE_INFINITY if no upper bound for a specific constraint in the array.
Returns
whether the constraints are set successfully.
bool OSInstance::setLinearConstraintCoefficients ( int  numberOfValues,
bool  isColumnMajor,
double *  values,
int  valuesBegin,
int  valuesEnd,
int indexes,
int  indexesBegin,
int  indexesEnd,
int starts,
int  startsBegin,
int  startsEnd 
)

set linear constraint coefficients

Parameters
numberOfValuesholds the number of specified coefficient values (usually nonzero) in the coefficient matrix.
isColumnMajorholds whether the coefficient matrix is stored in column major (true) or row major (false).
valuesholds a double array coefficient values in the matrix.
valuesBeginholds the begin index of the values array to copy from (usually 0).
valuesEndholds the end index of the values array to copy till (usually values.lenght - 1).
indexesholds an integer array column/row indexes for each value in the values array.
indexesBeginholds the begin index of the indexes array to copy from (usually 0).
indexesEndholds the end index of the indexes array to copy till (usually indexes.lenght - 1).
startsholds an integer array start indexes in the matrix; the first value of starts should always be 0.
startsBeginholds the begin index of the starts array to copy from (usually 0).
startsEndholds the end index of the starts array to copy till (usually starts.lenght - 1).
Returns
whether the linear constraint coefficients are set successfully.
bool OSInstance::setQuadraticTerms ( int  number,
int rowIndexes,
int varOneIndexes,
int varTwoIndexes,
double *  coefficients,
int  begin,
int  end 
)

set quadratic terms

Parameters
numberholds the number of quadratic terms.
rowIndexesholds an integer array of row indexes of all the quadratic terms. A negative integer corresponds to an objective row, e.g. -1 for 1st objective and -2 for 2nd.
varOneIndexesholds an integer array of the first varialbe indexes of all the quadratic terms.
varTwoIndexesholds an integer array of the second varialbe indexes of all the quadratic terms.
coefficientsholds a double array all the quadratic term coefficients.
beginholds the begin index of all the arrays to copy from (usually = 0).
endholds the end index of all the arrays to copy till (usually = array length -1).
Returns
whether the quadratic terms are set successfully.
bool OSInstance::setQuadraticTermsInNonlinearExpressions ( int  number,
int rowIndexes,
int varOneIndexes,
int varTwoIndexes,
double *  coefficients 
)

set quadratic terms in nonlinearExpressions

Parameters
numberholds the number of quadratic terms.
rowIndexesholds an integer array of row indexes of all the quadratic terms. A negative integer corresponds to an objective row, e.g. -1 for 1st objective and -2 for 2nd.
varOneIndexesholds an integer array of the first varialbe indexes of all the quadratic terms.
varTwoIndexesholds an integer array of the second varialbe indexes of all the quadratic terms.
coefficientsholds a double array all the quadratic term coefficients.
Returns
whether the quadratic terms are set successfully.
bool OSInstance::initializeNonLinearStructures ( )

Initialize the data structures for the nonlinear API.

Returns
true if we have initialized the nonlinear data strucutres.
double OSInstance::calculateFunctionValue ( int  idx,
double *  x,
bool  new_x 
)

Calculate the function value for function (constraint or objective) indexed by idx.

Parameters
idxis the index on the constraint (0, 1, 2, 3, ...) or objective function (-1, -2, -3, ...).
xis a pointer (double array) to the current variable values
new_xis false if any evaluation method was previously called for the current x has been evaluated for the current iterate x use a value of false if not sure
Returns
the function value as a double.
double* OSInstance::calculateAllConstraintFunctionValues ( double *  x,
double *  objLambda,
double *  conLambda,
bool  new_x,
int  highestOrder 
)

Calculate all of the constraint function values.

Parameters
xis a pointer (double array) to the current variable values
objLambdais the Lagrange multiplier on the objective function
conLambdais pointer (double array) of Lagrange multipliers on the constratins
new_xis false if any evaluation method was previously called for the current x for the current iterate
highestOrderis the highest order of the derivative being calculated
Returns
a double array of constraint function values – the size of the array is equal to getConstraintNumber().
double* OSInstance::calculateAllConstraintFunctionValues ( double *  x,
bool  new_x 
)

Calculate all of the constraint function values, we are overloading this function and this version of the method will not use any AD and will evaluate function values from the OS Expression Tree.

Parameters
xis a pointer (double array) to the current variable values
new_xis false if any evaluation method was previously called for the current iterate
Returns
a double array of constraint function values – the size of the array is equal to getConstraintNumber().
double* OSInstance::calculateAllObjectiveFunctionValues ( double *  x,
double *  objLambda,
double *  conLambda,
bool  new_x,
int  highestOrder 
)

Calculate all of the objective function values.

Parameters
xis a pointer (double array) to the current variable values
objLambdais the Lagrange multiplier on the objective function
conLambdais pointer (double array) of Lagrange multipliers on the constratins
new_xis false if any evaluation method was previously called for the current iterate
highestOrderis the highest order of the derivative being calculated
Returns
a double array of objective function values – the size of the array is equal to getObjectiveNumber().
double* OSInstance::calculateAllObjectiveFunctionValues ( double *  x,
bool  new_x 
)

Calculate all of the objective function values, we are overloading this function and this version of the method will not use any AD and will evaluate function values from the OS Expression Tree.

Parameters
xis a pointer (double array) to the current variable values
new_xis false if any evaluation method was previously called for the current iterate
Returns
a double array of objective function values – the size of the array is equal to getObjectiveNumber().
SparseJacobianMatrix* OSInstance::calculateAllConstraintFunctionGradients ( double *  x,
double *  objLambda,
double *  conLambda,
bool  new_x,
int  highestOrder 
)

Calculate the gradient of all constraint functions.

Parameters
xis a pointer (double array) to the current variable values
objLambdais the Lagrange multiplier on the objective function
conLambdais pointer (double array) of Lagrange multipliers on the constratins
new_xis false if any evaluation method was previously called for the current iterate
highestOrderis the highest order of the derivative being calculated
Returns
a pointer a SparseJacobianMatrix.
SparseVector* OSInstance::calculateConstraintFunctionGradient ( double *  x,
double *  objLambda,
double *  conLambda,
int  idx,
bool  new_x,
int  highestOrder 
)

Calculate the gradient of the constraint function indexed by idx.

Parameters
xis a pointer (double array) to the current variable values
objLambdais the Lagrange multiplier on the objective function
conLambdais pointer (double array) of Lagrange multipliers on the constratins idx is the index of the constraint function gradient
new_xis false if any evaluation method was previously called for the current iterate
highestOrderis the highest order of the derivative being calculated
Returns
a pointer to a sparse vector of doubles.
SparseVector* OSInstance::calculateConstraintFunctionGradient ( double *  x,
int  idx,
bool  new_x 
)

Calculate the gradient of the constraint function indexed by idx this function is overloaded.

Parameters
xis a pointer (double array) to the current variable values idx is the index of the constraint function gradient
new_xis false if any evaluation method was previously called for the current iterate
highestOrderis the highest order of the derivative being calculated
Returns
a pointer to a sparse vector of doubles.
double** OSInstance::calculateAllObjectiveFunctionGradients ( double *  x,
double *  objLambda,
double *  conLambda,
bool  new_x,
int  highestOrder 
)

Calculate the gradient of all objective functions.

Parameters
xis a pointer (double array) to the current variable values
objLambdais the Lagrange multiplier on the objective function
conLambdais pointer (double array) of Lagrange multipliers on the constratins
new_xis false if any evaluation method was previously called for the current iterate
highestOrderis the highest order of the derivative being calculated
Returns
an array of pointer to dense objective function gradients.
double* OSInstance::calculateObjectiveFunctionGradient ( double *  x,
double *  objLambda,
double *  conLambda,
int  objIdx,
bool  new_x,
int  highestOrder 
)

Calculate the gradient of the objective function indexed by objIdx.

Parameters
xis a pointer (double array) to the current variable values
objLambdais the Lagrange multiplier on the objective function
conLambdais pointer (double array) of Lagrange multipliers on the constratins objIdx is the index of the objective function being optimized
new_xis false if any evaluation method was previously called for the current iterate
highestOrderis the highest order of the derivative being calculated
Returns
a pointer to a dense vector of doubles.
double* OSInstance::calculateObjectiveFunctionGradient ( double *  x,
int  objIdx,
bool  new_x 
)

Calculate the gradient of the objective function indexed by objIdx this function is overloaded.

Parameters
xis a pointer (double array) to the current variable values
objIdxis the index of the objective function being optimized
new_xis false if any evaluation method was previously called for the current iterate
Returns
a pointer to a dense vector of doubles.
SparseHessianMatrix* OSInstance::calculateLagrangianHessian ( double *  x,
double *  objLambda,
double *  conLambda,
bool  new_x,
int  highestOrder 
)

Calculate the Hessian of the Lagrangian Expression Tree This method will build the CppAD expression tree for only the first iteration Use this method on if the value of x does not affect the operations sequence.

Parameters
xis a pointer (double array) to the current variable values
objLambdais the Lagrange multiplier on the objective function
conLambdais pointer (double array) of Lagrange multipliers on the constratins
new_xis false if any evaluation method was previously called for the current iterate
highestOrderis the highest order of the derivative being calculated
Returns
a pointer a SparseHessianMatrix. Each array member corresponds to one constraint gradient.
SparseHessianMatrix* OSInstance::calculateHessian ( double *  x,
int  idx,
bool  new_x 
)

Calculate the Hessian of a constraint or objective function.

Parameters
xis a pointer (double array) to the current variable values
new_xis false if any evaluation method was previously called for the current iterate idx is the index of the either a constraint or objective function Hessian
Returns
a pointer a SparseVector. Each array member corresponds to one constraint gradient.
bool OSInstance::getSparseJacobianFromColumnMajor ( )
Returns
true if successful in generating the constraints gradient.
bool OSInstance::getSparseJacobianFromRowMajor ( )
Returns
true if successful in generating the constraints gradient.
OSExpressionTree* OSInstance::getLagrangianExpTree ( )
Returns
a pointer to the ExpressionTree for the Lagrangian function of current instance we only take the Lagrangian of the rows with nonlinear terms
std::map<int, int> OSInstance::getAllNonlinearVariablesIndexMap ( )
Returns
a pointer to a map of the indices of all of the variables that appear in the Lagrangian function
SparseHessianMatrix* OSInstance::getLagrangianHessianSparsityPattern ( )
Returns
a pointer to a SparseHessianMatrix with the nonzero structure of the Lagrangian Expression Tree
bool OSInstance::addQTermsToExressionTree ( )
Returns
true if successful in adding the qTerms to the ExpressionTree.
SparseJacobianMatrix* OSInstance::getJacobianSparsityPattern ( )
Returns
pointer to a SparseJacobianMatrix.
void OSInstance::duplicateExpressionTreesMap ( )

duplicate the map of expression trees.

bool OSInstance::createOSADFun ( std::vector< double >  vdX)

Create the a CppAD Function object: this is a function where the domain is the set of variables for the problem and the range is the objective function plus constraints.

Parameters
vdXis a vector of doubles holding the current primal variable values the size of x should equal instanceData->variables->numberOfVariables
Returns
if successfully created
std::vector<double> OSInstance::forwardAD ( int  p,
std::vector< double >  vdX 
)

Perform an AD forward sweep.

Parameters
pis the highest order Taylor coefficient
vdXis a vector of doubles of the current primal variable values the size of vdX m_iNumberOfNonlinearVariables
Returns
a double vector equal to the dimension of the range space the result of the forward p sweep
std::vector<double> OSInstance::reverseAD ( int  p,
std::vector< double >  vdlambda 
)

Perform an AD reverse sweep.

Parameters
pis the order of the sweep
vdlambdais a vector of doubles of the current dual (lagrange) variable values the size of lambda should equal number of objective functions plus number of constraints
Returns
a double vector equal to the n*p
int OSInstance::getADSparsityHessian ( )

end revised AD code

Call the AD routine to fill in m_vbLagHessNonz and determine the nonzeros.

Returns
the number of nonzeros in the Hessian
bool OSInstance::getIterateResults ( double *  x,
double *  objLambda,
double *  conLambda,
bool  new_x,
int  highestOrder 
)

end revised AD code

Get the information for each iteration. Get the functions values, Jacobian and Hessian of the Lagrangian

Parameters
xis a pointer of doubles of primal values for the current iteration
objLambdais is a pointer of doubles of the current dual (Lagrange) multipliers on the objective functions
conLambdais a pointer of doubles of the current dual (Lagrange) multipliers on the constraints
new_xis false if any evaluation method was previously called
highestOrderis the highest order derivative to be calculated
Returns
true if successful
bool OSInstance::getZeroOrderResults ( double *  x,
double *  objLambda,
double *  conLambda 
)

Calculate function values.

Parameters
xis a pointer of doubles of primal values for the current iteration
objLambdais is a pointer of doubles of the current dual (Lagrange) multipliers on the objective functions
conLambdais a pointer of doubles of the current dual (Lagrange) multipliers on the constraints
Returns
true if successful
bool OSInstance::getFirstOrderResults ( double *  x,
double *  objLambda,
double *  conLambda 
)

Calculate first derivatives.

Parameters
xis a pointer of doubles of primal values for the current iteration
objLambdais is a pointer of doubles of the current dual (Lagrange) multipliers on the objective functions
conLambdais a pointer of doubles of the current dual (Lagrange) multipliers on the constraints
Returns
true if successful
bool OSInstance::getSecondOrderResults ( double *  x,
double *  objLambda,
double *  conLambda 
)

Calculate second derivatives.

Parameters
xis a pointer of doubles of primal values for the current iteration
objLambdais is a pointer of doubles of the current dual (Lagrange) multipliers on the objective functions
conLambdais a pointer of doubles of the current dual (Lagrange) multipliers on the constraints
Returns
true if successful
bool OSInstance::initForAlgDiff ( )

This should be called by nonlinear solvers using callback functions.

initForAlgDiff will initialize the correct nonlinear structures in preparation for using the algorithmic differentiation routines.

Returns
true if successful
bool OSInstance::initObjGradients ( )

This should be called by initForAlgDiff()

initObjGradients will initialize the objective function gradients to be equal to the coefficients given in the <coef> section of the OSiL instance

Returns
true if successful
bool OSInstance::setTimeDomain ( std::string  format)

This sets the format of the time domain ("stages"/"interval"/"none")

bool OSInstance::setTimeDomainStages ( int  number,
std::string *  names 
)

This sets the number (and optionally names) of the time stages.

bool OSInstance::setTimeDomainStageVariablesOrdered ( int  numberOfStages,
int numberOfVariables,
int startIdx 
)

This sets the variables associated with each time domain stage in temporal order.

(I.e., for each stage numberOfVariables gives the number of variables accociated with this stage and startIdx gives the first variable in this stage.)

bool OSInstance::setTimeDomainStageVariablesUnordered ( int  numberOfStages,
int numberOfVariables,
int **  varIndex 
)

This sets the variables associated with each time domain stage in srbitrary order.

(I.e., for each stage numberOfVariables gives the number of variables accociated with this stage and varIndex[i] gives the index of each variable in stage[i].)

bool OSInstance::setTimeDomainStageConstraintsOrdered ( int  numberOfStages,
int numberOfConstraints,
int startIdx 
)

This sets the constraints associated with each time domain stage in temporal order.

(I.e., for each stage numberOfConstraints gives the number of constraints accociated with this stage and startIdx gives the first constraint in this stage.)

bool OSInstance::setTimeDomainStageConstraintsUnordered ( int  numberOfStages,
int numberOfConstraints,
int **  conIndex 
)

This sets the constraints associated with each time domain stage in srbitrary order.

(I.e., for each stage numberOfConstraints gives the number of constraints accociated with this stage and conIndex[i] gives the index of each constraint in stage[i].)

bool OSInstance::setTimeDomainStageObjectivesOrdered ( int  numberOfStages,
int numberOfObjectives,
int startIdx 
)

This sets the objectives associated with each time domain stage in temporal order.

(I.e., for each stage numberOfObjectives gives the number of objectives accociated with this stage and startIdx gives the first objective in this stage.)

bool OSInstance::setTimeDomainStageObjectivesUnordered ( int  numberOfStages,
int numberOfObjectives,
int **  varIndex 
)

This sets the objectives associated with each time domain stage in arbitrary order.

(I.e., for each stage numberOfObjectives gives the number of objectives accociated with this stage and objIndex[i] gives the index of each objective in stage[i].)

bool OSInstance::setTimeDomainInterval ( double  start,
double  horizon 
)

This sets the start and end of the time interval.

Member Data Documentation

GeneralFileHeader* OSInstance::instanceHeader

the instanceHeader is implemented as a general file header object to allow sharing of classes between schemas

Definition at line 2275 of file OSInstance.h.

InstanceData * OSInstance::instanceData

A pointer to an InstanceData object.

Definition at line 2278 of file OSInstance.h.

bool OSInstance::bVariablesModified

bVariablesModified is true if the variables data has been modified.

Definition at line 2288 of file OSInstance.h.

bool OSInstance::bObjectivesModified

bObjectivesModified is true if the objective function data has been modified.

Definition at line 2293 of file OSInstance.h.

bool OSInstance::bConstraintsModified

bConstraintsModified is true if the constraints data has been modified.

Definition at line 2298 of file OSInstance.h.

bool OSInstance::bAMatrixModified

bAMatrixModified is true if the A matrix data has been modified.

Definition at line 2303 of file OSInstance.h.

std::string OSInstance::m_sInstanceName
private

-—— data items for InstanceHeader -——

m_sInstanceName holds the instance name.

Definition at line 2310 of file OSInstance.h.

std::string OSInstance::m_sInstanceSource
private

m_sInstanceSource holds the instance source.

Definition at line 2314 of file OSInstance.h.

std::string OSInstance::m_sInstanceDescription
private

m_sInstanceDescription holds the instance description.

Definition at line 2318 of file OSInstance.h.

std::string OSInstance::m_sInstanceCreator
private

m_sInstanceSource holds the instance source.

Definition at line 2322 of file OSInstance.h.

std::string OSInstance::m_sInstanceLicence
private

m_sInstanceDescription holds the instance fileCreator info.

Definition at line 2326 of file OSInstance.h.

bool OSInstance::m_bProcessVariables
private

-—— data items for Variables -——

m_bProcessVariables holds whether the variables are processed.

Definition at line 2333 of file OSInstance.h.

int OSInstance::m_iVariableNumber
private

m_iVariableNumber holds the variable number.

Definition at line 2338 of file OSInstance.h.

int OSInstance::m_iNumberOfIntegerVariables
private

m_iNumberOfIntegerVariables holds the number of integer variables.

Definition at line 2343 of file OSInstance.h.

int OSInstance::m_iNumberOfBinaryVariables
private

m_iNumberOfBinaryVariables holds the number of binary variables.

Definition at line 2348 of file OSInstance.h.

int OSInstance::m_iNumberOfSemiContinuousVariables
private

m_iNumberOfSemiContinuousVariables holds the number of semi-continuous variables.

Definition at line 2353 of file OSInstance.h.

int OSInstance::m_iNumberOfSemiIntegerVariables
private

m_iNumberOfSemiIntegerVariables holds the number of semi-integer variables.

Definition at line 2358 of file OSInstance.h.

int OSInstance::m_iNumberOfStringVariables
private

m_iNumberOfStringVariables holds the number of string-valued variables.

Definition at line 2363 of file OSInstance.h.

std::string * OSInstance::m_msVariableNames
private

m_msVariableNames holds an array of variable names.

Definition at line 2368 of file OSInstance.h.

char * OSInstance::m_mcVariableTypes
private

m_mcVariableTypes holds a char array of variable types (default = 'C').

m_mdVariableInitialValues holds a double array of the initial variable values.

(C for Continuous; B for Binary; I for Integer; S for String)

– now deprecated m_msVariableInitialStringValues holds a std::string array of the initial variable values. – now deprecated m_mcVariableTypes holds a char array of variable types (default = 'C'). (C for Continuous; B for Binary; I for Integer; S for String)

Definition at line 2374 of file OSInstance.h.

double * OSInstance::m_mdVariableLowerBounds
private

m_mdVariableLowerBounds holds a double array of variable lower bounds (default = 0.0).

Definition at line 2379 of file OSInstance.h.

double * OSInstance::m_mdVariableUpperBounds
private

m_mdVariableUpperBounds holds a double array of variable upper bounds (default = INF).

Definition at line 2384 of file OSInstance.h.

bool OSInstance::m_bProcessObjectives
private

-—— data items for Objectives -——

m_bProcessObjectives holds whether the objectives are processed.

Definition at line 2391 of file OSInstance.h.

int OSInstance::m_iObjectiveNumber
private

m_iObjectiveNumber is the number of objective functions.

Definition at line 2396 of file OSInstance.h.

int OSInstance::m_iObjectiveNumberNonlinear
private

m_iObjectiveNumber is the number of objective functions with a nonlinear term.

Definition at line 2401 of file OSInstance.h.

std::string * OSInstance::m_msObjectiveNames
private

m_msObjectiveNames holds an array of objective names.

Definition at line 2406 of file OSInstance.h.

std::string * OSInstance::m_msMaxOrMins
private

m_msMaxOrMins holds a std::string array of objective maxOrMins ("max" or "min").

Definition at line 2411 of file OSInstance.h.

int * OSInstance::m_miNumberOfObjCoef
private

m_miNumberOfObjCoef holds an integer array of number of objective coefficients (default = 0).

m_miNumberOfObjCoef holds an integer array of number of objective coefficients (default = 0.0).

Definition at line 2416 of file OSInstance.h.

double * OSInstance::m_mdObjectiveConstants
private

m_mdObjectiveConstants holds an array of objective constants (default = 0.0).

Definition at line 2421 of file OSInstance.h.

double * OSInstance::m_mdObjectiveWeights
private

m_mdObjectiveWeights holds an array of objective weights (default = 1.0).

Definition at line 2426 of file OSInstance.h.

SparseVector ** OSInstance::m_mObjectiveCoefficients
private

m_mObjectiveCoefficients holds an array of objective coefficients, one set of objective coefficients for each objective.

Definition at line 2432 of file OSInstance.h.

bool OSInstance::m_bGetDenseObjectives
private

m_bGetDenseObjectives holds whether the dense objective functions are processed.

Definition at line 2437 of file OSInstance.h.

double ** OSInstance::m_mmdDenseObjectiveCoefficients
private

m_mmdDenseObjectiveCoefficients holds an array of pointers, each pointer points to a vector of dense objective function coefficients

Definition at line 2443 of file OSInstance.h.

bool OSInstance::m_bProcessConstraints
private

-—— data items for Constraints -——

m_bProcessConstraints holds whether the constraints are processed.

Definition at line 2450 of file OSInstance.h.

int OSInstance::m_iConstraintNumber
private

m_iConstraintNumber is the number of constraints.

Definition at line 2455 of file OSInstance.h.

int OSInstance::m_iConstraintNumberNonlinear
private

m_iConstraintNumberNonlinear is the number of constraints that have a nonlinear term.

Definition at line 2460 of file OSInstance.h.

std::string * OSInstance::m_msConstraintNames
private

m_msConstraintNames holds an array of constraint names.

Definition at line 2465 of file OSInstance.h.

double * OSInstance::m_mdConstraintLowerBounds
private

m_mdConstraintLowerBounds holds an array of constraint lower bounds (default = -INF).

Definition at line 2470 of file OSInstance.h.

double * OSInstance::m_mdConstraintUpperBounds
private

m_mdConstraintUpperBounds holds an array of constraint upper bounds (default = INF).

Definition at line 2475 of file OSInstance.h.

double * OSInstance::m_mdConstraintConstants
private

m_mdConstraintConstants holds an array of constraint constants (default = 0.0).

Definition at line 2481 of file OSInstance.h.

char * OSInstance::m_mcConstraintTypes
private

m_mcConstraintTypes holds a char array of constraint types (R for range; L for <=; G for >=; E for =; U for unconstrained)

Definition at line 2487 of file OSInstance.h.

bool OSInstance::m_bProcessLinearConstraintCoefficients
private

-—— data items for linear constraint coefficients -——

m_bProcessLinearConstraintCoefficients holds whether the linear constraint coefficients are processed.

m_bProcessLinearConstraintCoefficients holds whether the linear constraint coefficients have been processed.

Definition at line 2495 of file OSInstance.h.

int OSInstance::m_iLinearConstraintCoefficientNumber
private

m_iLinearConstraintCoefficientNumber holds the number of specified (usually nonzero) linear constraint coefficient values.

Definition at line 2501 of file OSInstance.h.

bool OSInstance::m_bColumnMajor
private

m_bColumnMajor holds whether the linear constraint coefficients are stored in column major (if m_bColumnMajor = true) or row major.

m_bColumnMajor holds whether the linear constraint coefficients are stored in column major.

Definition at line 2507 of file OSInstance.h.

SparseMatrix * OSInstance::m_linearConstraintCoefficientsInColumnMajor
private

m_linearConstraintCoefficientsInColumnMajor holds the standard three-array data structure for linear constraint coefficients (starts, indexes and values) in column major.

m_linearConstraintCoefficientsInColumnMajor holds the standard 3 array data structure for linear constraint coefficients (starts, indexes and values) in column major.

Definition at line 2514 of file OSInstance.h.

SparseMatrix * OSInstance::m_linearConstraintCoefficientsInRowMajor
private

m_linearConstraintCoefficientsInRowMajor holds the standard three-array data structure for linear constraint coefficients (starts, indexes and values) in row major.

m_linearConstraintCoefficientsInRowMajor holds the standard 3 array data structure for linear constraint coefficients (starts, indexes and values) in row major.

Definition at line 2521 of file OSInstance.h.

int OSInstance::m_iNumberOfQuadraticRowIndexes
private

-—— data items for quadratic coefficients -——

m_iNumberOfQuadraticRowIndexes holds the number of distinct rows and objectives with quadratic terms.

Definition at line 2528 of file OSInstance.h.

bool OSInstance::m_bQuadraticRowIndexesProcessed
private

m_bQuadraticRowIndexesProcessed is true if getQuadraticRowIndexes() has been called.

Definition at line 2533 of file OSInstance.h.

int * OSInstance::m_miQuadRowIndexes
private

m_miQuadRowIndexes is an integer pointer to the distinct row indexes with a quadratic term.

m_miQuadRowIndexes is an integer pointer to the distinct rows indexes with a quadratic term.

Definition at line 2538 of file OSInstance.h.

bool OSInstance::m_bProcessQuadraticTerms
private

m_bProcessQuadraticTerms holds whether the quadratic terms are processed.

Definition at line 2543 of file OSInstance.h.

int OSInstance::m_iQuadraticTermNumber
private

m_iQuadraticTermNumber holds the number of specified (usually nonzero) qTerms in the quadratic coefficients.

Definition at line 2549 of file OSInstance.h.

QuadraticTerms * OSInstance::m_quadraticTerms
private

m_quadraticTerms holds the data structure for all the quadratic terms in the instance.

m_quadraticTerms the data structure for all the quadratic terms in the instance.

` (rowIdx, varOneIdx, varTwoIdx, coef)

Definition at line 2555 of file OSInstance.h.

bool OSInstance::m_bQTermsAdded
private

m_bQTermsAdded is true if we added the quadratic terms to the expression tree

m_bQTermsAdded is true if we add the quadratic terms to the expression tree

Definition at line 2559 of file OSInstance.h.

int OSInstance::m_iNumberOfNonlinearExpressionTreeIndexes
private

-—— data items for nonlinear expressions -——

m_iNumberOfNonlinearExpressionTreeIndexes holds the number of distinct rows and objectives with nonlinear terms.

Definition at line 2567 of file OSInstance.h.

bool OSInstance::m_bNonlinearExpressionTreeIndexesProcessed
private

m_bNonlinearExpressionTreeIndexesProcessed is true if getNonlinearExpressionTreeIndexes() has been called.

m_bNonlinearExpressionTreeIndexesProcessed is true if getNonlinearExpressionTreeIndexes has been called.

Definition at line 2573 of file OSInstance.h.

int * OSInstance::m_miNonlinearExpressionTreeIndexes
private

m_miNonlinearExpressionTreeIndexes is an integer pointer to the distinct rows indexes in the nonlinear expression tree map.

Definition at line 2580 of file OSInstance.h.

int OSInstance::m_iNumberOfNonlinearExpressionTreeModIndexes
private

m_iNumberOfNonlinearExpressionTreeModIndexes holds the number of distinct rows and objectives with nonlinear terms including quadratic terms added to the nonlinear expression trees.

Definition at line 2587 of file OSInstance.h.

bool OSInstance::m_bNonlinearExpressionTreeModIndexesProcessed
private

m_bNonlinearExpressionTreeModIndexesProcessed is true if getNonlinearExpressionTreeModIndexes has been called.

Definition at line 2593 of file OSInstance.h.

int * OSInstance::m_miNonlinearExpressionTreeModIndexes
private

m_miNonlinearExpressionTreeModIndexes is an integer pointer to the distinct rows indexes in the modified expression tree map.

Definition at line 2599 of file OSInstance.h.

bool OSInstance::m_binitForAlgDiff
private

-—— data items for automatic differentiation -——

m_binitForAlgDiff is true if initForAlgDiff() has been called.

Definition at line 2606 of file OSInstance.h.

unsigned int OSInstance::m_iNumberOfNonlinearVariables
private

m_iNumberOfNonlinearVariables is the number of variables that appear in a nonlinear expression.

Definition at line 2612 of file OSInstance.h.

bool OSInstance::m_bProcessNonlinearExpressions
private

m_bProcessNonlinearExpressions holds whether the nonlinear expressions are processed.

Definition at line 2617 of file OSInstance.h.

int OSInstance::m_iNonlinearExpressionNumber
private

m_iNonlinearExpressionNumber holds the number of nonlinear expressions.

Definition at line 2622 of file OSInstance.h.

int * OSInstance::m_miNonlinearExpressionIndexes
private

m_miNonlinearExpressionIndexes holds an integer array of nonlinear expression indexes, negative indexes correspond to objectives.

Definition at line 2628 of file OSInstance.h.

bool OSInstance::m_bProcessExpressionTrees
private

m_bProcessExpressionTrees is true if the expression trees have been processed.

Definition at line 2633 of file OSInstance.h.

bool OSInstance::m_bProcessExpressionTreesMod
private

m_bProcessExpressionTreesMod is true if the modified expression trees have been processed.

Definition at line 2638 of file OSInstance.h.

double * OSInstance::m_mdConstraintFunctionValues
private

m_mdConstraintFunctionValues holds a double array of constraint function values – the size of the array is equal to getConstraintNumber().

Definition at line 2644 of file OSInstance.h.

double * OSInstance::m_mdObjectiveFunctionValues
private

m_mdObjectiveFunctionValues holds a double array of objective function values – the size of the array is equal to getObjectiveNumber().

Definition at line 2650 of file OSInstance.h.

int OSInstance::m_iJacValueSize
private

m_iJacValueSize is the number of nonzero partial derivates in the Jacobian.

Definition at line 2655 of file OSInstance.h.

int * OSInstance::m_miJacStart
private

m_miJacStart holds a int array of starts for the Jacobian matrix in sparse form (row major).

Definition at line 2660 of file OSInstance.h.

int * OSInstance::m_miJacIndex
private

m_miJacIndex holds a int array of variable indices for the Jacobian matrix in sparse form (row major).

Definition at line 2665 of file OSInstance.h.

double * OSInstance::m_mdJacValue
private

m_mdJacValue holds a double array of partial derivatives for the Jacobian matrix in sparse form (row major).

Definition at line 2670 of file OSInstance.h.

int * OSInstance::m_miJacNumConTerms
private

m_miJacNumConTerms holds a int array of the number of constant terms (gradient does not change) for the Jacobian matrix in sparse form (row major).

Definition at line 2676 of file OSInstance.h.

SparseJacobianMatrix * OSInstance::m_sparseJacMatrix
private

m_sparseJacMatrix is the Jacobian matrix stored in sparse matrix format

Definition at line 2681 of file OSInstance.h.

int OSInstance::m_iHighestTaylorCoeffOrder
private

m_iHighestTaylorCoeffOrder is the order of highest calculated Taylor coefficient

Definition at line 2687 of file OSInstance.h.

std::map<int, ScalarExpressionTree*> OSInstance::m_mapExpressionTrees
private

m_mapExpressionTrees holds a hash map of scalar-valued expression tree pointers.

The key is the row index and the value is the (single) expression tree representing the nonlinear expression of that row.

Remarks
For this to work all nonlinear expressions (including quadratic ones) must be combined into a single expression.

Definition at line 2697 of file OSInstance.h.

std::map< int, int > OSInstance::m_mapOSADFunRangeIndex
private

m_mapOSADFunRangeIndex is an inverse of the previous map.

The key is the number of the scalar-valued expression tree, and the value is the row to which this tree belongs.

Definition at line 2703 of file OSInstance.h.

std::map<int, MatrixExpressionTree*> OSInstance::m_mapMatrixExpressionTrees
private

m_mapMatrixExpressionTrees holds a hash map of matrix-valued expression tree pointers.

The key is the "row" index (multivariate cone objective or cone constraint) and the value is the (single) expression tree representing the expression of that row.

Remarks
For this to work all matrix expressions (including linear and quadratic ones) must be combined into a single expression.

Definition at line 2713 of file OSInstance.h.

ScalarExpressionTree* OSInstance::m_LagrangianExpTree
private

m_LagrangianExpTree is an ScalarExpressionTree object that is the expression tree for the Lagrangian function.

Definition at line 2719 of file OSInstance.h.

bool OSInstance::m_bLagrangianExpTreeCreated
private

m_bLagrangianHessionCreated is true if a Lagrangian function for the Hessian has been created

Definition at line 2724 of file OSInstance.h.

SparseHessianMatrix * OSInstance::m_LagrangianSparseHessian
private

m_LagrangianSparseHessian is the Hessian Matrix of the Lagrangian function in sparse format

Definition at line 2729 of file OSInstance.h.

bool OSInstance::m_bLagrangianSparseHessianCreated
private

m_bLagrangianSparseHessianCreated is true if the sparse Hessian Matrix for the Lagrangian was created

Definition at line 2735 of file OSInstance.h.

std::map< int, int > OSInstance::m_mapAllNonlinearVariablesIndex
private

m_mapAllNonlinearVariablesIndexMap is a map of the variables in the Lagrangian function

Definition at line 2740 of file OSInstance.h.

int * OSInstance::m_miNonLinearVarsReverseMap
private

m_miNonLinearVarsReverseMap maps the nonlinear variable number back into the original variable space

Definition at line 2746 of file OSInstance.h.

bool OSInstance::m_bAllNonlinearVariablesIndex
private

m_bAllNonlinearVariablesIndexMap is true if the map of the variables in the Lagrangian function has been constructed

Definition at line 2752 of file OSInstance.h.

std::map<int, ScalarExpressionTree*> OSInstance::m_mapExpressionTreesMod
private

m_mapExpressionTreesMod holds a map of expression trees, with the key being the row index and value being the expression tree representing a modification of the nonlinear expression of that row.

We incorporate the linear and quadratic term for a variable into the corresponding expression tree before gradient and Hessian calculations

Definition at line 2761 of file OSInstance.h.

bool OSInstance::m_bOSADFunIsCreated
private

m_bOSADFunIsCreated is true if we have created the OSInstanc OSAD Function

Definition at line 2768 of file OSInstance.h.

bool OSInstance::m_bCppADTapesBuilt
private

is true if a CppAD Expresion Tree has been built for each row and objective with a nonlinear expression.

Definition at line 2774 of file OSInstance.h.

bool OSInstance::m_bCppADMustReTape
private

is true if a CppAD Expresion Tree has an expression that can change depending on the value of the input, e.g.

an if statement – false by default

Definition at line 2780 of file OSInstance.h.

bool OSInstance::m_bDuplicateExpressionTreesMap
private

m_bDuplicateExpressionTreeMap is true if m_mapExpressionTrees was duplicated.

Definition at line 2785 of file OSInstance.h.

bool OSInstance::m_bNonLinearStructuresInitialized
private

m_bNonLinearStructuresInitialized is true if initializeNonLinearStructures() has been called.

m_bNonLinearStructuresInitialized is true if initializeNonLinearStructures( ) has been called.

Definition at line 2790 of file OSInstance.h.

bool OSInstance::m_bSparseJacobianCalculated
private

m_bSparseJacobianCalculated is true if getJacobianSparsityPattern() has been called.

Definition at line 2795 of file OSInstance.h.

std::map< int, std::vector< OSnLNode * > > OSInstance::m_mapExpressionTreesInPostfix
private

m_mapExpressionTreesInPostfix holds a hash map of expression trees in postfix format, with the key being the row index and value being the expression tree representing the nonlinear expression of that row.

m_mapExpressionTrees holds a hash map of expression trees in postfix format, with the key being the row index and value being the expression tree representing the nonlinear expression of that row.

Definition at line 2802 of file OSInstance.h.

int OSInstance::m_iHighestOrderEvaluated
private

m_iHighestOrderEvaluated is the highest order derivative of the current iterate

Definition at line 2808 of file OSInstance.h.

double ** OSInstance::m_mmdObjGradient
private

m_mdObjGradient holds an array of pointers, each pointer points to gradient of one objective function (as a dense array of double)

m_mdObjGradient holds an array of pointers, each pointer points to gradient of each objective function

Definition at line 2814 of file OSInstance.h.

std::vector< double > OSInstance::m_vdX
private

-—— data vectors for nonlinear optimization -——

m_vdX is a vector of primal variables at each iteration

Definition at line 2821 of file OSInstance.h.

std::vector< double > OSInstance::m_vdYval
private

m_vdYval is a vector of function values

Definition at line 2826 of file OSInstance.h.

std::vector< bool > OSInstance::m_vbLagHessNonz
private

m_vbLagHessNonz is a boolean vector holding the nonzero pattern of the Lagrangian of the Hessian

Definition at line 2832 of file OSInstance.h.

std::vector< double > OSInstance::m_vdYjacval
private

m_vdYval is a vector equal to a column or row of the Jacobian

Definition at line 2837 of file OSInstance.h.

std::vector< double > OSInstance::m_vdw
private

m_vdYval is a vector of derivatives – output from a reverse sweep

Definition at line 2842 of file OSInstance.h.

std::vector< double > OSInstance::m_vdLambda
private

m_vdYval is a vector of Lagrange multipliers

Definition at line 2847 of file OSInstance.h.

std::vector< double > OSInstance::m_vdDomainUnitVec
private

m_vdDomainUnitVec is a unit vector in the domain space

Definition at line 2852 of file OSInstance.h.

std::vector< double > OSInstance::m_vdRangeUnitVec
private

m_vdRangeUnitVec is a unit vector in the range space

Definition at line 2857 of file OSInstance.h.

bool OSInstance::m_bProcessMatrices
private

-—— data items for matrices -——

m_bProcessMatrices holds whether the matrices have been processed.

Definition at line 2864 of file OSInstance.h.

int OSInstance::m_iMatrixNumber
private

m_iMatrixNumber holds the number of matrices

Definition at line 2869 of file OSInstance.h.

ENUM_MATRIX_SYMMETRY* OSInstance::m_miMatrixSymmetry
private

m_miMatrixSymmetry holds the symmetry property of each matrix.

Remarks
for more information see the enumeration ENUM_MATRIX_SYMMETRY in OSParameters.h

Definition at line 2875 of file OSInstance.h.

ENUM_MATRIX_TYPE* OSInstance::m_miMatrixType
private

m_miMatrixType holds the type of each matrix.

Remarks
for more information see the enumeration ENUM_MATRIX_TYPE in OSParameters.h

Definition at line 2881 of file OSInstance.h.

int* OSInstance::m_miMatrixNumberOfColumns
private

m_miMatrixNumberOfColumns holds the number of columns for each matrix.

Definition at line 2886 of file OSInstance.h.

int* OSInstance::m_miMatrixNumberOfRows
private

m_miMatrixNumberOfRows holds the number of rows for each matrix.

Definition at line 2891 of file OSInstance.h.

std::string* OSInstance::m_msMatrixNames
private

m_msMatrixNames holds the names of the matrices

Definition at line 2896 of file OSInstance.h.

OSMatrix** OSInstance::m_mMatrix
private

m_mMatrix holds the list of constructors for each matrix.

Each solver interface must access the list of matrices, check that the data as given can be handled by the solver and perform whatever transformations are necessary to send the data to the solver.

Definition at line 2905 of file OSInstance.h.

int OSInstance::m_iMatrixVarNumber
private

-—— data items for matrix programming -——

m_iMatrixVarNumber holds the number of matrix variables

Definition at line 2956 of file OSInstance.h.

int OSInstance::m_iMatrixObjNumber
private

m_iMatrixObjNumber holds the number of matrix objectives

Definition at line 2961 of file OSInstance.h.

int OSInstance::m_iMatrixConNumber
private

m_iMatrixConNumber holds the number of matrix constraints

Definition at line 2966 of file OSInstance.h.

int OSInstance::m_iMatrixExpressionNumber
private

m_iMatrixExpressionNumber holds the number of matrix expressions

Definition at line 2971 of file OSInstance.h.

bool OSInstance::m_bProcessTimeDomain
private

-—— data items for time domain -——

m_bProcessTimeDomain holds whether the time domain has been processed.

Definition at line 2978 of file OSInstance.h.

bool OSInstance::m_bProcessTimeStages
private

m_bProcessTimeStages holds whether the time stages have been processed.

Definition at line 2983 of file OSInstance.h.

bool OSInstance::m_bProcessTimeInterval
private

m_bProcessTimeInterval holds whether a time interval has been processed.

Definition at line 2988 of file OSInstance.h.

bool OSInstance::m_bFiniteTimeStages
private

m_bFiniteTimeStages holds whether the time domain has the form of finite (discrete) stages.

Definition at line 2993 of file OSInstance.h.

int OSInstance::m_iNumberOfTimeStages
private

m_iNumberOfTimeStages holds the number of discrete stages

Definition at line 2998 of file OSInstance.h.

std::string OSInstance::m_sTimeDomainFormat
private

m_sTimeDomainFormat holds the format ("stages"/"interval") of the time domain.

Definition at line 3003 of file OSInstance.h.

std::string * OSInstance::m_msTimeDomainStageNames
private

m_msTimeDomainStageNames holds the names of the time stages.

Definition at line 3008 of file OSInstance.h.

int * OSInstance::m_miTimeDomainStageVariableNumber
private

m_miTimeDomainStageVariableNumber holds the number of variables in each stage.

Definition at line 3016 of file OSInstance.h.

int ** OSInstance::m_mmiTimeDomainStageVarList
private

m_mmiTimeDomainStageVarList holds the list of variables in each stage.

Definition at line 3021 of file OSInstance.h.

int * OSInstance::m_miTimeDomainStageConstraintNumber
private

m_miTimeDomainStageConstraintNumber holds the number of constraints in each stage.

Definition at line 3026 of file OSInstance.h.

int ** OSInstance::m_mmiTimeDomainStageConList
private

m_mmiTimeDomainStageConList holds the list of constraints in each stage.

Definition at line 3031 of file OSInstance.h.

int * OSInstance::m_miTimeDomainStageObjectiveNumber
private

m_miTimeDomainStageObjectiveNumber holds the number of objectives in each stage.

Definition at line 3036 of file OSInstance.h.

int ** OSInstance::m_mmiTimeDomainStageObjList
private

m_mmiTimeDomainStageObjList holds the list of objectives in each stage.

Definition at line 3041 of file OSInstance.h.

bool OSInstance::bUseExpTreeForFunEval

bUseExpTreeForFunEval is set to true if you wish to use the OS Expression Tree for function evaluations instead of AD – false by default.

Definition at line 4899 of file OSInstance.h.

InstanceHeader* OSInstance::instanceHeader

A pointer to an InstanceHeader object.

Definition at line 751 of file OSInstance.h.

std::map<int, OSExpressionTree*> OSInstance::m_mapExpressionTrees
private

m_mapExpressionTrees holds a hash map of expression tree pointers, with the key being the row index and value being the expression tree representing the nonlinear expression of that row.

Definition at line 1110 of file OSInstance.h.

OSExpressionTree* OSInstance::m_LagrangianExpTree
private

m_LagrangianExpTree is an OSExpressionTree object that is the expression tree for the Lagrangian function.

Definition at line 1120 of file OSInstance.h.

std::map<int, OSExpressionTree*> OSInstance::m_mapExpressionTreesMod
private

m_mapExpressionTreesMod holds a map of expression trees, with the key being the row index and value being the expression tree representing a modification of the nonlinear expression of that row.

We incorporate the linear and quadratic term for a variable into the corresponding expression tree before gradient and Hessian calculations

Definition at line 1160 of file OSInstance.h.


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