1220 std::vector<double>
m_vdX;
1245 std::vector<double>
m_vdw;
1898 bool addVariable(
int index, std::string name,
double lowerBound,
double upperBound,
char type);
1919 double* upperBounds,
char* types);
1946 bool addObjective(
int index, std::string name, std::string maxOrMin,
double constant,
double weight,
SparseVector* objectiveCoefficients);
1963 bool setObjectives(
int number, std::string *names, std::string *maxOrMins,
double *constants,
double *weights,
SparseVector **objectitiveCoefficients);
1986bool addConstraint(
int index, std::string name,
double lowerBound,
double upperBound,
double constant);
1999bool setConstraints(
int number, std::string* names,
double* lowerBounds,
double* upperBounds,
double* constants);
2020 double* values,
int valuesBegin,
int valuesEnd,
2021 int* indexes,
int indexesBegin,
int indexesEnd,
2022 int* starts,
int startsBegin,
int startsEnd);
2040 int* rowIndexes,
int* varOneIndexes,
int* varTwoIndexes,
double* coefficients,
2041 int begin,
int end);
2057 int* rowIndexes,
int* varOneIndexes,
int* varTwoIndexes,
double* coefficients);
2101 bool new_x,
int highestOrder);
2134 bool new_x,
int highestOrder);
2167 double *conLambda,
bool new_x,
int highestOrder);
2186 int idx,
bool new_x,
int highestOrder);
2218 bool new_x,
int highestOrder);
2236 int objIdx,
bool new_x,
int highestOrder);
2270 bool new_x,
int highestOrder);
2335#ifdef COIN_HAS_CPPAD
2340 CppAD::ADFun<double> *Fad;
2365 std::vector<double>
forwardAD(
int p, std::vector<double> vdX);
2377 std::vector<double>
reverseAD(
int p, std::vector<double> vdlambda);
2413 bool new_x,
int highestOrder);
This file defines the OSnLNode class along with its derived classes.
The in-memory representation of the <con> element.
double constant
constant is a value that is added to the constraint
double ub
ub is the upper bound on the constraint
double lb
lb is the lower bound on the constraint
Constraint()
The Constraint class constructor.
~Constraint()
The Constraint class destructor.
std::string name
name is the name of the constraint
The in-memory representation of the <constraints> element.
int numberOfConstraints
numberOfConstraints is the number of constraints in the instance
Constraint ** con
con is pointer to an array of Constraint object pointers
~Constraints()
The Constraints class destructor.
Constraints()
The Constraints class constructor.
a double vector data structure
The in-memory representation of the <instanceData> element.
Variables * variables
variables is a pointer to a Variables object
QuadraticCoefficients * quadraticCoefficients
quadraticCoefficients is a pointer to a QuadraticCoefficients object
Constraints * constraints
constraints is a pointer to a Constraints object
NonlinearExpressions * nonlinearExpressions
nonlinearExpressions is a pointer to a NonlinearExpressions object
TimeDomain * timeDomain
timeDomain is a pointer to a TimeDomain object
InstanceData()
The InstanceData class constructor.
~InstanceData()
The InstanceData class destructor.
Objectives * objectives
objectives is a pointer to a Objectives object
LinearConstraintCoefficients * linearConstraintCoefficients
linearConstraintCoefficients is a pointer to a LinearConstraintCoefficients object
an integer Vector data structure
The in-memory representation of the <linearConstraintCoefficients> element.
DoubleVector * value
a pointer to the array of nonzero values being stored
int iNumberOfStartElements
iNumberOfStartElements counts the number of elements in the <start> section of <linearConstraintCoeff...
int numberOfValues
numberOfValues is the number of nonzero elements stored in the <linearConstraintCoefficients> element
IntVector * start
a pointer to the start of each row or column stored in sparse format
~LinearConstraintCoefficients()
The LinearConstraintCoefficients class destructor.
IntVector * rowIdx
a pointer of row indices if the problem is stored by column
LinearConstraintCoefficients()
The LinearConstraintCoefficients class constructor.
IntVector * colIdx
a pointer of column indices if the problem is stored by row
The in-memory representation of the <nl> element.
int idx
idx holds the row index of the nonlinear expression
bool m_bDeleteExpressionTree
m_bDeleteExpressionTree is true, if in garbage collection, we should delete the osExpression tree obj...
OSExpressionTree * osExpressionTree
osExpressionTree contains the root of the OSExpressionTree
The in-memory representation of the <nonlinearExpressions> element.
~NonlinearExpressions()
The NonlinearExpressions class destructor.
int numberOfNonlinearExpressions
numberOfNonlinearExpressions is the number of <nl> elements in the <nonlinearExpressions> element.
Nl ** nl
nl is pointer to an array of Nl object pointers
NonlinearExpressions()
The NonlinearExpressions class constructor.
Used to hold the instance in memory.
The in-memory representation of an OSiL instance..
bool m_bProcessLinearConstraintCoefficients
----— data items for linear constraint coefficients ----—
bool m_bAllNonlinearVariablesIndex
m_bAllNonlinearVariablesIndexMap is true if the map of the variables in the Lagrangian function has b...
SparseJacobianMatrix * calculateAllConstraintFunctionGradients(double *x, double *objLambda, double *conLambda, bool new_x, int highestOrder)
Calculate the gradient of all constraint functions
int * m_miQuadRowIndexes
m_miQuadRowIndexes is an integer pointer to the distinct row indexes with a quadratic term.
bool getIterateResults(double *x, double *objLambda, double *conLambda, bool new_x, int highestOrder)
end revised AD code
bool m_bSparseJacobianCalculated
m_bSparseJacobianCalculated is true if getJacobianSparsityPattern() has been called.
bool m_bQTermsAdded
m_bQTermsAdded is true if we added the quadratic terms to the expression tree
double * getObjectiveWeights()
Get objective weights.
bool m_bProcessExpressionTrees
m_bProcessExpressionTrees is true if the expression trees have been processed.
std::vector< double > m_vdYjacval
m_vdYval is a vector equal to a column or row of the Jacobian
bool setTimeDomain(std::string format)
This sets the format of the time domain ("stages"/"interval"/"none")
int m_iNumberOfBinaryVariables
m_iNumberOfBinaryVariables holds the number of binary variables.
bool m_bProcessExpressionTreesMod
m_bProcessExpressionTreesMod is true if the modified expression trees have been processed.
std::string getTimeDomainFormat()
Get the format of the time domain ("stages"/"interval")
int ** getTimeDomainStageVarList()
Get the list of variables in each stage.
SparseVector ** m_mObjectiveCoefficients
m_mObjectiveCoefficients holds an array of objective coefficients, one set of objective coefficients ...
std::vector< double > m_vdYval
m_vdYval is a vector of function values
bool m_bProcessObjectives
----— data items for Objectives ----—
std::string * getConstraintNames()
Get constraint names.
bool m_bProcessNonlinearExpressions
m_bProcessNonlinearExpressions holds whether the nonlinear expressions are processed.
std::vector< OSnLNode * > getNonlinearExpressionTreeInPostfix(int rowIdx)
Get the postfix tokens for a given row index.
double * getConstraintLowerBounds()
Get constraint lower bounds.
SparseVector * calculateConstraintFunctionGradient(double *x, int idx, bool new_x)
Calculate the gradient of the constraint function indexed by idx this function is overloaded.
int getNumberOfQuadraticTerms()
Get the number of specified (usually nonzero) qTerms in the quadratic coefficients.
bool m_bFiniteTimeStages
m_bFiniteTimeStages holds whether the time domain has the form of finite (discrete) stages.
std::vector< OSnLNode * > getNonlinearExpressionTreeModInPrefix(int rowIdx)
Get the prefix tokens for a given row index for the modified Expression Tree (quadratic terms added).
bool m_bProcessTimeInterval
m_bProcessTimeInterval holds whether a time interval has been processed.
double * getVariableUpperBounds()
Get variable upper bounds.
bool setConstraintNumber(int number)
set the constraint number.
int ** m_mmiTimeDomainStageObjList
m_mmiTimeDomainStageObjList holds the list of objectives in each stage.
double * m_mdObjectiveConstants
m_mdObjectiveConstants holds an array of objective constants (default = 0.0).
bool setTimeDomainStages(int number, std::string *names)
This sets the number (and optionally names) of the time stages.
std::vector< double > m_vdDomainUnitVec
m_vdDomainUnitVec is a unit vector in the domain space
std::string m_sTimeDomainFormat
m_sTimeDomainFormat holds the format ("stages"/"interval") of the time domain.
int m_iVariableNumber
m_iVariableNumber holds the variable number.
int m_iHighestTaylorCoeffOrder
m_iHighestTaylorCoeffOrder is the order of highest calculated Taylor coefficient
std::vector< bool > m_vbLagHessNonz
m_vbLagHessNonz is a boolean vector holding the nonzero pattern of the Lagrangian of the Hessian
std::map< int, std::vector< OSnLNode * > > m_mapExpressionTreesInPostfix
m_mapExpressionTreesInPostfix holds a hash map of expression trees in postfix format,...
int * m_miNonlinearExpressionTreeIndexes
m_miNonlinearExpressionTreeIndexes is an integer pointer to the distinct rows indexes in the nonlinea...
SparseJacobianMatrix * getJacobianSparsityPattern()
std::vector< double > forwardAD(int p, std::vector< double > vdX)
Perform an AD forward sweep
double * m_mdObjectiveWeights
m_mdObjectiveWeights holds an array of objective weights (default = 1.0).
double * m_mdConstraintFunctionValues
m_mdConstraintFunctionValues holds a double array of constraint function values – the size of the arr...
int m_iConstraintNumberNonlinear
m_iConstraintNumberNonlinear is the number of constraints that have a nonlinear term.
int * m_miJacStart
m_miJacStart holds a int array of starts for the Jacobian matrix in sparse form (row major).
std::vector< OSnLNode * > getNonlinearExpressionTreeModInPostfix(int rowIdx)
Get the postfix tokens for a given row index for the modified Expression Tree (quadratic terms added)...
int getADSparsityHessian()
end revised AD code
unsigned int m_iNumberOfNonlinearVariables
m_iNumberOfNonlinearVariables is the number of variables that appear in a nonlinear expression.
std::vector< double > m_vdRangeUnitVec
m_vdRangeUnitVec is a unit vector in the range space
bool addQTermsToExressionTree()
bool m_bNonlinearExpressionTreeIndexesProcessed
m_bNonlinearExpressionTreeIndexesProcessed is true if getNonlinearExpressionTreeIndexes() has been ca...
bool addVariable(int index, std::string name, double lowerBound, double upperBound, char type)
add a variable.
bool setTimeDomainStageConstraintsUnordered(int numberOfStages, int *numberOfConstraints, int **conIndex)
This sets the constraints associated with each time domain stage in srbitrary order.
int getNumberOfNonlinearExpressionTreeIndexes()
Get the number of unique Nonlinear expression tree indexes.
int m_iQuadraticTermNumber
m_iQuadraticTermNumber holds the number of specified (usually nonzero) qTerms in the quadratic coeffi...
int ** m_mmiTimeDomainStageConList
m_mmiTimeDomainStageConList holds the list of constraints in each stage.
std::vector< double > m_vdw
m_vdYval is a vector of derivatives – output from a reverse sweep
int getNumberOfNonlinearExpressionTreeModIndexes()
Get the number of unique Nonlinear expression tree indexes after modifying the expression tree to con...
bool getZeroOrderResults(double *x, double *objLambda, double *conLambda)
Calculate function values.
bool m_bProcessQuadraticTerms
m_bProcessQuadraticTerms holds whether the quadratic terms are processed.
OSExpressionTree * getNonlinearExpressionTreeMod(int rowIdx)
Get the expression tree for a given row index for the modified expression trees (quadratic terms adde...
std::string * m_msVariableNames
m_msVariableNames holds an array of variable names.
int getTimeDomainStageNumber()
Get the number of stages that make up the time domain.
int getNumberOfIntegerVariables()
getNumberOfIntegerVariables
bool getSparseJacobianFromColumnMajor()
std::string getInstanceName()
Get instance name.
bool processConstraints()
process constraints.
bool bUseExpTreeForFunEval
bUseExpTreeForFunEval is set to true if you wish to use the OS Expression Tree for function evaluatio...
int * m_miTimeDomainStageVariableNumber
m_miTimeDomainStageVariableNumber holds the number of variables in each stage.
bool m_bNonlinearExpressionTreeModIndexesProcessed
m_bNonlinearExpressionTreeModIndexesProcessed is true if getNonlinearExpressionTreeModIndexes has bee...
int * getTimeDomainStageNumberOfObjectives()
Get the number of objectives contained in each time stage.
bool m_bQuadraticRowIndexesProcessed
m_bQuadraticRowIndexesProcessed is true if getQuadraticRowIndexes() has been called.
bool getFirstOrderResults(double *x, double *objLambda, double *conLambda)
Calculate first derivatives.
bool addConstraint(int index, std::string name, double lowerBound, double upperBound, double constant)
add a constraint.
double getTimeDomainIntervalHorizon()
Get the horizon for the time domain interval.
int getNumberOfBinaryVariables()
getNumberOfBinaryVariables
std::string * getObjectiveNames()
Get objective names.
int * m_miNonlinearExpressionTreeModIndexes
m_miNonlinearExpressionTreeModIndexes is an integer pointer to the distinct rows indexes in the modif...
int getNumberOfNonlinearObjectives()
bool setQuadraticTermsInNonlinearExpressions(int number, int *rowIndexes, int *varOneIndexes, int *varTwoIndexes, double *coefficients)
set quadratic terms in nonlinearExpressions
int * m_miTimeDomainStageObjectiveNumber
m_miTimeDomainStageObjectiveNumber holds the number of objectives in each stage.
bool getLinearConstraintCoefficientMajor()
Get whether the constraint coefficients is in column major (true) or row major (false).
int m_iObjectiveNumberNonlinear
m_iObjectiveNumber is the number of objective functions with a nonlinear term.
int m_iNumberOfTimeStages
m_iNumberOfTimeStages holds the number of discrete stages
int * m_miNumberOfObjCoef
m_miNumberOfObjCoef holds an integer array of number of objective coefficients (default = 0).
std::vector< OSnLNode * > getNonlinearExpressionTreeInPrefix(int rowIdx)
Get the prefix tokens for a given row index.
std::map< int, OSExpressionTree * > getAllNonlinearExpressionTreesMod()
bool m_bNonLinearStructuresInitialized
m_bNonLinearStructuresInitialized is true if initializeNonLinearStructures() has been called.
bool m_bLagrangianExpTreeCreated
m_bLagrangianHessionCreated is true if a Lagrangian function for the Hessian has been created
bool initObjGradients()
This should be called by initForAlgDiff()
double * m_mdObjectiveFunctionValues
m_mdObjectiveFunctionValues holds a double array of objective function values – the size of the array...
double * m_mdConstraintUpperBounds
m_mdConstraintUpperBounds holds an array of constraint upper bounds (default = INF).
std::string getInstanceDescription()
Get instance description.
std::string * m_msObjectiveNames
m_msObjectiveNames holds an array of objective names.
int * m_miJacNumConTerms
m_miJacNumConTerms holds a int array of the number of constant terms (gradient does not change) for t...
bool setQuadraticTerms(int number, int *rowIndexes, int *varOneIndexes, int *varTwoIndexes, double *coefficients, int begin, int end)
set quadratic terms
int m_iNonlinearExpressionNumber
m_iNonlinearExpressionNumber holds the number of nonlinear expressions.
int getConstraintNumber()
Get constraint number.
int m_iLinearConstraintCoefficientNumber
m_iLinearConstraintCoefficientNumber holds the number of specified (usually nonzero) linear constrain...
std::map< int, OSExpressionTree * > m_mapExpressionTreesMod
m_mapExpressionTreesMod holds a map of expression trees, with the key being the row index and value b...
int * getObjectiveCoefficientNumbers()
Get objective coefficient number.
double * calculateAllConstraintFunctionValues(double *x, double *objLambda, double *conLambda, bool new_x, int highestOrder)
Calculate all of the constraint function values.
int * getTimeDomainStageNumberOfVariables()
Get the number of variables contained in each time stage.
std::string * m_msMaxOrMins
m_msMaxOrMins holds a std::string array of objective maxOrMins ("max" or "min").
char * m_mcConstraintTypes
m_mcConstraintTypes holds a char array of constraint types (R for range; L for <=; G for >=; E for =;...
double * m_mdVariableUpperBounds
m_mdVariableUpperBounds holds a double array of variable upper bounds (default = INF).
int m_iNumberOfQuadraticRowIndexes
----— data items for quadratic coefficients ----—
std::map< int, int > m_mapOSADFunRangeIndex
m_mapOSADFunRangeIndex is an inverse of the previous map.
double * calculateObjectiveFunctionGradient(double *x, int objIdx, bool new_x)
Calculate the gradient of the objective function indexed by objIdx this function is overloaded.
int getLinearConstraintCoefficientNumber()
Get number of specified (usually nonzero) linear constraint coefficient values.
OSExpressionTree * m_LagrangianExpTree
m_LagrangianExpTree is an OSExpressionTree object that is the expression tree for the Lagrangian func...
double * m_mdVariableLowerBounds
m_mdVariableLowerBounds holds a double array of variable lower bounds (default = 0....
int ** getTimeDomainStageObjList()
Get the list of objectives in each stage.
double * m_mdConstraintLowerBounds
m_mdConstraintLowerBounds holds an array of constraint lower bounds (default = -INF).
int ** m_mmiTimeDomainStageVarList
m_mmiTimeDomainStageVarList holds the list of variables in each stage.
SparseMatrix * getLinearConstraintCoefficientsInRowMajor()
Get linear constraint coefficients in row major.
double calculateFunctionValue(int idx, double *x, bool new_x)
Calculate the function value for function (constraint or objective) indexed by idx.
double ** m_mmdDenseObjectiveCoefficients
m_mmdDenseObjectiveCoefficients holds an array of pointers, each pointer points to a vector of dense ...
int * getTimeDomainStageNumberOfConstraints()
Get the number of constraints contained in each time stage.
std::map< int, OSExpressionTree * > getAllNonlinearExpressionTrees()
double getTimeDomainIntervalStart()
Get the start for the time domain interval.
SparseMatrix * m_linearConstraintCoefficientsInColumnMajor
m_linearConstraintCoefficientsInColumnMajor holds the standard three-array data structure for linear ...
double * calculateAllObjectiveFunctionValues(double *x, bool new_x)
Calculate all of the objective function values, we are overloading this function and this version of ...
int * m_miNonLinearVarsReverseMap
m_miNonLinearVarsReverseMap maps the nonlinear variable number back into the original variable space
int * getNonlinearExpressionTreeIndexes()
Get all the nonlinear expression tree indexes, i.e.
std::string * getTimeDomainStageNames()
Get the names of the stages (NULL or empty string ("") if a stage has not been given a name.
bool m_bProcessTimeDomain
----— data items for time domain ----—
char * getVariableTypes()
Get variable initial values.
std::string m_sInstanceName
----— data items for InstanceHeader ----—
char * m_mcVariableTypes
m_mcVariableTypes holds a char array of variable types (default = 'C').
int getNumberOfQuadraticRowIndexes()
Get the number of rows which have a quadratic term.
double * calculateAllObjectiveFunctionValues(double *x, double *objLambda, double *conLambda, bool new_x, int highestOrder)
Calculate all of the objective function values.
double * m_mdJacValue
m_mdJacValue holds a double array of partial derivatives for the Jacobian matrix in sparse form (row ...
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.
bool getSparseJacobianFromRowMajor()
SparseMatrix * getLinearConstraintCoefficientsInColumnMajor()
Get linear constraint coefficients in column major.
int * getQuadraticRowIndexes()
Get the indexes of rows which have a quadratic term.
bool processObjectives()
process objectives.
int * m_miTimeDomainStageConstraintNumber
m_miTimeDomainStageConstraintNumber holds the number of constraints in each stage.
std::string * getVariableNames()
Get variable names.
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.
bool m_bProcessTimeStages
m_bProcessTimeStages holds whether the time stages have been processed.
int * getNonlinearExpressionTreeModIndexes()
Get all the nonlinear expression tree indexes, i.e.
bool m_bDuplicateExpressionTreesMap
m_bDuplicateExpressionTreeMap is true if m_mapExpressionTrees was duplicated.
bool setTimeDomainStageConstraintsOrdered(int numberOfStages, int *numberOfConstraints, int *startIdx)
This sets the constraints associated with each time domain stage in temporal order.
bool setVariables(int number, std::string *names, double *lowerBounds, double *upperBounds, char *types)
set all the variable related elements.
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 setTimeDomainStageVariablesOrdered(int numberOfStages, int *numberOfVariables, int *startIdx)
This sets the variables associated with each time domain stage in temporal order.
bool setInstanceSource(std::string source)
set the instance source.
bool m_bColumnMajor
m_bColumnMajor holds whether the linear constraint coefficients are stored in column major (if m_bCol...
QuadraticTerms * m_quadraticTerms
m_quadraticTerms holds the data structure for all the quadratic terms in the instance.
std::map< int, OSExpressionTree * > m_mapExpressionTrees
m_mapExpressionTrees holds a hash map of expression tree pointers, with the key being the row index a...
double ** getDenseObjectiveCoefficients()
getDenseObjectiveCoefficients.
bool setTimeDomainStageVariablesUnordered(int numberOfStages, int *numberOfVariables, int **varIndex)
This sets the variables associated with each time domain stage in srbitrary order.
bool initForAlgDiff()
This should be called by nonlinear solvers using callback functions
std::string getInstanceSource()
Get instance source.
std::string * m_msConstraintNames
m_msConstraintNames holds an array of constraint names.
int m_iObjectiveNumber
m_iObjectiveNumber is the number of objective functions.
bool m_bCppADMustReTape
is true if a CppAD Expresion Tree has an expression that can change depending on the value of the inp...
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
InstanceData * instanceData
A pointer to an InstanceData object.
int m_iHighestOrderEvaluated
m_iHighestOrderEvaluated is the highest order derivative of the current iterate
OSInstance()
The OSInstance class constructor.
std::map< int, int > m_mapAllNonlinearVariablesIndex
m_mapAllNonlinearVariablesIndexMap is a map of the variables in the Lagrangian function
int getNumberOfNonlinearExpressions()
Get number of nonlinear expressions.
SparseHessianMatrix * getLagrangianHessianSparsityPattern()
SparseVector ** getObjectiveCoefficients()
Get objective coefficients.
int m_iNumberOfIntegerVariables
m_iNumberOfIntegerVariables holds the number of integer variables.
std::map< int, int > getAllNonlinearVariablesIndexMap()
SparseHessianMatrix * calculateHessian(double *x, int idx, bool new_x)
Calculate the Hessian of a constraint or objective function.
OSExpressionTree * getLagrangianExpTree()
QuadraticTerms * getQuadraticTerms()
Get all the quadratic terms in the instance.
int ** getTimeDomainStageConList()
Get the list of constraints in each stage.
std::vector< double > reverseAD(int p, std::vector< double > vdlambda)
Perform an AD reverse sweep
SparseMatrix * m_linearConstraintCoefficientsInRowMajor
m_linearConstraintCoefficientsInRowMajor holds the standard three-array data structure for linear con...
double * getObjectiveConstants()
Get objective constants.
bool processLinearConstraintCoefficients()
process linear constraint coefficients.
double * getVariableLowerBounds()
Get variable lower bounds.
int m_iConstraintNumber
m_iConstraintNumber is the number of constraints.
bool m_bLagrangianSparseHessianCreated
m_bLagrangianSparseHessianCreated is true if the sparse Hessian Matrix for the Lagrangian was created
int getVariableNumber()
Get variable number.
bool m_bGetDenseObjectives
m_bGetDenseObjectives holds whether the dense objective functions are processed.
bool m_bOSADFunIsCreated
m_bOSADFunIsCreated is true if we have created the OSInstanc OSAD Function
std::string * m_msTimeDomainStageNames
m_msTimeDomainStageNames holds the names of the time stages.
std::string * getObjectiveMaxOrMins()
Get objective maxOrMins.
bool m_bCppADTapesBuilt
is true if a CppAD Expresion Tree has been built for each row and objective with a nonlinear expressi...
bool m_binitForAlgDiff
----— data items for automatic differentiation ----—
~OSInstance()
The OSInstance class destructor.
bool setTimeDomainStageObjectivesOrdered(int numberOfStages, int *numberOfObjectives, int *startIdx)
This sets the objectives associated with each time domain stage in temporal order.
OSExpressionTree * getNonlinearExpressionTree(int rowIdx)
Get the expression tree for a given row index
bool setInstanceDescription(std::string description)
set the instance description.
bool setTimeDomainInterval(double start, double horizon)
This sets the start and end of the time interval.
bool m_bProcessVariables
----— data items for Variables ----—
bool setObjectives(int number, std::string *names, std::string *maxOrMins, double *constants, double *weights, SparseVector **objectitiveCoefficients)
bool setTimeDomainStageObjectivesUnordered(int numberOfStages, int *numberOfObjectives, int **varIndex)
This sets the objectives associated with each time domain stage in arbitrary order.
double * calculateAllConstraintFunctionValues(double *x, bool new_x)
Calculate all of the constraint function values, we are overloading this function and this version of...
std::string m_sInstanceSource
m_sInstanceSource holds the instance source.
char * getConstraintTypes()
Get constraint types.
bool processVariables()
process variables.
bool setInstanceName(std::string name)
set the instance name.
SparseHessianMatrix * m_LagrangianSparseHessian
m_LagrangianSparseHessian is the Hessian Matrix of the Lagrangian function in sparse format
int m_iNumberOfNonlinearExpressionTreeModIndexes
m_iNumberOfNonlinearExpressionTreeModIndexes holds the number of distinct rows and objectives with no...
bool addObjective(int index, std::string name, std::string maxOrMin, double constant, double weight, SparseVector *objectiveCoefficients)
add an objective.
bool m_bProcessConstraints
----— data items for Constraints ----—
InstanceHeader * instanceHeader
A pointer to an InstanceHeader object.
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...
bool setConstraints(int number, std::string *names, double *lowerBounds, double *upperBounds, double *constants)
set all the constraint related elements.
std::vector< double > m_vdLambda
m_vdYval is a vector of Lagrange multipliers
bool setObjectiveNumber(int number)
set the objective number.
std::vector< double > m_vdX
----— data vectors for nonlinear optimization ----—
double ** m_mmdObjGradient
m_mdObjGradient holds an array of pointers, each pointer points to gradient of one objective function...
int * m_miNonlinearExpressionIndexes
m_miNonlinearExpressionIndexes holds an integer array of nonlinear expression indexes,...
int * m_miJacIndex
m_miJacIndex holds a int array of variable indices for the Jacobian matrix in sparse form (row major)...
bool setVariableNumber(int number)
set the variable number.
std::string m_sInstanceDescription
m_sInstanceDescription holds the instance description.
bool initializeNonLinearStructures()
Initialize the data structures for the nonlinear API.
double ** calculateAllObjectiveFunctionGradients(double *x, double *objLambda, double *conLambda, bool new_x, int highestOrder)
Calculate the gradient of all objective functions.
double * getConstraintUpperBounds()
Get constraint upper bounds.
int getObjectiveNumber()
Get objective number.
SparseJacobianMatrix * m_sparseJacMatrix
m_sparseJacMatrix is the Jacobian matrix stored in sparse matrix format
int m_iNumberOfNonlinearExpressionTreeIndexes
----— data items for nonlinear expressions ----—
bool getSecondOrderResults(double *x, double *objLambda, double *conLambda)
Calculate second derivatives.
int m_iJacValueSize
m_iJacValueSize is the number of nonzero partial derivates in the Jacobian.
int getNumberOfNonlinearConstraints()
double * m_mdConstraintConstants
m_mdConstraintConstants holds an array of constraint constants (default = 0.0).
void duplicateExpressionTreesMap()
duplicate the map of expression trees.
The in-memory representation of the objective function <coef> element.
double value
value is the value of the objective function coefficient corresponding to the variable with index idx
ObjCoef()
The ObjCoef class constructor.
int idx
idx is the index of the variable corresponding to the coefficient
~ObjCoef()
The ObjCoef class destructor.
The in-memory representation of the <obj> element.
ObjCoef ** coef
coef is pointer to an array of ObjCoef object pointers
double constant
constant is the constant term added to the objective function, 0 by default
double weight
weight is the weight applied to the given objective function, 1.0 by default
int numberOfObjCoef
numberOfObjCoef is the number of variables with a nonzero objective function coefficient
~Objective()
The Objective class destructor.
Objective()
The Objective class constructor.
std::string name
the name of the objective function
std::string maxOrMin
declare the objective function to be a max or a min
The in-memory representation of the <objectives> element.
int numberOfObjectives
numberOfObjectives is the number of objective functions in the instance
Objective ** obj
coef is pointer to an array of ObjCoef object pointers
Objectives()
The Objectives class constructor.
~Objectives()
The Objectives class destructor.
The in-memory representation of the <quadraticCoefficients> element.
QuadraticTerm ** qTerm
qTerm is a pointer to an array of QuadraticTerm object pointers
QuadraticCoefficients()
The QuadraticCoefficients class constructor.
int numberOfQuadraticTerms
numberOfQuadraticTerms is the number of quadratic terms in the <quadraticCoefficients> element.
~QuadraticCoefficients()
The QuadraticCoefficients class destructor.
The in-memory representation of the <qTerm> element.
double coef
coef is the coefficient of the quadratic term
int idxOne
idxOne is the index of the first variable in the quadratic term
~QuadraticTerm()
The QuadraticTerm class destructor.
QuadraticTerm()
The QuadraticTerm class constructor.
int idx
idx is the index of the row in which the quadratic term appears
int idxTwo
idxTwo is the index of the second variable in the quadratic term
a data structure for holding quadratic terms
The in-memory representation of a SparseHessianMatrix..
a sparse Jacobian matrix data structure
a sparse matrix data structure
a sparse vector data structure
The in-memory representation of the <timeDomain> element.
TimeDomainStages * stages
stages is a pointer to a Stages object
TimeDomain()
The TimeDomain class constructor.
TimeDomainInterval * interval
interval is a pointer to an Interval object
~TimeDomain()
The TimeDomain class destructor.
~TimeDomainInterval()
The Interval class destructor.
double start
start is the start of the planning period in the <interval> element.
double horizon
horizon is the end of the planning period in the <interval> element.
TimeDomainInterval()
The Interval class constructor.
The in-memory representation of the <con> element.
int idx
idx gives the index of this constraint
~TimeDomainStageCon()
The TimeDomainStageCon class destructor.
TimeDomainStageCon()
The TimeDomainStageCon class constructor.
The in-memory representation of the <constraints> child of the <stage> element.
int numberOfConstraints
numberOfConstraints gives the number of constraints contained in this stage
~TimeDomainStageConstraints()
The TimeDomainStageConstraints class destructor.
TimeDomainStageConstraints()
The TimeDomainStageConstraints class constructor.
TimeDomainStageCon ** con
con is a pointer to an array of TimeDomainStageCon object pointers
int startIdx
startdIdx gives the number of the first constraint contained in this stage
The in-memory representation of the <stage> element.
TimeDomainStageVariables * variables
variables is a pointer to a TimeDomainVariables object
std::string name
name corresponds to the optional attribute that holds the name of the stage; the default value is emp...
~TimeDomainStage()
The TimeDomainStage class destructor.
TimeDomainStageObjectives * objectives
objectives is a pointer to a TimeDomainObjectives object
TimeDomainStageConstraints * constraints
constraints is a pointer to a TimeDomainConstraints object
TimeDomainStage()
The TimeDomainStage class constructor.
The in-memory representation of the <obj> element.
int idx
idx gives the index of this variable
~TimeDomainStageObj()
The TimeDomainStageObj class destructor.
TimeDomainStageObj()
The TimeDomainStageObj class constructor.
The in-memory representation of the <objectives> child of the <stage> element.
TimeDomainStageObj ** obj
obj is a pointer to an array of TimeDomainStageObj object pointers
int startIdx
startdIdx gives the number of the first objective contained in this stage
TimeDomainStageObjectives()
The TimeDomainStageObjectives class constructor.
int numberOfObjectives
numberOfObjectives gives the number of objectives contained in this stage
~TimeDomainStageObjectives()
The TimeDomainStageObjectives class destructor.
The in-memory representation of the element.
TimeDomainStageVar()
The TimeDomainStageVar class constructor.
int idx
idx gives the index of this variable
~TimeDomainStageVar()
The TimeDomainStageVar class destructor.
The in-memory representation of the <variables> child of the <stage> element.
TimeDomainStageVar ** var
var is a pointer to an array of TimeDomainStageVar object pointers
TimeDomainStageVariables()
The TimeDomainStageVariables class constructor.
int numberOfVariables
numberOfVariables gives the number of variables contained in this stage
int startIdx
startdIdx gives the number of the first variable contained in this stage
~TimeDomainStageVariables()
The TimeDomainStageVariables class destructor.
The in-memory representation of the <stages> element.
TimeDomainStage ** stage
stage is pointer to an array of stage object pointers
TimeDomainStages()
The Stages class constructor.
int numberOfStages
numberOfStages is the number of stages in the <stages> element.
~TimeDomainStages()
The Stages class destructor.
The in-memory representation of the variable element.
Variable()
The Variable class constructor.
double ub
ub corresponds to the optional attribute that holds the variable upper bound.
std::string name
name corresponds to the optional attribute that holds the variable name, the default value is empty
~Variable()
The Variable class destructor.
double lb
lb corresponds to the optional attribute that holds the variable lower bound.
char type
type corresponds to the attribute that holds the variable type: C (Continuous), B (binary),...
The in-memory representation of the variables element.
Variables()
The Variables class constructor.
~Variables()
The Variables class destructor.
int numberOfVariables
numberOfVariables is the number of variables in the instance
Variable ** var
Here we define a pointer to an array of var pointers.