32 #include "OSParameters.h"
515 bool setRandom(
double density,
bool conformant,
int iMin,
int iMax);
592 bool setRandom(
double density,
bool conformant,
int iMin,
int iMax);
649 bool setRandom(
double density,
bool conformant,
int iMin,
int iMax);
707 bool setRandom(
double density,
bool conformant,
int iMin,
int iMax);
773 bool setRandom(
double density,
bool conformant,
int iMin,
int iMax);
846 bool setRandom(
double density,
bool conformant,
int iMin,
int iMax);
937 bool setRandom(
double density,
bool conformant,
int iMin,
int iMax);
1029 bool setRandom(
double density,
bool conformant,
int iMin,
int iMax);
1109 bool setRandom(
double density,
bool conformant,
int iMin,
int iMax);
1167 bool setRandom(
double density,
bool conformant,
int iMin,
int iMax);
1228 bool setRandom(
double density,
bool conformant,
int iMin,
int iMax);
1310 bool setRandom(
double density,
bool conformant,
int iMin,
int iMax);
1386 bool setRandom(
double density,
bool conformant,
int iMin,
int iMax);
1452 bool setRandom(
double density,
bool conformant,
int iMin,
int iMax);
1517 bool setRandom(
double density,
bool conformant,
int iMin,
int iMax);
1564 bool setRandom(
double density,
bool conformant,
int iMin,
int iMax);
1918 bool setRandom(
double density,
bool conformant,
int iMin,
int iMax);
3947 bool addVariable(
int index, std::string name,
double lowerBound,
double upperBound,
char type);
3968 bool setVariables(
int number, std::string* names,
double* lowerBounds,
3969 double* upperBounds,
char* types);
3997 bool addObjective(
int index, std::string name, std::string maxOrMin,
double constant,
double weight,
SparseVector* objectiveCoefficients);
4014 bool setObjectives(
int number, std::string *names, std::string *maxOrMins,
double *constants,
double *weights,
SparseVector **objectitiveCoefficients);
4037 bool addConstraint(
int index, std::string name,
double lowerBound,
double upperBound,
double constant);
4052 bool setConstraints(
int number, std::string* names,
double* lowerBounds,
double* upperBounds,
double* constants);
4073 double*
values,
int valuesBegin,
int valuesEnd,
4074 int* indexes,
int indexesBegin,
int indexesEnd,
4075 int* starts,
int startsBegin,
int startsEnd);
4096 double*
values,
int valuesBegin,
int valuesEnd,
4097 int* indexes,
int indexesBegin,
int indexesEnd,
4098 int* starts,
int startsBegin,
int startsEnd);
4127 int* rowIndexes,
int* varOneIndexes,
int* varTwoIndexes,
4128 double* coefficients,
int begin,
int end);
4145 int* rowIndexes,
int* varOneIndexes,
int* varTwoIndexes,
double* coefficients);
4188 bool addMatrix(
int index, std::string name,
int numberOfRows,
int numberOfColumns,
4190 unsigned int inumberOfChildren,
MatrixNode **m_mChildren);
4228 std::string name,
int numberOfOtherIndexes = 0,
int* otherIndexes = NULL);
4257 std::string name,
int numberOfComponents,
int* components,
4258 int numberOfOtherIndexes = 0,
int* otherIndexes = NULL);
4287 std::string name,
int referenceIdx,
int numberOfOtherIndexes = 0,
int* otherIndexes = NULL);
4315 std::string name, std::string semidefiniteness,
int numberOfOtherIndexes = 0,
int* otherIndexes = NULL);
4344 std::string name,
int distortionMatrixIdx,
double normFactor,
int axisDirection,
4345 int numberOfOtherIndexes = 0,
int* otherIndexes = NULL);
4375 std::string name,
int distortionMatrixIdx,
double normFactor,
int firstAxisDirection,
4376 int secondAxisDirection,
int numberOfOtherIndexes = 0,
int* otherIndexes = NULL);
4405 std::string name,
int distortionMatrixIdx,
double normFactor,
int axisDirection,
double pNorm,
4406 int numberOfOtherIndexes = 0,
int* otherIndexes = NULL);
4439 std::string name,
int maxDegree,
int numberOfUB,
double* ub,
int numberOfLB,
double* lb,
4440 int numberOfOtherIndexes = 0,
int* otherIndexes = NULL);
4502 bool new_x,
int highestOrder);
4535 bool new_x,
int highestOrder);
4568 double *conLambda,
bool new_x,
int highestOrder);
4587 int idx,
bool new_x,
int highestOrder);
4619 bool new_x,
int highestOrder);
4637 int objIdx,
bool new_x,
int highestOrder);
4672 bool new_x,
int highestOrder);
4752 CppAD::ADFun<double> *Fad;
4777 std::vector<double>
forwardAD(
int p, std::vector<double> vdX);
4789 std::vector<double>
reverseAD(
int p, std::vector<double> vdlambda);
4825 bool new_x,
int highestOrder);
bool IsEqual(CopositiveMatricesCone *that)
A function to check for the equality of two objects.
int numberOfExpr
numberOfExpr gives the number of expressions
a data structure for holding quadratic terms
int coneType
The type of the cone (one of the values in ENUM_CONE_TYPE)
double * getConstraintLowerBounds()
Get constraint lower bounds.
bool setTimeDomainStageVariablesOrdered(int numberOfStages, int *numberOfVariables, int *startIdx)
This sets the variables associated with each time domain stage in temporal order. ...
TimeDomain()
The TimeDomain class constructor.
~TimeDomainStageCon()
The TimeDomainStageCon class destructor.
double * getVariableLowerBounds()
Get variable lower bounds.
double * getConstraintUpperBounds()
Get constraint upper bounds.
ENUM_NL_EXPR_SHAPE shape
shape holds the shape of the nonlinear expression (linear/quadratic/convex/general) (see further up i...
ScalarExpressionTree * getNonlinearExpressionTreeMod(int rowIdx)
Get the expression tree for a given row index for the modified expression trees (quadratic terms adde...
~TimeDomainStageVariables()
The TimeDomainStageVariables class destructor.
~TimeDomainStageObjectives()
The TimeDomainStageObjectives class destructor.
MatrixVar ** matrixVar
matrixVar is an array of pointers to the <matrixVar> children
int * getTimeDomainStageNumberOfConstraints()
Get the number of constraints contained in each time stage.
bool IsEqual(Cones *that)
A function to check for the equality of two objects.
int numberOfMatrixCon
numberOfMatrixCon gives the number of <matrixCon> children
bool deepCopyFrom(ProductCone *that)
A function to make a deep copy of an instance of this class.
bool m_bCppADMustReTape
is true if a CppAD Expresion Tree has an expression that can change depending on the value of the inp...
std::string name
name corresponds to the optional attribute that holds the variable name, the default value is empty ...
Constraints * constraints
constraints is a pointer to a Constraints object
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
int getNumberOfIntegerVariables()
getNumberOfIntegerVariables
~TimeDomainStageConstraints()
The TimeDomainStageConstraints class destructor.
bool m_bProcessLinearConstraintCoefficients
-—— data items for linear constraint coefficients -——
bool processConstraints()
process constraints.
int idx
cones are referenced by an (automatically created) index
bool getSparseJacobianFromColumnMajor()
~QuadraticCone()
The QuadraticCone class destructor.
~MatrixObjectives()
The MatrixObjectives class destructor.
virtual std::string getConeInXML()
Write a SemidefiniteCone object in XML format.
char * getVariableTypes()
Get variable initial values.
int idx
cones are referenced by an (automatically created) index
bool m_bProcessMatrices
-—— data items for matrices -——
int getNumberOfMatrixVariables()
Get the number of matrix variables.
int idx
cones are referenced by an (automatically created) index
ENUM_MATRIX_TYPE * m_miMatrixType
m_miMatrixType holds the type of each matrix.
virtual ~Cone()
The Cone class destructor.
bool deepCopyFrom(RotatedQuadraticCone *that)
A function to make a deep copy of an instance of this class.
std::string name
the name of the objective function
bool setConeNumber(int number)
set the number of cones
bool m_bDuplicateExpressionTreesMap
m_bDuplicateExpressionTreeMap is true if m_mapExpressionTrees was duplicated.
This file defines the OSnLNode class along with its derived classes.
bool IsEqual(RotatedQuadraticCone *that)
A function to check for the equality of two objects.
ScalarExpressionTree * getNonlinearExpressionTree(int rowIdx)
Get the expression tree for a given row index.
The in-memory representation of a polyhedral cone.
The in-memory representation of a rotated quadratic cone.
bool addVariable(int index, std::string name, double lowerBound, double upperBound, char type)
add a variable.
~MatrixVariables()
The MatrixVariables class destructor.
virtual std::string getConeInXML()
Write an IntersectionCone object in XML format.
The in-memory representation of the <matrices> element.
std::string name
name corresponds to the optional attribute that holds the name of the stage; the default value is emp...
bool bConstraintsModified
bConstraintsModified is true if the constraints data has been modified.
InstanceData()
The InstanceData class constructor.
~Constraints()
The Constraints class destructor.
a sparse matrix data structure for matrices that can hold nonconstant values
int numberOfColumns
numberOfColumns gives the number of columns of this matrix
bool deepCopyFrom(OrthantCone *that)
A function to make a deep copy of an instance of this class.
bool setRandom(double density, bool conformant, int iMin, int iMax)
A function to make a random instance of this class.
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 t...
The in-memory representation of the <obj> element.
bool IsEqual(Nl *that)
A function to check for the equality of two objects.
bool bAMatrixModified
bAMatrixModified is true if the A matrix data has been modified.
int idx
idx gives the index of this variable
bool addQTermsToExpressionTree()
This method adds quadratic terms into the array of expression trees.
~Variables()
The Variables class destructor.
int getNumberOfRowsForMatrix(int n)
Get the number of rows in the matrix.
bool getIterateResults(double *x, double *objLambda, double *conLambda, bool new_x, int highestOrder)
end revised AD code
int numberOfMatrixVar
numberOfMatrixVar gives the number of <matrixVar> children
int * getTimeDomainStageNumberOfVariables()
Get the number of variables contained in each time stage.
int numberOfOtherIndexes
Multidimensional tensors can also form cones (the Kronecker product, for instance, can be thought of as a four-dimensional tensor).
The in-memory representation of the <matrixObj> element.
LinearConstraintCoefficients()
The LinearConstraintCoefficients class constructor.
IntVector * rowIdx
a pointer of row indices if the problem is stored by column
bool setRandom(double density, bool conformant, int iMin, int iMax)
A function to make a random instance of this class.
double calculateFunctionValue(int idx, double *x, bool new_x)
Calculate the function value for function (constraint or objective) indexed by idx.
~SemidefiniteCone()
The SemidefiniteCone class destructor.
virtual std::string getConeInXML()
Write a NonnegativeCone object in XML format.
int numberOfRows
Every cone has (at least) two dimensions; no distinction is made between vector cones and matrix cone...
int m_iMatrixConNumber
m_iMatrixConNumber holds the number of matrix constraints
int m_iNumberOfStringVariables
m_iNumberOfStringVariables holds the number of string-valued variables.
int m_iConstraintNumber
m_iConstraintNumber is the number of constraints.
bool IsEqual(MatrixVariables *that)
A function to check for the equality of two objects.
int m_iJacValueSize
m_iJacValueSize is the number of nonzero partial derivates in the Jacobian.
bool deepCopyFrom(SemidefiniteCone *that)
A function to make a deep copy of an instance of this class.
virtual std::string getConeName()
std::string * m_msVariableNames
m_msVariableNames holds an array of variable names.
bool bUseExpTreeForFunEval
bUseExpTreeForFunEval is set to true if you wish to use the OS Expression Tree for function evaluatio...
int ubConeIdx
ubConeIdx gives a cone that must contain ubMatrix - matrixCon
int getNumberOfElementConstructors(int n)
NonlinearExpressions * nonlinearExpressions
nonlinearExpressions is a pointer to a NonlinearExpressions object
int orderConeIdx
orderConeIdx gives a cone that expresses preferences during the optimization x is (weakly) preferred ...
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
bool setTimeDomainStageObjectivesOrdered(int numberOfStages, int *numberOfObjectives, int *startIdx)
This sets the objectives associated with each time domain stage in temporal order.
Variable()
The Variable class constructor.
bool IsEqual(Objectives *that)
A function to check for the equality of two objects.
int getVariableNumber()
Get number of variables.
MatrixExpression ** expr
a pointer to an array of linear and nonlinear expressions that evaluate to matrices ...
std::vector< double > m_vdw
m_vdYval is a vector of derivatives – output from a reverse sweep
std::string printModel()
Print the infix representation of the problem.
double * m_mdObjectiveConstants
m_mdObjectiveConstants holds an array of objective constants (default = 0.0).
bool m_bLagrangianSparseHessianCreated
m_bLagrangianSparseHessianCreated is true if the sparse Hessian Matrix for the Lagrangian was created...
bool setTimeDomainStageVariablesUnordered(int numberOfStages, int *numberOfVariables, int **varIndex)
This sets the variables associated with each time domain stage in srbitrary order.
SparseHessianMatrix * m_LagrangianSparseHessian
m_LagrangianSparseHessian is the Hessian Matrix of the Lagrangian function in sparse format ...
bool deepCopyFrom(CompletelyPositiveMatricesCone *that)
A function to make a deep copy of an instance of this class.
int numberOfMatrixObj
numberOfMatrixObj gives the number of <matrixObj> children
TimeDomain * timeDomain
timeDomain is a pointer to a TimeDomain object
GeneralSparseMatrix * getMatrixCoefficientsInRowMajor(int n)
Get the (nonzero) elements of the matrix in row major form.
bool setRandom(double density, bool conformant, int iMin, int iMax)
A function to make a random instance of this class.
int idx
idx gives the index of this variable
std::string name
The cone can have a name for easier identification.
int getNumberOfSemiContinuousVariables()
getNumberOfSemiContinuousVariables
ENUM_MATRIX_TYPE
An enum to track the many different types of values that a matrix can contain Note that these types a...
OrthantCone()
default constructor.
int ** m_mmiTimeDomainStageVarList
m_mmiTimeDomainStageVarList holds the list of variables in each stage.
int idx
cones are referenced by an (automatically created) index
int referenceMatrixIdx
Polyhedral cones use a reference to a previously defined matrix for the extreme rays.
IntVector * factors
the list of "factors" contributing to the product each factor contains a reference to a previously de...
bool setRandom(double density, bool conformant, int iMin, int iMax)
A function to make a random instance of this class.
std::string m_sInstanceDescription
m_sInstanceDescription holds the instance description.
bool setObjectives(int number, std::string *names, std::string *maxOrMins, double *constants, double *weights, SparseVector **objectitiveCoefficients)
set all the objectives related elements.
SparseHessianMatrix * calculateHessian(double *x, int idx, bool new_x)
Calculate the Hessian of a constraint or objective function.
CompletelyPositiveMatricesCone()
default constructor.
bool m_bProcessQuadraticTerms
m_bProcessQuadraticTerms holds whether the quadratic terms are processed.
bool IsEqual(Constraints *that)
A function to check for the equality of two objects.
virtual std::string getConeName()
The in-memory representation of the <matrixProgramming> element.
TimeDomainStageObj ** obj
obj is a pointer to an array of TimeDomainStageObj object pointers
int numberOfRows
Every cone has (at least) two dimensions; no distinction is made between vector cones and matrix cone...
bool IsEqual(Objective *that)
A function to check for the equality of two objects.
int getLinearConstraintCoefficientNumber()
Get number of specified (usually nonzero) linear constraint coefficient values.
virtual std::string getConeName()
std::string getMatrixName(int n)
Get the name of the matrix.
int * getNonlinearExpressionTreeModIndexes()
Get all the nonlinear expression tree indexes, i.e., indexes of rows (objectives or constraints) that...
ENUM_MATRIX_SYMMETRY * m_miMatrixSymmetry
m_miMatrixSymmetry holds the symmetry property of each matrix.
IntVector * colIdx
a pointer of column indices if the problem is stored by row
std::string maxOrMin
declare the objective function to be a max or a min
~TimeDomainInterval()
The Interval class destructor.
std::string name
an optional name to this matrixObj
QuadraticCoefficients()
The QuadraticCoefficients class constructor.
bool setRandom(double density, bool conformant, int iMin, int iMax)
A function to make a random instance of this class.
The in-memory representation of the <linearConstraintCoefficients> element.
SparseVector ** getObjectiveCoefficients()
Get objective coefficients.
TimeDomainStageConstraints()
The TimeDomainStageConstraints class constructor.
bool getFirstOrderResults(double *x, double *objLambda, double *conLambda)
Calculate first derivatives.
ObjCoef ** coef
coef is pointer to an array of ObjCoef object pointers
ENUM_CONE_TYPE coneType
The type of the cone.
bool setQuadraticTermsInNonlinearExpressions(int number, int *rowIndexes, int *varOneIndexes, int *varTwoIndexes, double *coefficients)
set quadratic terms in nonlinearExpressions
bool m_bSparseJacobianCalculated
m_bSparseJacobianCalculated is true if getJacobianSparsityPattern() has been called.
bool m_bProcessObjectives
-—— data items for Objectives -——
~MatrixObj()
The MatrixVar class destructor.
The in-memory representation of the objective function <coef> element.
MatrixCon ** matrixCon
matrixCon is an array of pointers to the <matrixCon> children
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.
int idxTwo
idxTwo is the index of the second variable in the quadratic term
QuadraticTerm ** qTerm
qTerm is a pointer to an array of QuadraticTerm object pointers
Constraint ** con
con is pointer to an array of Constraint object pointers
bool IsEqual(MatrixExpressions *that)
A function to check for the equality of two objects.
bool m_bProcessExpressionTrees
m_bProcessExpressionTrees is true if the expression trees have been processed.
MatrixConstraints * matrixConstraints
a pointer to the matrixConstraints object
bool matrixHasBlocks(int n)
int * getNonlinearExpressionTreeIndexes()
Get all the nonlinear expression tree indexes, i.e., indexes of rows (objectives or constraints) that...
MatrixVar()
The MatrixVar class constructor.
SparseJacobianMatrix * calculateAllConstraintFunctionGradients(double *x, double *objLambda, double *conLambda, bool new_x, int highestOrder)
Calculate the gradient of all constraint functions.
int numberOfOtherIndexes
Multidimensional tensors can also form cones (the Kronecker product, for instance, can be thought of as a four-dimensional tensor).
double * m_mdConstraintConstants
m_mdConstraintConstants holds an array of constraint constants (default = 0.0).
TimeDomainStageVariables * variables
variables is a pointer to a TimeDomainVariables object
std::string m_sInstanceSource
m_sInstanceSource holds the instance source.
bool IsEqual(NonlinearExpressions *that)
A function to check for the equality of two objects.
~PolyhedralCone()
The PolyhedralCone class destructor.
MatrixCon()
The MatrixCon class constructor.
TimeDomainInterval()
The Interval class constructor.
int numberOfConstraints
numberOfConstraints gives the number of constraints contained in this stage
bool setRandom(double density, bool conformant, int iMin, int iMax)
A function to make a random instance of this class.
bool IsEqual(OSInstance *that)
A function to check for the equality of two objects.
TimeDomainStageCon ** con
con is a pointer to an array of TimeDomainStageCon object pointers
Cone()
The Cone class constructor.
std::string getMatrixExpressionTreeInInfix(int rowIdx)
Get the infix representation for a given row (or objective function) index.
~Cones()
The Cones class destructor.
ObjCoef()
The ObjCoef class constructor.
std::vector< ExprNode * > getNonlinearExpressionTreeModInPrefix(int rowIdx)
Get the prefix tokens for a given row index for the modified Expression Tree (quadratic terms added)...
TimeDomainStageObjectives()
The TimeDomainStageObjectives class constructor.
The in-memory representation of a generic cone Specific cone types are derived from this generic clas...
double * m_mdConstraintUpperBounds
m_mdConstraintUpperBounds holds an array of constraint upper bounds (default = INF).
bool IsEqual(ObjCoef *that)
A function to check for the equality of two objects.
int numberOfRows
Every cone has (at least) two dimensions; no distinction is made between vector cones and matrix cone...
std::vector< double > m_vdDomainUnitVec
m_vdDomainUnitVec is a unit vector in the domain space
int idx
cones are referenced by an (automatically created) index
MatrixExpression ** getMatrixExpressions()
Get the pointers to the roots of all matrix expression trees.
void duplicateExpressionTreesMap()
duplicate the map of expression trees.
int getNumberOfNonlinearExpressionTreeModIndexes()
Get the number of unique nonlinear expression tree indexes after modifying the expression tree to con...
The OSnLMNode Class for nonlinear expressions involving matrices.
int numberOfRows
numberOfRows gives the number of rows of this matrix
Variables()
The Variables class constructor.
~ObjCoef()
The ObjCoef class destructor.
bool IsEqual(NonnegativeCone *that)
A function to check for the equality of two objects.
std::string * m_msMaxOrMins
m_msMaxOrMins holds a std::string array of objective maxOrMins ("max" or "min").
a generic class from which we derive matrix constructors (BaseMatrix, MatrixElements, MatrixTransformation and MatrixBlocks) as well as matrix types (OSMatrix and MatrixBlock).
The in-memory representation of the element.
int getObjectiveNumber()
Get number of objectives.
char type
type corresponds to the attribute that holds the variable type: C (Continuous), B (binary)...
int m_iVariableNumber
m_iVariableNumber holds the variable number.
bool m_bNonlinearExpressionTreeIndexesProcessed
m_bNonlinearExpressionTreeIndexesProcessed is true if getNonlinearExpressionTreeIndexes() has been ca...
bool IsEqual(MatrixExpression *that)
A function to check for the equality of two objects.
QuadraticCone()
The QuadraticCone class constructor.
int numberOfVariables
numberOfVariables is the number of variables in the instance
int lbConeIdx
lbConeIdx gives a cone that must contain matrixCon - lbMatrix
int m_iObjectiveNumberNonlinear
m_iObjectiveNumber is the number of objective functions with a nonlinear term.
The in-memory representation of the <instanceData> element.
bool IsEqual(QuadraticCoefficients *that)
A function to check for the equality of two objects.
bool IsEqual(SemidefiniteCone *that)
A function to check for the equality of two objects.
std::map< int, int > getAllNonlinearVariablesIndexMap()
~Objective()
The Objective class destructor.
std::string * getVariableNames()
Get variable names.
bool IsEqual(MatrixVar *that)
A function to check for the equality of two objects.
~OSInstance()
The OSInstance class destructor.
ENUM_NL_EXPR_SHAPE shape
shape holds the shape of the nonlinear expression (linear/quadratic/convex/general) (see further up i...
int coneType
The type of the cone (one of the values in ENUM_CONE_TYPE)
std::map< int, ScalarExpressionTree * > m_mapExpressionTreesMod
m_mapExpressionTreesMod holds a map of expression trees, with the key being the row index and value b...
virtual std::string getConeInXML()
Write a CopositiveMatricesCone object in XML format.
bool m_bProcessConstraints
-—— data items for Constraints -——
The in-memory representation of the <constraints> child of the <stage> element.
std::map< int, ScalarExpressionTree * > m_mapExpressionTrees
m_mapExpressionTrees holds a hash map of scalar-valued expression tree pointers.
int getNumberOfNonlinearExpressions()
Get number of nonlinear expressions.
std::vector< double > m_vdX
-—— data vectors for nonlinear optimization -——
int numberOfRows
Every cone has (at least) two dimensions; no distinction is made between vector cones and matrix cone...
int ** m_mmiTimeDomainStageObjList
m_mmiTimeDomainStageObjList holds the list of objectives in each stage.
int * m_miJacNumConTerms
m_miJacNumConTerms holds a int array of the number of constant terms (gradient does not change) for t...
int getNumberOfMatrixExpressionTreeIndexes()
Get the number of unique matrix expression tree indexes.
double lb
lb is the lower bound on the constraint
bool setRandom(double density, bool conformant, int iMin, int iMax)
A function to make a random instance of this class.
bool deepCopyFrom(PolyhedralCone *that)
A function to make a deep copy of an instance of this class.
bool IsEqual(IntersectionCone *that)
A function to check for the equality of two objects.
The in-memory representation of the <constraints> element.
int numberOfObjectives
numberOfObjectives is the number of objective functions in the instance
bool getZeroOrderResults(double *x, double *objLambda, double *conLambda)
Calculate function values.
double ** m_mmdObjGradient
m_mdObjGradient holds an array of pointers, each pointer points to gradient of one objective function...
int ** m_mmiTimeDomainStageConList
m_mmiTimeDomainStageConList holds the list of constraints in each stage.
int numberOfRows
Every cone has (at least) two dimensions; no distinction is made between vector cones and matrix cone...
NonlinearExpressions()
The NonlinearExpressions class constructor.
std::string * m_msTimeDomainStageNames
m_msTimeDomainStageNames holds the names of the time stages.
int * m_miNonlinearExpressionTreeIndexes
m_miNonlinearExpressionTreeIndexes is an integer pointer to the distinct rows indexes in the nonlinea...
std::vector< double > m_vdLambda
m_vdYval is a vector of Lagrange multipliers
int numberOfObjectives
numberOfObjectives gives the number of objectives contained in this stage
bool IsEqual(NonpositiveCone *that)
A function to check for the equality of two objects.
std::map< int, int > m_mapAllNonlinearVariablesIndex
m_mapAllNonlinearVariablesIndexMap is a map of the variables in the Lagrangian function ...
std::string m_sInstanceLicence
m_sInstanceDescription holds the instance fileCreator info.
bool setTimeDomainStages(int number, std::string *names)
This sets the number (and optionally names) of the time stages.
int referenceConeIdx
Polar cones use a reference to another, previously defined cone.
TimeDomainStageVar()
The TimeDomainStageVar class constructor.
bool setRandom(double density, bool conformant, int iMin, int iMax)
A function to make a random instance of this class.
int * m_miTimeDomainStageObjectiveNumber
m_miTimeDomainStageObjectiveNumber holds the number of objectives in each stage.
IntVector * start
a pointer to the start of each row or column stored in sparse format
ProductCone()
The ProductCone class constructor.
double * getObjectiveWeights()
Get objective weights.
int idx
cones are referenced by an (automatically created) index
double ub
ub is the upper bound on the constraint
~LinearConstraintCoefficients()
The LinearConstraintCoefficients class destructor.
bool setTimeDomainStageConstraintsUnordered(int numberOfStages, int *numberOfConstraints, int **conIndex)
This sets the constraints associated with each time domain stage in srbitrary order.
double * m_mdJacValue
m_mdJacValue holds a double array of partial derivatives for the Jacobian matrix in sparse form (row ...
~MatrixVar()
The MatrixVar class destructor.
virtual std::string getConeName()
int getNumberOfStringVariables()
getNumberOfStringVariables
bool setInstanceName(std::string name)
set the instance name.
The in-memory representation of an intersection cone.
OSInstance()
The OSInstance class constructor.
virtual std::string getConeName()
int idx
cones are referenced by an (automatically created) index
TimeDomainStages * stages
stages is a pointer to a Stages object
MatrixObjectives * matrixObjectives
a pointer to the matrixObjectives object
int m_iMatrixExpressionNumber
m_iMatrixExpressionNumber holds the number of matrix expressions
bool setRandom(double density, bool conformant, int iMin, int iMax)
A function to make a random instance of this class.
double ** getDenseObjectiveCoefficients()
getDenseObjectiveCoefficients.
bool initObjGradients()
This should be called by initForAlgDiff()
OSMatrix ** m_mMatrix
m_mMatrix holds the list of constructors for each matrix.
The in-memory representation of the <nonlinearExpressions> element.
virtual std::string getConeName()
virtual std::string getConeName()
int m_iHighestTaylorCoeffOrder
m_iHighestTaylorCoeffOrder is the order of highest calculated Taylor coefficient
PolyhedralCone()
The PolyhedralCone class constructor.
double normScaleFactor
quadratic cones normally are of the form x0 >= x1^2 + x2^2 + ...
bool IsEqual(MatrixProgramming *that)
A function to check for the equality of two objects.
bool getSecondOrderResults(double *x, double *objLambda, double *conLambda)
Calculate second derivatives.
SparseJacobianMatrix * getJacobianSparsityPattern()
Used to hold part of the instance in memory.
std::map< int, MatrixExpressionTree * > getAllMatrixExpressionTrees()
double getTimeDomainIntervalStart()
Get the start for the time domain interval.
~CompletelyPositiveMatricesCone()
default destructor.
int * m_miJacStart
m_miJacStart holds a int array of starts for the Jacobian matrix in sparse form (row major)...
int * m_miNonlinearExpressionIndexes
m_miNonlinearExpressionIndexes holds an integer array of nonlinear expression indexes, negative indexes correspond to objectives.
bool matrixHasBase(int n)
Several tools to parse the constructor list of a matrix.
int numberOfVariables
numberOfVariables gives the number of variables contained in this stage
bool bObjectivesModified
bObjectivesModified is true if the objective function data has been modified.
CopositiveMatricesCone()
default constructor.
bool deepCopyFrom(QuadraticCone *that)
A function to make a deep copy of an instance of this class.
std::string * m_msObjectiveNames
m_msObjectiveNames holds an array of objective names.
int * m_miTimeDomainStageVariableNumber
m_miTimeDomainStageVariableNumber holds the number of variables in each stage.
bool setRandom(double density, bool conformant, int iMin, int iMax)
A function to make a random instance of this class.
TimeDomainStage ** stage
stage is pointer to an array of stage object pointers
bool setMatrixNumber(int number)
set the number of matrices
double * m_mdConstraintFunctionValues
m_mdConstraintFunctionValues holds a double array of constraint function values – the size of the arr...
bool IsEqual(ProductCone *that)
A function to check for the equality of two objects.
virtual std::string getConeName()
int getNumberOfNonlinearConstraints()
double normScaleFactor
rotated quadratic cones normally are of the form x0x1 >= x2^2 + x3^2 + ...
The in-memory representation of the <matrixCon> element.
double * m_mdConstraintLowerBounds
m_mdConstraintLowerBounds holds an array of constraint lower bounds (default = -INF).
bool IsEqual(CompletelyPositiveMatricesCone *that)
A function to check for the equality of two objects.
int m_iObjectiveNumber
m_iObjectiveNumber is the number of objective functions.
bool setInstanceCreator(std::string fileCreator)
set the instance creator.
double weight
weight is the weight applied to the given objective function, 1.0 by default
bool setConstraintNumber(int number)
set the number of constraints.
std::string name
an optional name to this matrixVar
a double vector data structure
bool m_bNonlinearExpressionTreeModIndexesProcessed
m_bNonlinearExpressionTreeModIndexesProcessed is true if getNonlinearExpressionTreeModIndexes has bee...
MatrixObj()
The MatrixVar class constructor.
The in-memory representation of the <obj> element.
bool deepCopyFrom(Matrices *that)
A function to make a deep copy of an instance of this class.
MatrixExpressions()
The MatrixExpressions class constructor.
int * getMatrixExpressionTreeIndexes()
Get all the matrix expression tree indexes, i.e.
~InstanceData()
The InstanceData class destructor.
Nl ** nl
nl is pointer to an array of Nl object pointers
bool IsEqual(Variables *that)
A function to check for the equality of two objects.
std::string name
an optional name to this MatrixCon
bool IsEqual(DualCone *that)
A function to check for the equality of two objects.
virtual std::string getConeName()
DoubleVector * value
a pointer to the array of nonzero values being stored
MatrixProgramming()
The MatrixProgramming class constructor.
std::string * m_msMatrixNames
m_msMatrixNames holds the names of the matrices
double * calculateAllConstraintFunctionValues(double *x, double *objLambda, double *conLambda, bool new_x, int highestOrder)
Calculate all of the constraint function values.
The in-memory representation of the <objectives> element.
int constantMatrixIdx
constantMatrixIdx gives a constant added to the matrixObj
Nl ** getNonlinearExpressions()
Get the pointers to the roots of all expression trees.
double lb
lb corresponds to the optional attribute that holds the variable lower bound.
double horizon
horizon is the end of the planning period in the <interval> element.
std::map< int, MatrixExpressionTree * > m_mapMatrixExpressionTrees
m_mapMatrixExpressionTrees holds a hash map of matrix-valued expression tree pointers.
a sparse matrix data structure
double ** calculateAllObjectiveFunctionGradients(double *x, double *objLambda, double *conLambda, bool new_x, int highestOrder)
Calculate the gradient of all objective functions.
double constant
constant is the constant term added to the objective function, 0 by default
int lbMatrixIdx
lbMatrixIdx gives a lower bound for this matrixVar
int m_iConstraintNumberNonlinear
m_iConstraintNumberNonlinear is the number of constraints that have a nonlinear term.
PolarCone()
The PolarCone class constructor.
char * getConstraintTypes()
Get constraint types.
int numberOfRows
Every cone has (at least) two dimensions; no distinction is made between vector cones and matrix cone...
int coneType
The type of the cone (one of the values in ENUM_CONE_TYPE)
Variable ** var
Here we define a pointer to an array of var pointers.
std::vector< double > m_vdRangeUnitVec
m_vdRangeUnitVec is a unit vector in the range space
int lbConeIdx
lbConeIdx gives a cone that must contain matrixVar - lbMatrix
int numberOfOtherIndexes
Multidimensional tensors can also form cones (the Kronecker product, for instance, can be thought of as a four-dimensional tensor).
int numberOfColumns
numberOfColumns gives the number of columns of this matrix
virtual std::string getConeInXML()
Write a NonpositiveCone object in XML format.
bool setRandom(double density, bool conformant, int iMin, int iMax)
A function to make a random instance of this class.
bool IsEqual(Constraint *that)
A function to check for the equality of two objects.
bool IsEqual(Matrices *that)
A function to check for the equality of two objects.
~MatrixCon()
The MatrixCon class destructor.
~ProductCone()
The ProductCone class destructor.
int m_iMatrixVarNumber
-—— data items for matrix programming -——
bool m_bProcessExpressionTreesMod
m_bProcessExpressionTreesMod is true if the modified expression trees have been processed.
bool IsEqual(QuadraticTerm *that)
A function to check for the equality of two objects.
double start
start is the start of the planning period in the <interval> element.
The in-memory representation of the <matrixVariables> element.
double * m_mdVariableUpperBounds
m_mdVariableUpperBounds holds a double array of variable upper bounds (default = INF).
The in-memory representation of a dual cone.
bool IsEqual(PolyhedralCone *that)
A function to check for the equality of two objects.
int m_iNumberOfIntegerVariables
m_iNumberOfIntegerVariables holds the number of integer variables.
bool m_bProcessTimeInterval
m_bProcessTimeInterval holds whether a time interval has been processed.
SparseMatrix * getLinearConstraintCoefficientsInRowMajor()
Get linear constraint coefficients in row major.
bool m_bCppADTapesBuilt
is true if a CppAD Expresion Tree has been built for each row and objective with a nonlinear expressi...
double * ub
For each dimension of the cone, give the upper and lower bounds The upper bound can be only zero or +...
int getNumberOfMatrixObjectives()
Get the number of matrix objectives.
The in-memory representation of a quadratic cone.
double * m_mdObjectiveWeights
m_mdObjectiveWeights holds an array of objective weights (default = 1.0).
MatrixExpressions * matrixExpressions
a pointer to the matrixExpressions object
bool deepCopyFrom(NonpositiveCone *that)
A function to make a deep copy of an instance of this class.
virtual std::string getConeName()
bool IsEqual(MatrixConstraints *that)
A function to check for the equality of two objects.
Cones()
The Cones class constructor.
virtual std::string getConeInXML()
Write a CompletelyPositiveMatricesCone object in XML format.
bool deepCopyFrom(NonnegativeCone *that)
A function to make a deep copy of an instance of this class.
double value
value is the value of the objective function coefficient corresponding to the variable with index idx...
The in-memory representation of the <quadraticCoefficients> element.
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.
The in-memory representation of the <stages> element.
SparseHessianMatrix * getLagrangianHessianSparsityPattern()
bool setObjectiveNumber(int number)
set the number of objectives.
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 t...
bool m_bAllNonlinearVariablesIndex
m_bAllNonlinearVariablesIndexMap is true if the map of the variables in the Lagrangian function has b...
bool deepCopyFrom(Cones *that)
A function to make a deep copy of an instance of this class.
bool setNonlinearExpressions(int nexpr, Nl **root)
set nonlinear expressions
int idxOne
idxOne is the index of the first variable in the quadratic term
Objective()
The Objective class constructor.
ENUM_MATRIX_SYMMETRY getMatrixSymmetry(int n)
Get the matrix symmetry.
bool setTimeDomainStageObjectivesUnordered(int numberOfStages, int *numberOfObjectives, int **varIndex)
This sets the objectives associated with each time domain stage in arbitrary order.
GeneralSparseMatrix * getMatrixCoefficientsInColumnMajor(int n)
Get the (nonzero) elements of the matrix in column major form.
bool m_bProcessTimeDomain
-—— data items for time domain -——
SparseVector ** m_mObjectiveCoefficients
m_mObjectiveCoefficients holds an array of objective coefficients, one set of objective coefficients ...
bool m_bQuadraticRowIndexesProcessed
m_bQuadraticRowIndexesProcessed is true if getQuadraticRowIndexes() has been called.
int numberOfValues
numberOfValues is the number of nonzero elements stored in the <linearConstraintCoefficients> element...
bool addConstraint(int index, std::string name, double lowerBound, double upperBound, double constant)
add a constraint.
Constraints()
The Constraints class constructor.
MatrixObj ** matrixObj
matrixObj is an array of pointers to the <matrixObj> children
bool m_bFiniteTimeStages
m_bFiniteTimeStages holds whether the time domain has the form of finite (discrete) stages...
TimeDomainStageCon()
The TimeDomainStageCon class constructor.
bool addObjective(int index, std::string name, std::string maxOrMin, double constant, double weight, SparseVector *objectiveCoefficients)
add an objective.
int ubMatrixIdx
ubMatrixIdx gives an upper bound for this matrixCon
int * m_miNonLinearVarsReverseMap
m_miNonLinearVarsReverseMap maps the nonlinear variable number back into the original variable space ...
int firstAxisDirection
The indices of the first two component can be changed Since there are possibly many dimensions...
int m_iNumberOfTimeStages
m_iNumberOfTimeStages holds the number of discrete stages
virtual std::string getConeInXML()
Write a QuadraticCone object in XML format.
~Matrices()
The Matrices class destructor.
bool setTimeDomain(std::string format)
This sets the format of the time domain ("stages"/"interval"/"none")
std::string * getObjectiveMaxOrMins()
Get objective maxOrMins.
bool setTimeDomainStageConstraintsOrdered(int numberOfStages, int *numberOfConstraints, int *startIdx)
This sets the constraints associated with each time domain stage in temporal order.
bool IsEqual(OrthantCone *that)
A function to check for the equality of two objects.
int * m_miNumberOfObjCoef
m_miNumberOfObjCoef holds an integer array of number of objective coefficients (default = 0)...
double ub
ub corresponds to the optional attribute that holds the variable upper bound.
int idx
idx gives the index of this constraint
a sparse vector data structure
Variables * variables
variables is a pointer to a Variables object
int numberOfOtherIndexes
Multidimensional tensors can also form cones (the Kronecker product, for instance, can be thought of as a four-dimensional tensor).
TimeDomainStage()
The TimeDomainStage class constructor.
~NonnegativeCone()
default destructor.
virtual std::string getConeInXML()=0
Write a Cone object in XML format.
ScalarExpressionTree * m_LagrangianExpTree
m_LagrangianExpTree is an ScalarExpressionTree object that is the expression tree for the Lagrangian ...
MatrixVariables * matrixVariables
a pointer to the matrixVariables object
ScalarExpressionTree * getLagrangianExpTree()
SparseMatrix * getLinearConstraintCoefficientsInColumnMajor()
Get linear constraint coefficients in column major.
MatrixExpressionTree * getMatrixExpressionTree(int rowIdx)
Get the matrix expression tree for a given row index.
int getTimeDomainStageNumber()
Get the number of stages that make up the time domain.
int numberOfOtherIndexes
Multidimensional tensors can also form cones (the Kronecker product, for instance, can be thought of as a four-dimensional tensor).
The in-memory representation of the <timeDomain> element.
bool IsEqual(MatrixCon *that)
A function to check for the equality of two objects.
int getMatrixNumber()
Get the number of matrices.
The in-memory representation of the <con> element.
virtual std::string getConeInXML()
Write an OrthantCone object in XML format.
int m_iLinearConstraintCoefficientNumber
m_iLinearConstraintCoefficientNumber holds the number of specified (usually nonzero) linear constrain...
bool setVariables(int number, std::string *names, double *lowerBounds, double *upperBounds, char *types)
set all the variable related elements.
~QuadraticCoefficients()
The QuadraticCoefficients class destructor.
NonpositiveCone()
default constructor.
int templateMatrixIdx
templateMatrixIdx refers to a matrix that describes the locations in this matrixVar that are allowed ...
~DualCone()
The DualCone class destructor.
double * getConstraintConstants()
Get constraint constants.
GeneralFileHeader * instanceHeader
the instanceHeader is implemented as a general file header object to allow sharing of classes between...
MatrixExpressionTree * matrixExpressionTree
matrixExpressionTree contains the root of the MatrixExpressionTree
The in-memory representation of the <matrixObjectives> element.
IntersectionCone()
The IntersectionCone class constructor.
double * getObjectiveConstants()
Get objective constants.
int numberOfConstraints
numberOfConstraints is the number of constraints in the instance
SemidefiniteCone()
The SemidefiniteCone class constructor.
~TimeDomainStageObj()
The TimeDomainStageObj class destructor.
MatrixObjectives()
The MatrixObjectives class constructor.
int m_iHighestOrderEvaluated
m_iHighestOrderEvaluated is the highest order derivative of the current iterate
int varReferenceMatrixIdx
varReferenceMatrixIdx allows some or all of the components of this matrix variable to be copied from ...
int startIdx
startdIdx gives the number of the first variable contained in this stage
int numberOfRows
Every cone has (at least) two dimensions; no distinction is made between vector cones and matrix cone...
a sparse Jacobian matrix data structure
std::string getInstanceName()
Get instance name.
int numberOfOtherIndexes
Multidimensional tensors can also form cones (the Kronecker product, for instance, can be thought of as a four-dimensional tensor).
bool m_bProcessVariables
-—— data items for Variables -——
int numberOfRows
numberOfRows gives the number of rows of this matrix
int getADSparsityHessian()
end revised AD code
InstanceData * instanceData
A pointer to an InstanceData object.
ENUM_MATRIX_TYPE getMatrixType(int n)
Get the matrix type.
int m_iQuadraticTermNumber
m_iQuadraticTermNumber holds the number of specified (usually nonzero) qTerms in the quadratic coeffi...
int numberOfRows
Every cone has (at least) two dimensions; no distinction is made between vector cones and matrix cone...
Matrices()
The Matrices class constructor.
virtual std::string getConeInXML()
Write a PolyhedralCone object in XML format.
DualCone()
The DualCone class constructor.
GeneralSparseMatrix * getMatrixBlockInColumnMajorForm(int n, int columnIdx, int rowIdx)
Get the (nonzero) elements of the matrix in symmetric block form.
int idx
cones are referenced by an (automatically created) index
int startIdx
startdIdx gives the number of the first constraint contained in this stage
bool addQTermsToExressionTree()
The in-memory representation of the <nl> element.
int ** getTimeDomainStageConList()
Get the list of constraints in each stage.
int m_iNumberOfSemiIntegerVariables
m_iNumberOfSemiIntegerVariables holds the number of semi-integer variables.
bool matrixHasElements(int n)
virtual std::string getConeName()
int * m_miMatrixNumberOfRows
m_miMatrixNumberOfRows holds the number of rows for each matrix.
int m_iNumberOfSemiContinuousVariables
m_iNumberOfSemiContinuousVariables holds the number of semi-continuous variables. ...
an integer Vector data structure
MatrixVariables()
The MatrixVariables class constructor.
int idx
idx holds the row index of the nonlinear expression
std::vector< double > m_vdYval
m_vdYval is a vector of function values
bool processVariables()
process variables.
char * m_mcConstraintTypes
m_mcConstraintTypes holds a char array of constraint types (R for range; L for <=; G for >=; E for =;...
~MatrixConstraints()
The MatrixConstraints class destructor.
std::string * getObjectiveNames()
Get objective names.
int numberOfRows
Every cone has (at least) two dimensions; no distinction is made between vector cones and matrix cone...
double ** m_mmdDenseObjectiveCoefficients
m_mmdDenseObjectiveCoefficients holds an array of pointers, each pointer points to a vector of dense ...
int m_iNonlinearExpressionNumber
m_iNonlinearExpressionNumber holds the number of nonlinear expressions.
int getConstraintNumber()
Get number of constraints.
Objective ** obj
coef is pointer to an array of ObjCoef object pointers
bool getLinearConstraintCoefficientMajor()
Get whether the constraint coefficients is in column major (true) or row major (false).
int startIdx
startdIdx gives the number of the first objective contained in this stage
int axisDirection
The index of the first component can be changed Since there are possibly many dimensions, the index is coded as i0*n1*n2*...
double getTimeDomainIntervalHorizon()
Get the horizon for the time domain interval.
int idx
cones are referenced by an (automatically created) index
bool setInstanceSource(std::string source)
set the instance source.
Matrices * matrices
matrices is a pointer to a Matrices object
double * m_mdVariableLowerBounds
m_mdVariableLowerBounds holds a double array of variable lower bounds (default = 0.0).
bool IsEqual(Variable *that)
A function to check for the equality of two objects.
~MatrixExpression()
The MatrixExpression class destructor.
int getNumberOfQuadraticRowIndexes()
Get the number of rows which have a quadratic term.
std::string * getTimeDomainStageNames()
Get the names of the stages (NULL or empty string ("") if a stage has not been given a name...
std::string semidefiniteness
we need to distinguish positive and negative semidefiniteness
bool setInstanceDescription(std::string description)
set the instance description.
The CompletelyPositiveMatricesCone Class.
bool m_bProcessNonlinearExpressions
m_bProcessNonlinearExpressions holds whether the nonlinear expressions are processed.
bool deepCopyFrom(IntersectionCone *that)
A function to make a deep copy of an instance of this class.
bool setRandom(double density, bool conformant, int iMin, int iMax)
A function to make a random instance of this class.
bool IsEqual(LinearConstraintCoefficients *that)
A function to check for the equality of two objects.
double coef
coef is the coefficient of the quadratic term
int numberOfColumns
numberOfColumns gives the number of columns of this matrix
int getNumberOfQuadraticTerms()
Get the number of specified (usually nonzero) qTerms in the quadratic coefficients.
~TimeDomainStageVar()
The TimeDomainStageVar class destructor.
bool IsEqual(Cone *that)
A function to check for the equality of two objects.
int * m_miTimeDomainStageConstraintNumber
m_miTimeDomainStageConstraintNumber holds the number of constraints in each stage.
bool m_bDeleteExpressionTree
m_bDeleteExpressionTree is true, if in garbage collection, we should delete the osExpression tree obj...
TimeDomainStageConstraints * constraints
constraints is a pointer to a TimeDomainConstraints object
The CopositiveMatricesCone Class.
The in-memory representation of the <variables> child of the <stage> element.
bool m_bProcessTimeStages
m_bProcessTimeStages holds whether the time stages have been processed.
bool deepCopyFrom(CopositiveMatricesCone *that)
A function to make a deep copy of an instance of this class.
int templateMatrixIdx
templateMatrixIdx refers to a matrix that describes the locations in this matrixObj that are allowed ...
QuadraticTerms * m_quadraticTerms
m_quadraticTerms holds the data structure for all the quadratic terms in the instance.
int getNumberOfMatrixExpressions()
Get the number of matrix-valued expressions.
The in-memory representation of a cone of semidefinite matrices.
NonnegativeCone()
default constructor.
int ubMatrixIdx
ubMatrixIdx gives an upper bound for this matrixVar
Objectives * objectives
objectives is a pointer to a Objectives object
TimeDomainStageVar ** var
var is a pointer to an array of TimeDomainStageVar object pointers
~CopositiveMatricesCone()
default destructor.
~QuadraticTerm()
The QuadraticTerm class destructor.
The in-memory representation of the <stage> element.
The in-memory representation of a polar cone.
The in-memory representation of the <matrixVar> element.
std::vector< ExprNode * > getNonlinearExpressionTreeInPrefix(int rowIdx)
Get the prefix tokens for a given row index.
std::string getInstanceSource()
Get instance source.
int m_iMatrixObjNumber
m_iMatrixObjNumber holds the number of matrix objectives
int getNumberOfTransformationConstructors(int n)
bool initForAlgDiff()
This should be called by nonlinear solvers using callback functions.
int ** getTimeDomainStageObjList()
Get the list of objectives in each stage.
The in-memory representation of the <cones> element.
std::map< int, ScalarExpressionTree * > getAllNonlinearExpressionTrees()
bool IsEqual(QuadraticCone *that)
A function to check for the equality of two objects.
ScalarExpressionTree * osExpressionTree
osExpressionTree contains the root of the ScalarExpressionTree
std::vector< ExprNode * > getMatrixExpressionTreeInPrefix(int rowIdx)
Get the prefix tokens for a given row index.
MatrixProgramming * matrixProgramming
matrixProgramming is a pointer to a MatrixProgramming object
bool setRandom(double density, bool conformant, int iMin, int iMax)
A function to make a random instance of this class.
TimeDomainStageVariables()
The TimeDomainStageVariables class constructor.
~PolarCone()
The PolarCone class destructor.
int * m_miQuadRowIndexes
m_miQuadRowIndexes is an integer pointer to the distinct row indexes with a quadratic term...
double * calculateAllObjectiveFunctionValues(double *x, double *objLambda, double *conLambda, bool new_x, int highestOrder)
Calculate all of the objective function values.
bool IsEqual(PolarCone *that)
A function to check for the equality of two objects.
QuadraticTerms * getQuadraticTerms()
Get all the quadratic terms in the instance.
int m_iNumberOfNonlinearExpressionTreeModIndexes
m_iNumberOfNonlinearExpressionTreeModIndexes holds the number of distinct rows and objectives with no...
bool bVariablesModified
bVariablesModified is true if the variables data has been modified.
IntVector * components
the list of components contributing to the intersection each component contains a reference to a prev...
Cones * cones
cones is a pointer to a Cones object
bool deepCopyFrom(PolarCone *that)
A function to make a deep copy of an instance of this class.
virtual std::string getConeName()
double * getVariableUpperBounds()
Get variable upper bounds.
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.
int ** getTimeDomainStageVarList()
Get the list of variables in each stage.
The in-memory representation of the <matrixConstraints> element.
bool m_bColumnMajor
m_bColumnMajor holds whether the linear constraint coefficients are stored in column major (if m_bCol...
bool deepCopyFrom(MatrixProgramming *that)
A function to make a deep copy of an instance of this class.
bool IsEqual(InstanceData *that)
A function to check for the equality of two objects.
std::vector< double > reverseAD(int p, std::vector< double > vdlambda)
Perform an AD reverse sweep.
The in-memory representation of the <objectives> child of the <stage> element.
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
RotatedQuadraticCone()
The RotatedQuadraticCone class constructor.
int numberOfNonlinearExpressions
numberOfNonlinearExpressions is the number of <nl> elements in the <nonlinearExpressions> element...
int getNumberOfColumnsForMatrix(int n)
Get the number of blocks in the matrix.
int numberOfObjCoef
numberOfObjCoef is the number of variables with a nonzero objective function coefficient ...
std::string m_sTimeDomainFormat
m_sTimeDomainFormat holds the format ("stages"/"interval") of the time domain.
bool setNumberOfQuadraticTerms(int nq)
set the number of quadratic terms
std::vector< bool > m_vbLagHessNonz
m_vbLagHessNonz is a boolean vector holding the nonzero pattern of the Lagrangian of the Hessian ...
int numberOfQuadraticTerms
numberOfQuadraticTerms is the number of quadratic terms in the <quadraticCoefficients> element...
int m_iNumberOfQuadraticRowIndexes
-—— data items for quadratic coefficients -——
int numberOfMatrices
numberOfMatrices is the number of <nl> elements in the <matrices> element.
int idx
idx holds the row index of the nonlinear expression
TimeDomainInterval * interval
interval is a pointer to an Interval object
~Constraint()
The Constraint class destructor.
Cone ** cone
cone is pointer to an array of Cone object pointers
~TimeDomain()
The TimeDomain class destructor.
virtual std::string getConeName()
Objectives()
The Objectives class constructor.
~IntersectionCone()
The IntersectionCone class destructor.
~RotatedQuadraticCone()
The RotatedQuadraticCone class destructor.
a sparse matrix data structure for matrices that can hold nonconstant values and have block structure...
bool getSparseJacobianFromRowMajor()
int * m_miMatrixNumberOfColumns
m_miMatrixNumberOfColumns holds the number of columns for each matrix.
int coneType
The type of the cone (one of the values in ENUM_CONE_TYPE)
bool m_bOSADFunIsCreated
m_bOSADFunIsCreated is true if we have created the OSInstanc OSAD Function
bool m_bNonLinearStructuresInitialized
m_bNonLinearStructuresInitialized is true if initializeNonLinearStructures() has been called...
int getNumberOfBlocksConstructors(int n)
std::string * m_msConstraintNames
m_msConstraintNames holds an array of constraint names.
std::string getInstanceCreator()
Get instance fileCreator.
int coneType
The type of the cone (one of the values in ENUM_CONE_TYPE)
std::string getInstanceLicence()
Get instance licence.
int conReferenceMatrixIdx
conReferenceMatrixIdx allows some or all of the components of this matrixCon to be copied from constr...
TimeDomainStages()
The Stages class constructor.
int referenceConeIdx
Dual cones use a reference to another, previously defined cone.
std::vector< ExprNode * > getNonlinearExpressionTreeModInPostfix(int rowIdx)
Get the postfix tokens for a given row index for the modified Expression Tree (quadratic terms added)...
TimeDomainStageObjectives * objectives
objectives is a pointer to a TimeDomainObjectives object
bool setVariableNumber(int number)
set the number of variables.
The in-memory representation of an OSiL instance..
bool setRandom(double density, bool conformant, int iMin, int iMax)
A function to make a random instance of this class.
bool setRandom(double density, bool conformant, int iMin, int iMax)
A function to make a random instance of this class.
int ubConeIdx
ubConeIdx gives a cone that must contain ubMatrix - matrixVar
std::string getNonlinearExpressionTreeInInfix(int rowIdx)
Get the infix representation for a given row (or objective function) index.
SparseMatrix * m_linearConstraintCoefficientsInColumnMajor
m_linearConstraintCoefficientsInColumnMajor holds the standard three-array data structure for linear ...
~TimeDomainStages()
The Stages class destructor.
The in-memory representation of the variables element.
bool m_bQTermsAdded
m_bQTermsAdded is true if we added the quadratic terms to the expression tree
bool processObjectives()
process objectives.
~OrthantCone()
default destructor.
TimeDomainStageObj()
The TimeDomainStageObj class constructor.
QuadraticCoefficients * quadraticCoefficients
quadraticCoefficients is a pointer to a QuadraticCoefficients object
int coneType
The type of the cone (one of the values in ENUM_CONE_TYPE)
~TimeDomainStage()
The TimeDomainStage class destructor.
int * m_miJacIndex
m_miJacIndex holds a int array of variable indices for the Jacobian matrix in sparse form (row major)...
int idx
idx is the index of the variable corresponding to the coefficient
int getNumberOfMatrixConstraints()
Get the number of matrix constraints.
~NonlinearExpressions()
The NonlinearExpressions class destructor.
OSMatrix ** matrix
matrix is a pointer to an array of OSMatrix object pointers
char varType
an optional variable type (C, B, I, D, J, S).
Constraint()
The Constraint class constructor.
int numberOfStages
numberOfStages is the number of stages in the <stages> element.
int idx
idx is the index of the row in which the quadratic term appears
double * m_mdObjectiveFunctionValues
m_mdObjectiveFunctionValues holds a double array of objective function values – the size of the array...
bool isPositiveSemiDefinite
information about semidefiniteness is also tracked in a boolean variable
bool setConstraints(int number, std::string *names, double *lowerBounds, double *upperBounds, double *constants)
set all the constraint related elements.
bool setTimeDomainInterval(double start, double horizon)
This sets the start and end of the time interval.
std::string m_sInstanceName
-—— data items for InstanceHeader -——
int numberOfOtherIndexes
Multidimensional tensors can also form cones (the Kronecker product, for instance, can be thought of as a four-dimensional tensor).
std::vector< ExprNode * > getMatrixExpressionTreeModInPostfix(int rowIdx)
Get the postfix tokens for a given row index for the modified Expression Tree (quadratic terms added)...
int * getTimeDomainStageNumberOfObjectives()
Get the number of objectives contained in each time stage.
The in-memory representation of a SparseHessianMatrix..
char * m_mcVariableTypes
m_mcVariableTypes holds a char array of variable types (default = 'C').
int m_iNumberOfBinaryVariables
m_iNumberOfBinaryVariables holds the number of binary variables.
int numberOfOtherIndexes
Multidimensional tensors can also form cones (the Kronecker product, for instance, can be thought of as a four-dimensional tensor).
The in-memory representation of a product cone.
bool setRandom(double density, bool conformant, int iMin, int iMax)
A function to make a random instance of this class.
std::string * getConstraintNames()
Get constraint names.
bool IsEqual(MatrixObj *that)
A function to check for the equality of two objects.
std::vector< double > m_vdYjacval
m_vdYval is a vector equal to a column or row of the Jacobian
bool m_bGetDenseObjectives
m_bGetDenseObjectives holds whether the dense objective functions are processed.
bool setInstanceLicence(std::string licence)
set the instance licence.
int m_iNumberOfNonlinearExpressionTreeIndexes
-—— data items for nonlinear expressions -——
bool initializeNonLinearStructures()
Initialize the data structures for the nonlinear API.
int * getObjectiveCoefficientNumbers()
Get objective coefficient number.
std::string m_sInstanceCreator
m_sInstanceSource holds the instance source.
int coneType
The type of the cone (one of the values in ENUM_CONE_TYPE)
OSMatrix * getMatrix(int n)
Get the list of constructors of the matrix.
int getNumberOfValuesForMatrix(int n)
Get the number of (nonzero) values in the matrix.
bool addCone(int index, int numberOfRows, int numberOfColumns, ENUM_CONE_TYPE coneType, std::string name, int numberOfOtherIndexes=0, int *otherIndexes=NULL)
add a cone.
int coneType
The type of the cone (one of the values in ENUM_CONE_TYPE)
int m_iMatrixNumber
m_iMatrixNumber holds the number of matrices
~Objectives()
The Objectives class destructor.
bool matrixHasTransformations(int n)
Used to hold the instance in memory.
int getNumberOfSemiIntegerVariables()
getNumberOfSemiIntegerVariables
LinearConstraintCoefficients * linearConstraintCoefficients
linearConstraintCoefficients is a pointer to a LinearConstraintCoefficients object ...
virtual std::string getConeInXML()
Write a RotatedQuadraticCone object in XML format.
bool IsEqual(MatrixObjectives *that)
A function to check for the equality of two objects.
~NonpositiveCone()
default destructor.
int numberOfRows
numberOfRows gives the number of rows of this matrix
int * m_miNonlinearExpressionTreeModIndexes
m_miNonlinearExpressionTreeModIndexes is an integer pointer to the distinct rows indexes in the modif...
bool setRandom(double density, bool conformant, int iMin, int iMax)
A function to make a random instance of this class.
int numberOfCones
numberOfCones is the number of <nl> elements in the <cones> element.
std::map< int, int > m_mapOSADFunRangeIndex
m_mapOSADFunRangeIndex is an inverse of the previous map.
The in-memory representation of the <qTerm> element.
The in-memory representation of the <expr> element, which is like a nonlinear expression, but since it involves matrices, the expression could be linear, so a "shape" attribute is added to distinguish linear and nonlinear expressions.
a data structure to represent a matrix object (derived from MatrixType)
MatrixConstraints()
The MatrixConstraints class constructor.
~MatrixExpressions()
The MatrixExpressions class destructor.
int numberOfOtherIndexes
Cones can also be formed by Multidimensional tensors.
unsigned int m_iNumberOfNonlinearVariables
m_iNumberOfNonlinearVariables is the number of variables that appear in a nonlinear expression...
double constant
constant is a value that is added to the constraint
std::vector< double > forwardAD(int p, std::vector< double > vdX)
Perform an AD forward sweep.
The in-memory representation of the variable element.
SparseMatrix * m_linearConstraintCoefficientsInRowMajor
m_linearConstraintCoefficientsInRowMajor holds the standard three-array data structure for linear con...
virtual std::string getConeName()
bool m_bLagrangianExpTreeCreated
m_bLagrangianHessionCreated is true if a Lagrangian function for the Hessian has been created ...
int * getQuadraticRowIndexes()
Get the indexes of rows which have a quadratic term.
The NonnegativeCone Class.
int iNumberOfStartElements
iNumberOfStartElements counts the number of elements in the <start> section of <linearConstraintCoeff...
bool processLinearConstraintCoefficients()
process linear constraint coefficients.
int templateMatrixIdx
templateMatrixIdx refers to a matrix that describes the locations in this matrixVar that are allowed ...
SparseJacobianMatrix * m_sparseJacMatrix
m_sparseJacMatrix is the Jacobian matrix stored in sparse matrix format
~Variable()
The Variable class destructor.
bool deepCopyFrom(Cone *that)
A function to make a deep copy of an instance of this class.
int objReferenceMatrixIdx
objReferenceMatrixIdx allows some or all of the components of this matrixObj to be copied from object...
virtual std::string getConeInXML()
Write a ProductCone object in XML format.
int getNumberOfBinaryVariables()
getNumberOfBinaryVariables
std::string getInstanceDescription()
Get instance description.
bool deepCopyFrom(DualCone *that)
A function to make a deep copy of an instance of this class.
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.
std::map< int, ScalarExpressionTree * > getAllNonlinearExpressionTreesMod()
MatrixExpression()
The MatrixExpression class constructor.
void fint fint fint real fint real * x
The in-memory representation of the <con> element.
int getNumberOfNonlinearExpressionTreeIndexes()
Get the number of unique nonlinear expression tree indexes.
bool m_bDeleteExpressionTree
if m_bDeleteExpressionTree is true during garbage collection, we should delete the osExpression tree ...
std::string name
name is the name of the constraint
int lbMatrixIdx
lbMatrixIdx gives a lower bound for this matrixCon
int getNumberOfNonlinearObjectives()
std::string getTimeDomainFormat()
Get the format of the time domain ("stages"/"interval")
std::map< int, MatrixExpressionTree * > getAllMatrixExpressionTreesMod()
std::vector< ExprNode * > getMatrixExpressionTreeInPostfix(int rowIdx)
Get the postfix tokens for a given row index.
bool m_binitForAlgDiff
-—— data items for automatic differentiation -——
QuadraticTerm()
The QuadraticTerm class constructor.
The in-memory representation of the <matrixExpressions> element.
~MatrixProgramming()
The MatrixProgramming class destructor.
bool processMatrices()
process matrices.
The NonpositiveCone Class.
std::vector< ExprNode * > getNonlinearExpressionTreeInPostfix(int rowIdx)
Get the postfix tokens for a given row index.