OS
2.10.2
|
The in-memory representation of an OSiL instance. More...
#include "OSInstance.h"
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... | |
int * | getObjectiveCoefficientNumbers () |
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... | |
SparseMatrix * | getLinearConstraintCoefficientsInColumnMajor () |
Get linear constraint coefficients in column major. More... | |
SparseMatrix * | getLinearConstraintCoefficientsInRowMajor () |
Get linear constraint coefficients in row major. More... | |
int | getNumberOfQuadraticTerms () |
Get the number of specified (usually nonzero) qTerms in the quadratic coefficients. More... | |
QuadraticTerms * | getQuadraticTerms () |
Get all the quadratic terms in the instance. More... | |
int * | getQuadraticRowIndexes () |
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... | |
ScalarExpressionTree * | getNonlinearExpressionTree (int rowIdx) |
Get the expression tree for a given row index. More... | |
ScalarExpressionTree * | getNonlinearExpressionTreeMod (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 () |
int * | getNonlinearExpressionTreeIndexes () |
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... | |
int * | 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. 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) |
OSMatrix * | getMatrix (int n) |
Get the list of constructors of the matrix. More... | |
GeneralSparseMatrix * | getMatrixCoefficientsInColumnMajor (int n) |
Get the (nonzero) elements of the matrix in column major form. More... | |
GeneralSparseMatrix * | getMatrixCoefficientsInRowMajor (int n) |
Get the (nonzero) elements of the matrix in row major form. More... | |
GeneralSparseMatrix * | getMatrixBlockInColumnMajorForm (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... | |
MatrixExpressionTree * | getMatrixExpressionTree (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 () |
int * | getMatrixExpressionTreeIndexes () |
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... | |
int * | getTimeDomainStageNumberOfVariables () |
Get the number of variables contained in each time stage. More... | |
int * | getTimeDomainStageNumberOfConstraints () |
Get the number of constraints contained in each time stage. More... | |
int * | getTimeDomainStageNumberOfObjectives () |
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... | |
SparseJacobianMatrix * | calculateAllConstraintFunctionGradients (double *x, double *objLambda, double *conLambda, bool new_x, int highestOrder) |
Calculate the gradient of all constraint functions. More... | |
SparseVector * | calculateConstraintFunctionGradient (double *x, double *objLambda, double *conLambda, int idx, bool new_x, int highestOrder) |
Calculate the gradient of the constraint function indexed by idx. More... | |
SparseVector * | calculateConstraintFunctionGradient (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... | |
SparseHessianMatrix * | 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. More... | |
SparseHessianMatrix * | calculateHessian (double *x, int idx, bool new_x) |
Calculate the Hessian of a constraint or objective function. More... | |
bool | getSparseJacobianFromColumnMajor () |
bool | getSparseJacobianFromRowMajor () |
ScalarExpressionTree * | getLagrangianExpTree () |
std::map< int, int > | getAllNonlinearVariablesIndexMap () |
SparseHessianMatrix * | getLagrangianHessianSparsityPattern () |
bool | addQTermsToExressionTree () |
bool | addQTermsToExpressionTree () |
This method adds quadratic terms into the array of expression trees. More... | |
SparseJacobianMatrix * | getJacobianSparsityPattern () |
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 | |
GeneralFileHeader * | instanceHeader |
the instanceHeader is implemented as a general file header object to allow sharing of classes between schemas More... | |
InstanceData * | instanceData |
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... | |
The in-memory representation of an OSiL instance.
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
The OSInstance class is composed of two objects: the header object instanceHeader and the data object instanceData
Definition at line 2262 of file OSInstance.h.
OSInstance::OSInstance | ( | ) |
The OSInstance class constructor.
OSInstance::~OSInstance | ( | ) |
The OSInstance class destructor.
bool OSInstance::IsEqual | ( | OSInstance * | that | ) |
A function to check for the equality of two objects.
std::string OSInstance::getInstanceName | ( | ) |
Get instance name.
std::string OSInstance::getInstanceSource | ( | ) |
Get instance source.
std::string OSInstance::getInstanceDescription | ( | ) |
Get instance description.
std::string OSInstance::getInstanceCreator | ( | ) |
Get instance fileCreator.
std::string OSInstance::getInstanceLicence | ( | ) |
Get instance licence.
int OSInstance::getVariableNumber | ( | ) |
Get number of variables.
std::string* OSInstance::getVariableNames | ( | ) |
Get variable names.
Exception | if the elements in variables are logically inconsistent. |
char* OSInstance::getVariableTypes | ( | ) |
Get variable initial values.
Exception | if the elements in variables are logically inconsistent. – now deprecated Get variable initial std::string values. |
Exception | if the elements in variables are logically inconsistent. – now deprecated Get variable types.
|
Exception | if the elements in variables are logically inconsistent. |
int OSInstance::getNumberOfIntegerVariables | ( | ) |
getNumberOfIntegerVariables
int OSInstance::getNumberOfBinaryVariables | ( | ) |
getNumberOfBinaryVariables
int OSInstance::getNumberOfSemiContinuousVariables | ( | ) |
getNumberOfSemiContinuousVariables
int OSInstance::getNumberOfSemiIntegerVariables | ( | ) |
getNumberOfSemiIntegerVariables
int OSInstance::getNumberOfStringVariables | ( | ) |
getNumberOfStringVariables
double* OSInstance::getVariableLowerBounds | ( | ) |
Get variable lower bounds.
Exception | if the elements in variables are logically inconsistent. |
double* OSInstance::getVariableUpperBounds | ( | ) |
Get variable upper bounds.
Exception | if the elements in variables are logically inconsistent. |
int OSInstance::getObjectiveNumber | ( | ) |
Get number of objectives.
std::string* OSInstance::getObjectiveNames | ( | ) |
Get objective names.
Exception | if the elements in objectives are logically inconsistent. |
std::string* OSInstance::getObjectiveMaxOrMins | ( | ) |
Get objective maxOrMins.
One maxOrMin for each objective.
Exception | if the elements in objectives are logically inconsistent. |
int* OSInstance::getObjectiveCoefficientNumbers | ( | ) |
Get objective coefficient number.
One number for each objective.
Exception | if the elements in objectives are logically inconsistent. |
double* OSInstance::getObjectiveConstants | ( | ) |
Get objective constants.
One constant for each objective.
Exception | if the elements in objectives are logically inconsistent. |
double* OSInstance::getObjectiveWeights | ( | ) |
Get objective weights.
One weight for each objective.
Exception | if the elements in objectives are logically inconsistent. |
SparseVector** OSInstance::getObjectiveCoefficients | ( | ) |
Get objective coefficients.
One set of objective coefficients for each objective.
Exception | if the elements in objectives are logically inconsistent. |
double** OSInstance::getDenseObjectiveCoefficients | ( | ) |
getDenseObjectiveCoefficients.
int OSInstance::getConstraintNumber | ( | ) |
Get number of constraints.
std::string* OSInstance::getConstraintNames | ( | ) |
Get constraint names.
Exception | if the elements in constraints are logically inconsistent. |
double* OSInstance::getConstraintLowerBounds | ( | ) |
Get constraint lower bounds.
Exception | if the elements in constraints are logically inconsistent. |
double* OSInstance::getConstraintUpperBounds | ( | ) |
Get constraint upper bounds.
Exception | if the elements in constraints are logically inconsistent. |
double* OSInstance::getConstraintConstants | ( | ) |
Get constraint constants.
Exception | if the elements in constraints are logically inconsistent. |
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.
Exception | if the elements in constraints are logically inconsistent. |
int OSInstance::getLinearConstraintCoefficientNumber | ( | ) |
Get 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).
Exception | if the elements in linear constraint coefficients are logically inconsistent. |
SparseMatrix* OSInstance::getLinearConstraintCoefficientsInColumnMajor | ( | ) |
Get linear constraint coefficients in column major.
Exception | if the elements in linear constraint coefficients are logically inconsistent. |
SparseMatrix* OSInstance::getLinearConstraintCoefficientsInRowMajor | ( | ) |
Get linear constraint coefficients in row major.
Exception | if the elements in linear constraint coefficients are logically inconsistent. |
int OSInstance::getNumberOfQuadraticTerms | ( | ) |
Get the number of specified (usually nonzero) qTerms in the quadratic coefficients.
QuadraticTerms* OSInstance::getQuadraticTerms | ( | ) |
Get all the quadratic terms in the instance.
Exception | if the elements in quadratic coefficients are logically inconsistent. |
int* OSInstance::getQuadraticRowIndexes | ( | ) |
Get the indexes of rows which have a quadratic term.
int OSInstance::getNumberOfQuadraticRowIndexes | ( | ) |
Get the number of rows which have a quadratic term.
int OSInstance::getNumberOfNonlinearExpressions | ( | ) |
Get number of nonlinear expressions.
Nl** OSInstance::getNonlinearExpressions | ( | ) |
Get the pointers to the roots of all expression trees.
ScalarExpressionTree* OSInstance::getNonlinearExpressionTree | ( | int | rowIdx | ) |
Get the expression tree for a given row index.
ScalarExpressionTree* OSInstance::getNonlinearExpressionTreeMod | ( | int | rowIdx | ) |
Get the expression tree for a given row index for the modified expression trees (quadratic terms added)
std::vector<ExprNode*> OSInstance::getNonlinearExpressionTreeInPostfix | ( | int | rowIdx | ) |
Get the postfix tokens for a given row index.
std::vector<ExprNode*> OSInstance::getNonlinearExpressionTreeModInPostfix | ( | int | rowIdx | ) |
Get the postfix tokens for a given row index for the modified Expression Tree (quadratic terms added).
std::vector<ExprNode*> OSInstance::getNonlinearExpressionTreeInPrefix | ( | int | rowIdx | ) |
Get the prefix tokens for a given row index.
std::string OSInstance::getNonlinearExpressionTreeInInfix | ( | int | rowIdx | ) |
Get the infix representation for a given row (or objective function) index.
rowIdx | is the index of the row we want to express in infix. |
std::vector<ExprNode*> OSInstance::getNonlinearExpressionTreeModInPrefix | ( | int | rowIdx | ) |
Get the prefix tokens for a given row index for the modified Expression Tree (quadratic terms added).
int OSInstance::getNumberOfNonlinearObjectives | ( | ) |
int OSInstance::getNumberOfNonlinearConstraints | ( | ) |
std::map<int, ScalarExpressionTree* > OSInstance::getAllNonlinearExpressionTrees | ( | ) |
std::map<int, ScalarExpressionTree* > OSInstance::getAllNonlinearExpressionTreesMod | ( | ) |
int* OSInstance::getNonlinearExpressionTreeIndexes | ( | ) |
Get all the nonlinear expression tree indexes, i.e., indexes of rows (objectives or constraints) that contain nonlinear expressions.
int OSInstance::getNumberOfNonlinearExpressionTreeIndexes | ( | ) |
Get the number of unique nonlinear expression tree indexes.
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.
int OSInstance::getNumberOfNonlinearExpressionTreeModIndexes | ( | ) |
Get the number of unique nonlinear expression tree indexes after modifying the expression tree to contain quadratic terms.
int OSInstance::getMatrixNumber | ( | ) |
Get the number of matrices.
ENUM_MATRIX_TYPE OSInstance::getMatrixType | ( | int | n | ) |
Get the matrix type.
n | is the index number associated with the matrix. |
ENUM_MATRIX_SYMMETRY OSInstance::getMatrixSymmetry | ( | int | n | ) |
Get the matrix symmetry.
n | is the index number associated with the matrix. |
int OSInstance::getNumberOfColumnsForMatrix | ( | int | n | ) |
Get the number of blocks in the matrix.
n | is the index number associated with the matrix. |
n | is the index number associated with the matrix. |
int OSInstance::getNumberOfRowsForMatrix | ( | int | n | ) |
Get the number of rows in the matrix.
n | is the index number associated with the matrix. |
int OSInstance::getNumberOfValuesForMatrix | ( | int | n | ) |
Get the number of (nonzero) values in the matrix.
n | is the index number associated with the matrix. |
std::string OSInstance::getMatrixName | ( | int | n | ) |
Get the name of the matrix.
n | is the index number associated with the matrix. |
bool OSInstance::matrixHasBase | ( | int | n | ) |
Several tools to parse the constructor list of a matrix.
n | is the index number associated with the matrix. |
bool OSInstance::matrixHasElements | ( | int | n | ) |
bool OSInstance::matrixHasTransformations | ( | int | n | ) |
bool OSInstance::matrixHasBlocks | ( | int | n | ) |
int OSInstance::getNumberOfElementConstructors | ( | int | n | ) |
int OSInstance::getNumberOfTransformationConstructors | ( | int | n | ) |
int OSInstance::getNumberOfBlocksConstructors | ( | int | n | ) |
OSMatrix* OSInstance::getMatrix | ( | int | n | ) |
Get the list of constructors of the matrix.
n | is the index number associated with the matrix. |
GeneralSparseMatrix* OSInstance::getMatrixCoefficientsInColumnMajor | ( | int | n | ) |
Get the (nonzero) elements of the matrix in column major form.
n | is the index number associated with the matrix. |
GeneralSparseMatrix* OSInstance::getMatrixCoefficientsInRowMajor | ( | int | n | ) |
Get the (nonzero) elements of the matrix in row major form.
n | is the index number associated with the matrix. |
GeneralSparseMatrix* OSInstance::getMatrixBlockInColumnMajorForm | ( | int | n, |
int | columnIdx, | ||
int | rowIdx | ||
) |
Get the (nonzero) elements of the matrix in symmetric block form.
n | is the index number associated with the matrix. |
n | is the index number associated with the matrix. |
columnIdx | is the column index of the block's location |
rowIdx | is the row index of the block's location |
int OSInstance::getNumberOfMatrixVariables | ( | ) |
Get the number of matrix variables.
int OSInstance::getNumberOfMatrixObjectives | ( | ) |
Get the number of matrix objectives.
int OSInstance::getNumberOfMatrixConstraints | ( | ) |
Get the number of matrix constraints.
int OSInstance::getNumberOfMatrixExpressions | ( | ) |
Get the number of matrix-valued expressions.
MatrixExpression** OSInstance::getMatrixExpressions | ( | ) |
Get the pointers to the roots of all matrix expression trees.
MatrixExpressionTree* OSInstance::getMatrixExpressionTree | ( | int | rowIdx | ) |
Get the matrix expression tree for a given row index.
std::vector<ExprNode*> OSInstance::getMatrixExpressionTreeInPostfix | ( | int | rowIdx | ) |
Get the postfix tokens for a given row index.
std::vector<ExprNode*> OSInstance::getMatrixExpressionTreeModInPostfix | ( | int | rowIdx | ) |
Get the postfix tokens for a given row index for the modified Expression Tree (quadratic terms added).
std::vector<ExprNode*> OSInstance::getMatrixExpressionTreeInPrefix | ( | int | rowIdx | ) |
Get the prefix tokens for a given row index.
std::string OSInstance::getMatrixExpressionTreeInInfix | ( | int | rowIdx | ) |
Get the infix representation for a given row (or objective function) index.
rowIdx | is the index of the row we want to express in infix. |
std::map<int, MatrixExpressionTree* > OSInstance::getAllMatrixExpressionTrees | ( | ) |
std::map<int, MatrixExpressionTree* > OSInstance::getAllMatrixExpressionTreesMod | ( | ) |
int* OSInstance::getMatrixExpressionTreeIndexes | ( | ) |
Get all the matrix expression tree indexes, i.e.
indexes of matrix objectives or matrix constraints that contain matrix expressions.
int OSInstance::getNumberOfMatrixExpressionTreeIndexes | ( | ) |
Get the number of unique matrix expression tree indexes.
std::string OSInstance::getTimeDomainFormat | ( | ) |
Get the format of the time domain ("stages"/"interval")
int OSInstance::getTimeDomainStageNumber | ( | ) |
Get the number of stages that make up the time domain.
std::string* OSInstance::getTimeDomainStageNames | ( | ) |
Get the names of the stages (NULL or empty string ("") if a stage has not been given a name.
int* OSInstance::getTimeDomainStageNumberOfVariables | ( | ) |
Get the number of variables contained in each time stage.
int* OSInstance::getTimeDomainStageNumberOfConstraints | ( | ) |
Get the number of constraints contained in each time stage.
int* OSInstance::getTimeDomainStageNumberOfObjectives | ( | ) |
Get the number of objectives contained in each time stage.
int** OSInstance::getTimeDomainStageVarList | ( | ) |
Get the list of variables in each stage.
int** OSInstance::getTimeDomainStageConList | ( | ) |
Get the list of constraints in each stage.
int** OSInstance::getTimeDomainStageObjList | ( | ) |
Get the list of objectives in each stage.
double OSInstance::getTimeDomainIntervalStart | ( | ) |
Get the start for the time domain interval.
double OSInstance::getTimeDomainIntervalHorizon | ( | ) |
Get the horizon for the time domain interval.
bool OSInstance::setInstanceName | ( | std::string | name | ) |
set the instance name.
name | holds the instance name. |
bool OSInstance::setInstanceSource | ( | std::string | source | ) |
set the instance source.
source | holds the instance source. |
bool OSInstance::setInstanceDescription | ( | std::string | description | ) |
set the instance description.
description | holds the instance description. |
bool OSInstance::setInstanceCreator | ( | std::string | fileCreator | ) |
set the instance creator.
fileCreator | holds the instance creator. |
bool OSInstance::setInstanceLicence | ( | std::string | licence | ) |
set the instance licence.
licence | holds the instance licence. |
bool OSInstance::setVariableNumber | ( | int | number | ) |
set the number of variables.
number | holds the number of variables. |
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.
index | holds the variable index. It is required. |
name | holds the variable name; use null or empty std::string ("") if no variable name. |
lowerBound | holds the variable lower bound; use -OSDBL_MAX if no lower bound. |
upperBound | holds the variable upper bound; use OSDBL_MAX if no upper bound. |
type | holds 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). |
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.
number | holds the number of variables. It is required. |
names | holds a std::string array of variable names; use null if no variable names. |
lowerBounds | holds 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. |
upperBounds | holds 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. |
types | holds 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). |
inits | holds a double array of varible initial values; use null if no initial values. – deprecated |
initsString | holds a std::string array of varible initial values; use null if no initial std::string values. – deprecated |
bool OSInstance::setObjectiveNumber | ( | int | number | ) |
set the number of objectives.
number | holds the number of objectives. |
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.
index | holds the objective index. Remember the first objective index is -1, second -2, ... |
name | holds the objective name; use null or empty std::string ("") if no objective name. |
maxOrMin | holds the objective sense or direction; it can only take two values: "max" or "min". |
constant | holds the objective constant; use 0.0 if no objective constant. |
weight | holds the objective weight; use 1.0 if no objective weight. |
objectiveCoefficients | holds the objective coefficients (null if no objective coefficients) in a sparse representation that holds two arrays: index array and a value array. |
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.
number | holds the number of objectives. It is required. |
names | holds a std::string array of objective names; use null if no objective names. |
maxOrMins | holds a std::string array of objective objective senses or directions: "max" or "min"; use null if all objectives are "min". |
constants | holds a double array of objective constants; use null if all objective constants are 0.0. |
weights | holds a double array of objective weights; use null if all objective weights are 1.0. |
objectiveCoefficients | holds 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. |
bool OSInstance::setConstraintNumber | ( | int | number | ) |
set the number of constraints.
number | holds the number of constraints. |
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.
index | holds the constraint index. It is required. |
name | holds the constraint name; use null or empty std::string ("") if no constraint name. |
lowerBound | holds the constraint lower bound; use -OSDBL_MAX if no lower bound. |
upperBound | holds the constraint upper bound; use OSDBL_MAX if no upper bound. |
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.
number | holds the number of constraints. It is required. |
names | holds a std::string array of constraint names; use null if no constraint names. |
lowerBounds | holds 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. |
upperBounds | holds 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. |
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
numberOfValues | holds the number of specified coefficient values (usually nonzero) in the coefficient matrix. |
isColumnMajor | holds whether the coefficient matrix is stored in column major (true) or row major (false). |
values | holds a double array coefficient values in the matrix. |
valuesBegin | holds the begin index of the values array to copy from (usually 0). |
valuesEnd | holds the end index of the values array to copy till (usually values.length - 1). |
indexes | holds an integer array column/row indexes for each value in the values array. |
indexesBegin | holds the begin index of the indexes array to copy from (usually 0). |
indexesEnd | holds the end index of the indexes array to copy till (usually indexes.length - 1). |
starts | holds an integer array start indexes in the matrix; the first value of starts should always be 0. |
startsBegin | holds the begin index of the starts array to copy from (usually 0). |
startsEnd | holds the end index of the starts array to copy till (usually starts.length - 1). |
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
numberOfValues | holds the number of specified coefficient values (usually nonzero) in the coefficient matrix. |
isColumnMajor | holds whether the coefficient matrix is stored in column major (true) or row major (false). |
values | holds a double array coefficient values in the matrix. |
valuesBegin | holds the begin index of the values array to copy from (usually 0). |
valuesEnd | holds the end index of the values array to copy till (usually values.length - 1). |
indexes | holds an integer array column/row indexes for each value in the values array. |
indexesBegin | holds the begin index of the indexes array to copy from (usually 0). |
indexesEnd | holds the end index of the indexes array to copy till (usually indexes.length - 1). |
starts | holds an integer array start indexes in the matrix; the first value of starts should always be 0. |
startsBegin | holds the begin index of the starts array to copy from (usually 0). |
startsEnd | holds the end index of the starts array to copy till (usually starts.length - 1). |
bool OSInstance::setNumberOfQuadraticTerms | ( | int | nq | ) |
set the number of quadratic terms
nq | holds the number of quadratic terms. |
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
number | holds the number of quadratic terms. |
rowIndexes | holds 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. |
varOneIndexes | holds an integer array of the first variable indexes of all the quadratic terms. |
varTwoIndexes | holds an integer array of the second variable indexes of all the quadratic terms. |
coefficients | holds an array of double containing all the quadratic term coefficients. |
begin | holds the begin index of all the arrays to copy from (usually = 0). |
end | holds the end index of all the arrays to copy till (usually = array length -1). |
bool OSInstance::setQuadraticTermsInNonlinearExpressions | ( | int | number, |
int * | rowIndexes, | ||
int * | varOneIndexes, | ||
int * | varTwoIndexes, | ||
double * | coefficients | ||
) |
set quadratic terms in nonlinearExpressions
number | holds the number of quadratic terms. |
rowIndexes | holds 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. |
varOneIndexes | holds an integer array of the first variable indexes of all the quadratic terms. |
varTwoIndexes | holds an integer array of the second variable indexes of all the quadratic terms. |
coefficients | holds a double array all the quadratic term coefficients. |
set nonlinear expressions
nexpr | holds the number of nonlinear expressions. |
root | holds a pointer array to the root nodes of all the nonlinear expressions. |
bool OSInstance::setMatrixNumber | ( | int | number | ) |
set the number of matrices
number | holds the number of matrices |
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.
index | holds the matrix index. It is required. |
name | holds the matrix name; use null or empty std::string ("") if no matrix name. |
numberOfRows | holds the number of rows. It is required. Use 1 for column vectors. |
numberOfColumns | holds the number of columns. It is required. Use 1 for row vectors. |
symmetry | holds 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. |
matrixType | tracks 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. |
inumberOfChildren | is the number of MatrixNode child elements, i.e., the number of matrix constructors in the m_mChildren array. |
m_mChildren | is the array of matrix constructors used in the definition of this matrix. |
bool OSInstance::setConeNumber | ( | int | number | ) |
set the number of cones
number | holds the number of cones |
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.
index | holds the cone index. It is required. |
numberOfRows | holds the number of rows. It is required. |
numberOfColumns | holds the number of columns. It is required. |
coneType | holds 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. |
name | holds the cone name; use null or empty std::string ("") if no cone name. |
numberOfOtherIndexes | holds the number of other indexes if the cone contains higher-dimensional tensors. This argument is optional and can be omitted. It defaults to 0. |
otherIndexes | holds the array of other indexes if the cone contains higher-dimensional tensors. This argument is optional and can be omitted. It defaults to null. |
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.
index | holds the cone index. It is required. |
numberOfRows | holds the number of rows. It is required. |
numberOfColumns | holds the number of columns. It is required. |
coneType | holds 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. |
name | holds the cone name; use null or empty std::string ("") if no cone name. |
numberOfComponents | holds the number of components of this cone. |
components | holds the indexes of the components of this cone. |
numberOfOtherIndexes | holds the number of other indexes if the cone contains higher-dimensional tensors. This argument is optional and can be omitted. It defaults to 0. |
otherIndexes | holds the array of other indexes if the cone contains higher-dimensional tensors. This argument is optional and can be omitted. It defaults to null. |
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.
index | holds the cone index. It is required. |
numberOfRows | holds the number of rows. It is required. |
numberOfColumns | holds the number of columns. It is required. |
coneType | holds 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. |
name | holds the cone name; use null or empty std::string ("") if no cone name. |
referenceIdx | holds the index of a cone or matrix used in the definition of this cone. |
numberOfOtherIndexes | holds the number of other indexes if the cone contains higher-dimensional tensors. This argument is optional and can be omitted. It defaults to 0. |
otherIndexes | holds the array of other indexes if the cone contains higher-dimensional tensors. This argument is optional and can be omitted. It defaults to null. |
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.
index | holds the cone index. It is required. |
numberOfRows | holds the number of rows. It is required. |
numberOfColumns | holds the number of columns. It is required. |
coneType | holds 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. |
name | holds the cone name; use null or empty std::string ("") if no cone name. |
semidefiniteness | distinguishes positive and negative semidefinite cones. It must be either "positive" or "negative". |
numberOfOtherIndexes | holds the number of other indexes if the cone contains higher-dimensional tensors. This argument is optional and can be omitted. It defaults to 0. |
otherIndexes | holds the array of other indexes if the cone contains higher-dimensional tensors. This argument is optional and can be omitted. It defaults to null. |
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.
index | holds the cone index. It is required. |
numberOfRows | holds the number of rows. It is required. |
numberOfColumns | holds the number of columns. It is required. |
coneType | holds 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. |
name | holds the cone name; use null or empty std::string ("") if no cone name. |
distortionMatrixIdx | holds the index of a distortion matrix. Use -1 if there is none. |
normFactor | holds a scale factor for the norm. Use 1 if there is none. |
axisDirection | holds the index of the axis direction. The most usual value is 0. |
numberOfOtherIndexes | holds the number of other indexes if the cone contains higher-dimensional tensors. This argument is optional and can be omitted. It defaults to 0. |
otherIndexes | holds the array of other indexes if the cone contains higher-dimensional tensors. This argument is optional and can be omitted. It defaults to null. |
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.
index | holds the cone index. It is required. |
numberOfRows | holds the number of rows. It is required. |
numberOfColumns | holds the number of columns. It is required. |
coneType | holds 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. |
name | holds the cone name; use null or empty std::string ("") if no cone name. |
distortionMatrixIdx | holds the index of a distortion matrix. Use -1 if there is none. |
normFactor | holds a scale factor for the norm. Use 1 if there is none. |
firstAxisDirection | holds the index of the first axis direction. The most usual value is 0. |
secondAxisDirection | holds the index of the second axis direction. The most usual value is 1. |
numberOfOtherIndexes | holds the number of other indexes if the cone contains higher-dimensional tensors. This argument is optional and can be omitted. It defaults to 0. |
otherIndexes | holds the array of other indexes if the cone contains higher-dimensional tensors. This argument is optional and can be omitted. It defaults to null. |
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.
index | holds the cone index. It is required. |
numberOfRows | holds the number of rows. It is required. |
numberOfColumns | holds the number of columns. It is required. |
coneType | holds 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. |
name | holds the cone name; use null or empty std::string ("") if no cone name. |
distortionMatrixIdx | holds the index of a distortion matrix. Use -1 if there is none. |
normFactor | holds a scale factor for the norm. Use 1 if there is none. |
pNorm | holds the norm descriptor. It must be greater than or equal to 1. |
numberOfOtherIndexes | holds the number of other indexes if the cone contains higher-dimensional tensors. This argument is optional and can be omitted. It defaults to 0. |
otherIndexes | holds the array of other indexes if the cone contains higher-dimensional tensors. This argument is optional and can be omitted. It defaults to null. |
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.
index | holds the cone index. It is required. |
numberOfRows | holds the number of rows. It is required. |
numberOfColumns | holds the number of columns. It is required. |
coneType | holds 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. |
name | holds the cone name; use null or empty std::string ("") if no cone name. |
maxDegree | holds the maximum degree of the polynomials. Use 1, 2, 3, ..., INF. |
numberOfUB | holds the number of (box-type) upper bound constraints. Use 0 if there are none. |
ub | holds the upper bound values. Use null if there are no upper bounds. |
numberOfLB | holds the number of (box-type) lower bound constraints. Use 0 if there are none. |
lb | holds the lower bound values. Use null if there are no lower bounds. |
numberOfOtherIndexes | holds the number of other indexes if the cone contains higher-dimensional tensors. This argument is optional and can be omitted. It defaults to 0. |
otherIndexes | holds the array of other indexes if the cone contains higher-dimensional tensors. This argument is optional and can be omitted. It defaults to null. |
std::string OSInstance::printModel | ( | ) |
Print the infix representation of the problem.
std::string OSInstance::printModel | ( | int | rowIdx | ) |
Print the infix representation of the row (which could be an an objective function row) indexed by rowIdx.
rowIdx | is the index of the row we want to express in infix. |
bool OSInstance::initializeNonLinearStructures | ( | ) |
Initialize the data structures for the nonlinear API.
double OSInstance::calculateFunctionValue | ( | int | idx, |
double * | x, | ||
bool | new_x | ||
) |
Calculate the function value for function (constraint or objective) indexed by idx.
idx | is the index on the constraint (0, 1, 2, 3, ...) or objective function (-1, -2, -3, ...). |
x | is a pointer (double array) to the current variable values |
new_x | is 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 |
double* OSInstance::calculateAllConstraintFunctionValues | ( | double * | x, |
double * | objLambda, | ||
double * | conLambda, | ||
bool | new_x, | ||
int | highestOrder | ||
) |
Calculate all of the constraint function values.
x | is a pointer (double array) to the current variable values |
objLambda | is the Lagrange multiplier on the objective function |
conLambda | is pointer (double array) of Lagrange multipliers on the constratins |
new_x | is false if any evaluation method was previously called for the current x for the current iterate |
highestOrder | is the highest order of the derivative being calculated |
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.
x | is a pointer (double array) to the current variable values |
new_x | is false if any evaluation method was previously called for the current iterate |
double* OSInstance::calculateAllObjectiveFunctionValues | ( | double * | x, |
double * | objLambda, | ||
double * | conLambda, | ||
bool | new_x, | ||
int | highestOrder | ||
) |
Calculate all of the objective function values.
x | is a pointer (double array) to the current variable values |
objLambda | is the Lagrange multiplier on the objective function |
conLambda | is pointer (double array) of Lagrange multipliers on the constratins |
new_x | is false if any evaluation method was previously called for the current iterate |
highestOrder | is the highest order of the derivative being calculated |
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.
x | is a pointer (double array) to the current variable values |
new_x | is false if any evaluation method was previously called for the current iterate |
SparseJacobianMatrix* OSInstance::calculateAllConstraintFunctionGradients | ( | double * | x, |
double * | objLambda, | ||
double * | conLambda, | ||
bool | new_x, | ||
int | highestOrder | ||
) |
Calculate the gradient of all constraint functions.
x | is a pointer (double array) to the current variable values |
objLambda | is the Lagrange multiplier on the objective function |
conLambda | is pointer (double array) of Lagrange multipliers on the constratins |
new_x | is false if any evaluation method was previously called for the current iterate |
highestOrder | is the highest order of the derivative being calculated |
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.
x | is a pointer (double array) to the current variable values |
objLambda | is the Lagrange multiplier on the objective function |
conLambda | is pointer (double array) of Lagrange multipliers on the constratins @parma idx is the index of the constraint function gradient |
new_x | is false if any evaluation method was previously called for the current iterate |
highestOrder | is the highest order of the derivative being calculated |
SparseVector* OSInstance::calculateConstraintFunctionGradient | ( | double * | x, |
int | idx, | ||
bool | new_x | ||
) |
Calculate the gradient of the constraint function indexed by idx this function is overloaded.
x | is a pointer (double array) to the current variable values @parma idx is the index of the constraint function gradient |
new_x | is false if any evaluation method was previously called for the current iterate |
highestOrder | is the highest order of the derivative being calculated |
double** OSInstance::calculateAllObjectiveFunctionGradients | ( | double * | x, |
double * | objLambda, | ||
double * | conLambda, | ||
bool | new_x, | ||
int | highestOrder | ||
) |
Calculate the gradient of all objective functions.
x | is a pointer (double array) to the current variable values |
objLambda | is the Lagrange multiplier on the objective function |
conLambda | is pointer (double array) of Lagrange multipliers on the constratins |
new_x | is false if any evaluation method was previously called for the current iterate |
highestOrder | is the highest order of the derivative being calculated |
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.
x | is a pointer (double array) to the current variable values |
objLambda | is the Lagrange multiplier on the objective function |
conLambda | is pointer (double array) of Lagrange multipliers on the constratins @parma objIdx is the index of the objective function being optimized |
new_x | is false if any evaluation method was previously called for the current iterate |
highestOrder | is the highest order of the derivative being calculated |
double* OSInstance::calculateObjectiveFunctionGradient | ( | double * | x, |
int | objIdx, | ||
bool | new_x | ||
) |
Calculate the gradient of the objective function indexed by objIdx this function is overloaded.
x | is a pointer (double array) to the current variable values |
objIdx | is the index of the objective function being optimized |
new_x | is false if any evaluation method was previously called for the current iterate |
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.
x | is a pointer (double array) to the current variable values |
objLambda | is the Lagrange multiplier on the objective function |
conLambda | is pointer (double array) of Lagrange multipliers on the constratins |
new_x | is false if any evaluation method was previously called for the current iterate |
highestOrder | is the highest order of the derivative being calculated |
SparseHessianMatrix* OSInstance::calculateHessian | ( | double * | x, |
int | idx, | ||
bool | new_x | ||
) |
Calculate the Hessian of a constraint or objective function.
x | is a pointer (double array) to the current variable values |
new_x | is false if any evaluation method was previously called for the current iterate @parma idx is the index of the either a constraint or objective function Hessian |
bool OSInstance::getSparseJacobianFromColumnMajor | ( | ) |
bool OSInstance::getSparseJacobianFromRowMajor | ( | ) |
ScalarExpressionTree* OSInstance::getLagrangianExpTree | ( | ) |
std::map<int, int> OSInstance::getAllNonlinearVariablesIndexMap | ( | ) |
SparseHessianMatrix* OSInstance::getLagrangianHessianSparsityPattern | ( | ) |
bool OSInstance::addQTermsToExressionTree | ( | ) |
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)
SparseJacobianMatrix* OSInstance::getJacobianSparsityPattern | ( | ) |
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.
vdX | is a vector of doubles holding the current primal variable values the size of x should equal instanceData->variables->numberOfVariables |
std::vector<double> OSInstance::forwardAD | ( | int | p, |
std::vector< double > | vdX | ||
) |
Perform an AD forward sweep.
p | is the highest order Taylor coefficient |
vdX | is a vector of doubles of the current primal variable values the size of vdX m_iNumberOfNonlinearVariables |
std::vector<double> OSInstance::reverseAD | ( | int | p, |
std::vector< double > | vdlambda | ||
) |
Perform an AD reverse sweep.
p | is the order of the sweep |
vdlambda | is 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 |
int OSInstance::getADSparsityHessian | ( | ) |
end revised AD code
Call the AD routine to fill in m_vbLagHessNonz and determine the nonzeros.
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
x | is a pointer of doubles of primal values for the current iteration |
objLambda | is is a pointer of doubles of the current dual (Lagrange) multipliers on the objective functions |
conLambda | is a pointer of doubles of the current dual (Lagrange) multipliers on the constraints |
new_x | is false if any evaluation method was previously called |
highestOrder | is the highest order derivative to be calculated |
bool OSInstance::getZeroOrderResults | ( | double * | x, |
double * | objLambda, | ||
double * | conLambda | ||
) |
Calculate function values.
x | is a pointer of doubles of primal values for the current iteration |
objLambda | is is a pointer of doubles of the current dual (Lagrange) multipliers on the objective functions |
conLambda | is a pointer of doubles of the current dual (Lagrange) multipliers on the constraints |
bool OSInstance::getFirstOrderResults | ( | double * | x, |
double * | objLambda, | ||
double * | conLambda | ||
) |
Calculate first derivatives.
x | is a pointer of doubles of primal values for the current iteration |
objLambda | is is a pointer of doubles of the current dual (Lagrange) multipliers on the objective functions |
conLambda | is a pointer of doubles of the current dual (Lagrange) multipliers on the constraints |
bool OSInstance::getSecondOrderResults | ( | double * | x, |
double * | objLambda, | ||
double * | conLambda | ||
) |
Calculate second derivatives.
x | is a pointer of doubles of primal values for the current iteration |
objLambda | is is a pointer of doubles of the current dual (Lagrange) multipliers on the objective functions |
conLambda | is a pointer of doubles of the current dual (Lagrange) multipliers on the constraints |
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.
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
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.
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.
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.