OSInstance.h
Go to the documentation of this file.
1 
33 #ifndef OSINSTANCE_H
34 #define OSINSTANCE_H
35 #include "OSParameters.h"
36 #include "OSDataStructures.h"
37 #include "OSnLNode.h"
38 #include "OSExpressionTree.h"
39 #include <string>
40 #include <map>
41 
42 
48 public:
49 
52 
55 
57  std::string description;
58 
60  std::string name;
61 
63  std::string source;
64 };//class InstanceHeader
65 
66 
67 
71 class Variable{
72 public:
74  Variable();
75 
77  ~Variable();
78 
82  double lb;
83 
87  double ub;
88 
92  //double init;
93 
97  char type;
98 
102  std::string name;
103 
107  //std::string initString;
108 }; // class Variable
109 
110 
114 class Variables{
115 public:
116 
118  Variables();
119 
121  ~Variables();
122 
124  int numberOfVariables;
125 
127  Variable **var;
128 }; // class Variables
129 
130 
135 class ObjCoef{
136 public:
137 
139  ObjCoef();
140 
142  ~ObjCoef();
143 
147  int idx;
148 
152  double value;
153 };//class Coef
154 
159 class Constraint{
160 public:
161 
163  Constraint();
164 
166  ~Constraint();
167 
169  std::string name;
170 
172  double constant;
173 
175  double lb;
176 
178  double ub;
179 };//class Constraint
180 
181 
186 class Constraints{
187 public:
188 
190  Constraints();
191 
193  ~Constraints();
194 
199 
202  Constraint **con;
203 };//class Constraints
204 
205 
206 
211 class Objective{
212 public:
213 
215  Objective();
216 
218  ~Objective();
219 
221  std::string name;
222 
226  std::string maxOrMin;
227 
231  double constant;
232 
236  double weight;
237 
241  int numberOfObjCoef;
242 
245  ObjCoef **coef;
246 };//class Objective
247 
252 class Objectives{
253 public:
254 
256  Objectives();
257 
259  ~Objectives();
260 
264  int numberOfObjectives;
265 
268  Objective **obj;
269 };//class Objectives
270 
283 public:
284 
287 
290 
294  int numberOfValues;
295 
299  IntVector *start;
300 
302  IntVector *rowIdx;
303 
305  IntVector *colIdx;
306 
316 };//class LinearConstraintCoefficients
317 
318 
328 class QuadraticTerm{
329 public:
330 
332  QuadraticTerm();
333 
335  ~QuadraticTerm();
336 
340  int idx;
341 
345  int idxOne;
346 
350  int idxTwo;
351 
353  double coef;
354 }; // QuadraticTerm
355 
356 
357 
358 
364 class QuadraticCoefficients {
365 public:
366 
369 
372 
377 
381 }; // QuadraticCoefficients
382 
383 
388 class Nl{
389 public:
391  int idx;
392 
399 
402 
406  Nl();
407 
411  ~Nl();
412 };//end Nl
413 
418 class NonlinearExpressions {
419 public:
420 
423 
426 
432 
435  Nl **nl;
436 }; // NonlinearExpression
437 
438 
439 
444 class TimeDomainStageVar {
445 public:
446 
449 
452 
454  int idx;
455 }; // TimeDomainStageVar
456 
462 public:
463 
466 
469 
471  int numberOfVariables;
472 
474  int startIdx;
475 
478 }; // TimeDomainStageVariables
479 
480 
485 class TimeDomainStageCon {
486 public:
487 
490 
493 
495  int idx;
496 }; // TimeDomainStageCon
497 
503 public:
504 
507 
510 
513 
515  int startIdx;
516 
519 }; // TimeDomainStageConstraints
520 
521 
526 class TimeDomainStageObj {
527 public:
528 
531 
534 
536  int idx;
537 }; // TimeDomainStageObj
538 
544 public:
545 
548 
551 
553  int numberOfObjectives;
554 
556  int startIdx;
557 
560 }; // TimeDomainStageObjectives
561 
562 
567 class TimeDomainStage {
568 public:
569 
571  TimeDomainStage();
572 
575 
579  std::string name;
580 
583 
586 
589 }; // TimeDomainStage
590 
595 class TimeDomainStages {
596 public:
597 
600 
603 
607  int numberOfStages;
608 
611 }; // Stages
612 
617 class TimeDomainInterval {
618 public:
619 
622 
625 
629  double start;
630 
634  double horizon;
635 }; // Interval
636 
641 class TimeDomain {
642 public:
643 
645  TimeDomain();
646 
648  ~TimeDomain();
649 
653 
657 }; // TimeDomain
658 
675 class InstanceData{
676 public:
677 
679  InstanceData();
680 
682  ~InstanceData();
683 
686 
689 
692 
697 
702 
707 
712 }; // class InstanceData
713 
714 
741 class OSInstance {
742 public:
743 
745  OSInstance();
746 
748  ~OSInstance();
749 
752 
755 
756 private:
760  std::string m_sInstanceName;
764  std::string m_sInstanceSource;
768  std::string m_sInstanceDescription;
769 
773  bool m_bProcessVariables ;
774 
778  int m_iVariableNumber;
779 
784 
789 
794 
799 
803  int *m_miQuadRowIndexes;
804 
809 
814 
820 
826 
831 
837 
841  std::string* m_msVariableNames;
842 
847  //double* m_mdVariableInitialValues ;
848 
853  //std::string* m_msVariableInitialStringValues;
854 
859  char* m_mcVariableTypes;
860 
864  double* m_mdVariableLowerBounds;
865 
869  double* m_mdVariableUpperBounds;
870 
875 
879  int m_iObjectiveNumber;
880 
885 
889  std::string* m_msObjectiveNames;
890 
894  std::string* m_msMaxOrMins;
895 
899  int* m_miNumberOfObjCoef;
900 
904  double* m_mdObjectiveConstants;
905 
909  double* m_mdObjectiveWeights;
910 
916 
921 
927 
932 
937 
942 
946  std::string* m_msConstraintNames;
947 
952 
957 
962  double* m_mdConstraintConstants;
963 
968  char* m_mcConstraintTypes;
969 
974 
980 
984  bool m_bColumnMajor;
985 
989  bool m_binitForAlgDiff;
990 
991 
997 
1003 
1004 
1009 
1015 
1020 
1025 
1029  int m_iJacValueSize;
1030 
1034  int *m_miJacStart;
1035 
1039  int *m_miJacIndex;
1040 
1044  double *m_mdJacValue;
1045 
1046 
1051  int *m_miJacNumConTerms;
1052 
1057 
1063 
1069 
1072  bool m_bQTermsAdded;
1073 
1078  unsigned int m_iNumberOfNonlinearVariables ;
1079 
1084 
1089 
1095 
1100 
1105 
1110  std::map<int, OSExpressionTree*> m_mapExpressionTrees ;
1111 
1112 
1113 
1114  std::map<int, int> m_mapOSADFunRangeIndex ;
1115 
1121 
1126 
1131 
1137 
1141  std::map<int, int> m_mapAllNonlinearVariablesIndex;
1142 
1147 
1153 
1160  std::map<int, OSExpressionTree*> m_mapExpressionTreesMod ;
1161 
1166  bool m_bOSADFunIsCreated;
1167 
1172  bool m_bCppADTapesBuilt;
1173 
1178  bool m_bCppADMustReTape;
1179 
1184 
1189 
1194 
1199  std::map<int, std::vector<OSnLNode*> > m_mapExpressionTreesInPostfix ;
1200 
1201 
1207 
1212  double **m_mmdObjGradient;
1213 
1214  //define the vectors
1215 
1220  std::vector<double> m_vdX;
1221 
1226  std::vector<double> m_vdYval;
1227 
1233  std::vector<bool> m_vbLagHessNonz;
1234 
1239  std::vector<double> m_vdYjacval;
1240 
1245  std::vector<double> m_vdw;
1246 
1251  std::vector<double> m_vdLambda;
1252 
1253 
1258  std::vector<double> m_vdDomainUnitVec;
1259 
1264  std::vector<double> m_vdRangeUnitVec;
1265 
1266 
1270  bool m_bProcessTimeDomain;
1271 
1275  bool m_bProcessTimeStages;
1276 
1281 
1285  bool m_bFiniteTimeStages;
1286 
1291 
1295  std::string m_sTimeDomainFormat;
1296 
1301  std::string* m_msTimeDomainStageNames;
1302 
1308 
1314 
1320 
1326 
1332 
1338 
1339 
1346  bool processVariables() ;
1347 
1354  bool processObjectives();
1355 
1356 
1363  bool processConstraints();
1364 
1365 
1373 
1374 
1375 public:
1376 
1381  std::string getInstanceName();
1382 
1383 
1388  std::string getInstanceSource();
1389 
1390 
1396  std::string getInstanceDescription();
1397 
1403  int getVariableNumber();
1404 
1411  std::string* getVariableNames();
1412 
1420  //double* getVariableInitialValues();
1421 
1429  //std::string* getVariableInitialStringValues();
1430 
1442  char* getVariableTypes();
1443 
1449 
1455 
1462  double* getVariableLowerBounds();
1463 
1470  double* getVariableUpperBounds();
1471 
1477  int getObjectiveNumber();
1478 
1479 
1486  std::string* getObjectiveNames();
1487 
1494  std::string* getObjectiveMaxOrMins();
1495 
1505 
1512  double* getObjectiveConstants();
1513 
1520  double* getObjectiveWeights();
1521 
1533 
1540  double** getDenseObjectiveCoefficients();
1541 
1547  int getConstraintNumber();
1548 
1555  std::string* getConstraintNames();
1556 
1563  double* getConstraintLowerBounds();
1564 
1571  double *getConstraintUpperBounds();
1572 
1585  char* getConstraintTypes();
1586 
1593 
1594 
1602 
1603 
1611 
1619 
1626 
1636 
1644  int* getQuadraticRowIndexes();
1645 
1652 
1659 
1660 
1667 
1675 
1682  std::vector<OSnLNode*> getNonlinearExpressionTreeInPostfix( int rowIdx);
1683 
1691  std::vector<OSnLNode*> getNonlinearExpressionTreeModInPostfix( int rowIdx);
1692 
1699  std::vector<OSnLNode*> getNonlinearExpressionTreeInPrefix( int rowIdx);
1700 
1708  std::vector<OSnLNode*> getNonlinearExpressionTreeModInPrefix( int rowIdx);
1709 
1710 
1715 
1720 
1724  std::map<int, OSExpressionTree* > getAllNonlinearExpressionTrees();
1725 
1726 
1730  std::map<int, OSExpressionTree* > getAllNonlinearExpressionTreesMod();
1731 
1738 
1739 
1746 
1747 
1755 
1756 
1764 
1765 
1771  std::string getTimeDomainFormat();
1772 
1778  int getTimeDomainStageNumber();
1779 
1785  std::string* getTimeDomainStageNames();
1786 
1793 
1800 
1807 
1813  int** getTimeDomainStageVarList();
1814 
1820  int** getTimeDomainStageConList();
1821 
1827  int** getTimeDomainStageObjList();
1828 
1834  double getTimeDomainIntervalStart();
1835 
1841  double getTimeDomainIntervalHorizon();
1842 
1843 
1844 
1845  // the set() methods
1846 
1847 
1854  bool setInstanceSource(std::string source);
1855 
1862  bool setInstanceDescription(std::string description);
1863 
1864 
1871  bool setInstanceName(std::string name);
1872 
1879  bool setVariableNumber(int number);
1880 
1898  bool addVariable(int index, std::string name, double lowerBound, double upperBound, char type);
1899 
1918  bool setVariables(int number, std::string* names, double* lowerBounds,
1919  double* upperBounds, char* types);
1920 
1927  bool setObjectiveNumber(int number);
1928 
1946  bool addObjective(int index, std::string name, std::string maxOrMin, double constant, double weight, SparseVector* objectiveCoefficients);
1947 
1963  bool setObjectives(int number, std::string *names, std::string *maxOrMins, double *constants, double *weights, SparseVector **objectitiveCoefficients);
1964 
1971  bool setConstraintNumber(int number);
1972 
1986 bool addConstraint(int index, std::string name, double lowerBound, double upperBound, double constant);
1987 
1999 bool setConstraints(int number, std::string* names, double* lowerBounds, double* upperBounds, double* constants);
2000 
2019 bool setLinearConstraintCoefficients(int numberOfValues, bool isColumnMajor,
2020  double* values, int valuesBegin, int valuesEnd,
2021  int* indexes, int indexesBegin, int indexesEnd,
2022  int* starts, int startsBegin, int startsEnd);
2023 
2039  bool setQuadraticTerms(int number,
2040  int* rowIndexes, int* varOneIndexes, int* varTwoIndexes, double* coefficients,
2041  int begin, int end);
2042 
2056  bool setQuadraticTermsInNonlinearExpressions(int number,
2057  int* rowIndexes, int* varOneIndexes, int* varTwoIndexes, double* coefficients);
2058 
2059 
2060 
2061  // nonlinear API methods
2062 
2063 
2070 
2084  double calculateFunctionValue(int idx, double* x, bool new_x);
2085 
2100  double *calculateAllConstraintFunctionValues(double* x, double *objLambda, double *conLambda,
2101  bool new_x, int highestOrder);
2102 
2116  double *calculateAllConstraintFunctionValues(double* x, bool new_x);
2117 
2133  double *calculateAllObjectiveFunctionValues(double* x, double *objLambda, double *conLambda,
2134  bool new_x, int highestOrder);
2135 
2149  double *calculateAllObjectiveFunctionValues(double* x, bool new_x);
2150 
2151 
2166  SparseJacobianMatrix *calculateAllConstraintFunctionGradients(double* x, double *objLambda,
2167  double *conLambda, bool new_x, int highestOrder);
2168 
2169 
2185  SparseVector *calculateConstraintFunctionGradient(double* x, double *objLambda, double *conLambda,
2186  int idx, bool new_x, int highestOrder);
2187 
2201  SparseVector *calculateConstraintFunctionGradient(double* x, int idx, bool new_x );
2202 
2217  double **calculateAllObjectiveFunctionGradients(double* x, double *objLambda, double *conLambda,
2218  bool new_x, int highestOrder);
2219 
2235  double *calculateObjectiveFunctionGradient(double* x, double *objLambda, double *conLambda,
2236  int objIdx, bool new_x, int highestOrder);
2237 
2250  double *calculateObjectiveFunctionGradient(double* x, int objIdx, bool new_x );
2251 
2269  SparseHessianMatrix *calculateLagrangianHessian( double* x, double *objLambda, double *conLambda,
2270  bool new_x, int highestOrder);
2271 
2284  SparseHessianMatrix *calculateHessian( double* x, int idx, bool new_x);
2285 
2286 
2292 
2298 
2304 
2309  std::map<int, int> getAllNonlinearVariablesIndexMap( );
2310 
2316 
2321  bool addQTermsToExressionTree();
2322 
2328 
2334 
2335 #ifdef COIN_HAS_CPPAD
2336 
2340  CppAD::ADFun<double> *Fad;
2341 #endif
2342 
2353  bool createOSADFun(std::vector<double> vdX );
2354 
2365  std::vector<double> forwardAD(int p, std::vector<double> vdX);
2366 
2377  std::vector<double> reverseAD(int p, std::vector<double> vdlambda);
2378 
2391  int getADSparsityHessian();
2392 
2412  bool getIterateResults(double *x, double *objLambda, double *conLambda,
2413  bool new_x, int highestOrder);
2414 
2415 
2416 
2429  bool getZeroOrderResults(double *x, double *objLambda, double *conLambda);
2430 
2443  bool getFirstOrderResults(double *x, double *objLambda, double *conLambda );
2444 
2457  bool getSecondOrderResults(double *x, double *objLambda, double *conLambda );
2458 
2459 
2469  bool initForAlgDiff();
2470 
2480  bool initObjGradients();
2481 
2482 
2487  bool bUseExpTreeForFunEval;
2488 
2489 
2493  bool setTimeDomain(std::string format);
2494 
2498  bool setTimeDomainStages(int number, std::string *names);
2499 
2505  bool setTimeDomainStageVariablesOrdered(int numberOfStages, int *numberOfVariables, int *startIdx);
2506 
2512  bool setTimeDomainStageVariablesUnordered(int numberOfStages, int *numberOfVariables, int **varIndex);
2513 
2519  bool setTimeDomainStageConstraintsOrdered(int numberOfStages, int *numberOfConstraints, int *startIdx);
2520 
2526  bool setTimeDomainStageConstraintsUnordered(int numberOfStages, int *numberOfConstraints, int **conIndex);
2527 
2533  bool setTimeDomainStageObjectivesOrdered(int numberOfStages, int *numberOfObjectives, int *startIdx);
2534 
2540  bool setTimeDomainStageObjectivesUnordered(int numberOfStages, int *numberOfObjectives, int **varIndex);
2541 
2545  bool setTimeDomainInterval(double start, double horizon);
2546 
2547 
2548 }; //class OSInstance
2549 
2550 #endif
2551 
a data structure for holding quadratic terms
Definition: OSGeneral.h:431
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.
double * values
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.
int * getTimeDomainStageNumberOfConstraints()
Get the number of constraints contained in each time stage.
bool setQuadraticTerms(int number, int *rowIndexes, int *varOneIndexes, int *varTwoIndexes, double *coefficients, int begin, int end)
set quadratic terms
bool m_bCppADMustReTape
is true if a CppAD Expresion Tree has an expression that can change depending on the value of the inp...
Definition: OSInstance.h:2780
std::string name
name corresponds to the optional attribute that holds the variable name, the default value is empty ...
Definition: OSInstance.h:71
Constraints * constraints
constraints is a pointer to a Constraints object
Definition: OSInstance.h:2191
std::string name
the name of the problem instance
Definition: OSInstance.h:60
~InstanceHeader()
The InstanceHeader class destructor.
int getNumberOfIntegerVariables()
getNumberOfIntegerVariables
~TimeDomainStageConstraints()
The TimeDomainStageConstraints class destructor.
bool m_bProcessLinearConstraintCoefficients
-—— data items for linear constraint coefficients -——
Definition: OSInstance.h:2495
bool processConstraints()
process constraints.
bool getSparseJacobianFromColumnMajor()
char * getVariableTypes()
Get variable initial values.
std::string name
the name of the objective function
Definition: OSInstance.h:152
bool m_bDuplicateExpressionTreesMap
m_bDuplicateExpressionTreeMap is true if m_mapExpressionTrees was duplicated.
Definition: OSInstance.h:2785
This file defines the OSnLNode class along with its derived classes.
ScalarExpressionTree * getNonlinearExpressionTree(int rowIdx)
Get the expression tree for a given row index.
bool addVariable(int index, std::string name, double lowerBound, double upperBound, char type)
add a variable.
std::string name
name corresponds to the optional attribute that holds the name of the stage; the default value is emp...
Definition: OSInstance.h:2075
InstanceData()
The InstanceData class constructor.
~Constraints()
The Constraints class destructor.
Definition: OSInstance.cpp:713
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 &lt;obj&gt; element.
Definition: OSInstance.h:2019
int idx
idx gives the index of this variable
Definition: OSInstance.h:1944
~Variables()
The Variables class destructor.
Definition: OSInstance.cpp:586
OSExpressionTree * m_LagrangianExpTree
m_LagrangianExpTree is an OSExpressionTree object that is the expression tree for the Lagrangian func...
Definition: OSInstance.h:1120
bool getIterateResults(double *x, double *objLambda, double *conLambda, bool new_x, int highestOrder)
end revised AD code
int * getTimeDomainStageNumberOfVariables()
Get the number of variables contained in each time stage.
LinearConstraintCoefficients()
The LinearConstraintCoefficients class constructor.
Definition: OSInstance.cpp:734
IntVector * rowIdx
a pointer of row indices if the problem is stored by column
Definition: OSInstance.h:309
double calculateFunctionValue(int idx, double *x, bool new_x)
Calculate the function value for function (constraint or objective) indexed by idx.
int m_iConstraintNumber
m_iConstraintNumber is the number of constraints.
Definition: OSInstance.h:2455
int m_iJacValueSize
m_iJacValueSize is the number of nonzero partial derivates in the Jacobian.
Definition: OSInstance.h:2655
std::string * m_msVariableNames
m_msVariableNames holds an array of variable names.
Definition: OSInstance.h:2368
bool bUseExpTreeForFunEval
bUseExpTreeForFunEval is set to true if you wish to use the OS Expression Tree for function evaluatio...
Definition: OSInstance.h:4899
NonlinearExpressions * nonlinearExpressions
nonlinearExpressions is a pointer to a NonlinearExpressions object
Definition: OSInstance.h:2206
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.
Definition: OSInstance.cpp:557
int getVariableNumber()
Get number of variables.
std::vector< double > m_vdw
m_vdYval is a vector of derivatives – output from a reverse sweep
Definition: OSInstance.h:2842
double * m_mdObjectiveConstants
m_mdObjectiveConstants holds an array of objective constants (default = 0.0).
Definition: OSInstance.h:2421
bool m_bLagrangianSparseHessianCreated
m_bLagrangianSparseHessianCreated is true if the sparse Hessian Matrix for the Lagrangian was created...
Definition: OSInstance.h:2735
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 ...
Definition: OSInstance.h:2729
TimeDomain * timeDomain
timeDomain is a pointer to a TimeDomain object
Definition: OSInstance.h:2226
int idx
idx gives the index of this variable
Definition: OSInstance.h:2030
int ** m_mmiTimeDomainStageVarList
m_mmiTimeDomainStageVarList holds the list of variables in each stage.
Definition: OSInstance.h:3021
std::string m_sInstanceDescription
m_sInstanceDescription holds the instance description.
Definition: OSInstance.h:2318
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.
bool m_bProcessQuadraticTerms
m_bProcessQuadraticTerms holds whether the quadratic terms are processed.
Definition: OSInstance.h:2543
TimeDomainStageObj ** obj
obj is a pointer to an array of TimeDomainStageObj object pointers
Definition: OSInstance.h:2054
int getLinearConstraintCoefficientNumber()
Get number of specified (usually nonzero) linear constraint coefficient values.
int * getNonlinearExpressionTreeModIndexes()
Get all the nonlinear expression tree indexes, i.e., indexes of rows (objectives or constraints) that...
IntVector * colIdx
a pointer of column indices if the problem is stored by row
Definition: OSInstance.h:312
std::string maxOrMin
declare the objective function to be a max or a min
Definition: OSInstance.h:157
~TimeDomainInterval()
The Interval class destructor.
QuadraticCoefficients()
The QuadraticCoefficients class constructor.
Definition: OSInstance.cpp:786
The in-memory representation of the &lt;linearConstraintCoefficients&gt; element.
Definition: OSInstance.h:288
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
Definition: OSInstance.h:176
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.
Definition: OSInstance.h:2795
bool m_bProcessObjectives
-—— data items for Objectives -——
Definition: OSInstance.h:2391
The in-memory representation of the objective function &lt;coef&gt; element.
Definition: OSInstance.h:110
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.
Definition: OSInstance.h:2802
int idxTwo
idxTwo is the index of the second variable in the quadratic term
Definition: OSInstance.h:363
QuadraticTerm ** qTerm
qTerm is a pointer to an array of QuadraticTerm object pointers
Definition: OSInstance.h:397
Constraint ** con
con is pointer to an array of Constraint object pointers
Definition: OSInstance.h:268
bool m_bProcessExpressionTrees
m_bProcessExpressionTrees is true if the expression trees have been processed.
Definition: OSInstance.h:2633
int * getNonlinearExpressionTreeIndexes()
Get all the nonlinear expression tree indexes, i.e., indexes of rows (objectives or constraints) that...
SparseJacobianMatrix * calculateAllConstraintFunctionGradients(double *x, double *objLambda, double *conLambda, bool new_x, int highestOrder)
Calculate the gradient of all constraint functions.
double * m_mdConstraintConstants
m_mdConstraintConstants holds an array of constraint constants (default = 0.0).
Definition: OSInstance.h:2481
TimeDomainStageVariables * variables
variables is a pointer to a TimeDomainVariables object
Definition: OSInstance.h:2078
std::string m_sInstanceSource
m_sInstanceSource holds the instance source.
Definition: OSInstance.h:2314
TimeDomainInterval()
The Interval class constructor.
int numberOfConstraints
numberOfConstraints gives the number of constraints contained in this stage
Definition: OSInstance.h:2005
TimeDomainStageCon ** con
con is a pointer to an array of TimeDomainStageCon object pointers
Definition: OSInstance.h:2011
InstanceHeader * instanceHeader
A pointer to an InstanceHeader object.
Definition: OSInstance.h:751
ObjCoef()
The ObjCoef class constructor.
Definition: OSInstance.cpp:608
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.
double * m_mdConstraintUpperBounds
m_mdConstraintUpperBounds holds an array of constraint upper bounds (default = INF).
Definition: OSInstance.h:2475
std::vector< double > m_vdDomainUnitVec
m_vdDomainUnitVec is a unit vector in the domain space
Definition: OSInstance.h:2852
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...
Variables()
The Variables class constructor.
Definition: OSInstance.cpp:577
~ObjCoef()
The ObjCoef class destructor.
Definition: OSInstance.cpp:617
std::string * m_msMaxOrMins
m_msMaxOrMins holds a std::string array of objective maxOrMins (&quot;max&quot; or &quot;min&quot;).
Definition: OSInstance.h:2411
The in-memory representation of the element.
Definition: OSInstance.h:1933
int getObjectiveNumber()
Get number of objectives.
char type
type corresponds to the attribute that holds the variable type: C (Continuous), B (binary)...
Definition: OSInstance.h:66
int m_iVariableNumber
m_iVariableNumber holds the variable number.
Definition: OSInstance.h:2338
bool m_bNonlinearExpressionTreeIndexesProcessed
m_bNonlinearExpressionTreeIndexesProcessed is true if getNonlinearExpressionTreeIndexes() has been ca...
Definition: OSInstance.h:2573
int numberOfVariables
numberOfVariables is the number of variables in the instance
Definition: OSInstance.h:94
~Nl()
default destructor.
Definition: OSInstance.cpp:828
int m_iObjectiveNumberNonlinear
m_iObjectiveNumber is the number of objective functions with a nonlinear term.
Definition: OSInstance.h:2401
The in-memory representation of the &lt;instanceData&gt; element.
Definition: OSInstance.h:2174
std::map< int, int > getAllNonlinearVariablesIndexMap()
~Objective()
The Objective class destructor.
Definition: OSInstance.cpp:638
std::string * getVariableNames()
Get variable names.
~OSInstance()
The OSInstance class destructor.
Definition: OSInstance.cpp:167
bool m_bProcessConstraints
-—— data items for Constraints -——
Definition: OSInstance.h:2450
The in-memory representation of the &lt;constraints&gt; child of the &lt;stage&gt; element.
Definition: OSInstance.h:1994
int getNumberOfNonlinearExpressions()
Get number of nonlinear expressions.
std::vector< double > m_vdX
-—— data vectors for nonlinear optimization -——
Definition: OSInstance.h:2821
int ** m_mmiTimeDomainStageObjList
m_mmiTimeDomainStageObjList holds the list of objectives in each stage.
Definition: OSInstance.h:3041
int * m_miJacNumConTerms
m_miJacNumConTerms holds a int array of the number of constant terms (gradient does not change) for t...
Definition: OSInstance.h:2676
double lb
lb is the lower bound on the constraint
Definition: OSInstance.h:235
The in-memory representation of the &lt;constraints&gt; element.
Definition: OSInstance.h:251
int numberOfObjectives
numberOfObjectives is the number of objective functions in the instance
Definition: OSInstance.h:201
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...
Definition: OSInstance.h:2814
int ** m_mmiTimeDomainStageConList
m_mmiTimeDomainStageConList holds the list of constraints in each stage.
Definition: OSInstance.h:3031
NonlinearExpressions()
The NonlinearExpressions class constructor.
Definition: OSInstance.cpp:844
std::string * m_msTimeDomainStageNames
m_msTimeDomainStageNames holds the names of the time stages.
Definition: OSInstance.h:3008
int * m_miNonlinearExpressionTreeIndexes
m_miNonlinearExpressionTreeIndexes is an integer pointer to the distinct rows indexes in the nonlinea...
Definition: OSInstance.h:2580
std::vector< double > m_vdLambda
m_vdYval is a vector of Lagrange multipliers
Definition: OSInstance.h:2847
int numberOfObjectives
numberOfObjectives gives the number of objectives contained in this stage
Definition: OSInstance.h:2048
std::map< int, int > m_mapAllNonlinearVariablesIndex
m_mapAllNonlinearVariablesIndexMap is a map of the variables in the Lagrangian function ...
Definition: OSInstance.h:2740
bool setTimeDomainStages(int number, std::string *names)
This sets the number (and optionally names) of the time stages.
TimeDomainStageVar()
The TimeDomainStageVar class constructor.
int * m_miTimeDomainStageObjectiveNumber
m_miTimeDomainStageObjectiveNumber holds the number of objectives in each stage.
Definition: OSInstance.h:3036
IntVector * start
a pointer to the start of each row or column stored in sparse format
Definition: OSInstance.h:306
double * getObjectiveWeights()
Get objective weights.
double ub
ub is the upper bound on the constraint
Definition: OSInstance.h:238
~LinearConstraintCoefficients()
The LinearConstraintCoefficients class destructor.
Definition: OSInstance.cpp:748
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 ...
Definition: OSInstance.h:2670
bool setInstanceName(std::string name)
set the instance name.
OSInstance()
The OSInstance class constructor.
Definition: OSInstance.cpp:36
TimeDomainStages * stages
stages is a pointer to a Stages object
Definition: OSInstance.h:2151
double ** getDenseObjectiveCoefficients()
getDenseObjectiveCoefficients.
bool initObjGradients()
This should be called by initForAlgDiff()
The in-memory representation of the &lt;nonlinearExpressions&gt; element.
Definition: OSInstance.h:452
int m_iHighestTaylorCoeffOrder
m_iHighestTaylorCoeffOrder is the order of highest calculated Taylor coefficient
Definition: OSInstance.h:2687
bool getSecondOrderResults(double *x, double *objLambda, double *conLambda)
Calculate second derivatives.
SparseJacobianMatrix * getJacobianSparsityPattern()
double getTimeDomainIntervalStart()
Get the start for the time domain interval.
int * m_miJacStart
m_miJacStart holds a int array of starts for the Jacobian matrix in sparse form (row major)...
Definition: OSInstance.h:2660
int * m_miNonlinearExpressionIndexes
m_miNonlinearExpressionIndexes holds an integer array of nonlinear expression indexes, negative indexes correspond to objectives.
Definition: OSInstance.h:2628
int numberOfVariables
numberOfVariables gives the number of variables contained in this stage
Definition: OSInstance.h:1962
std::string * m_msObjectiveNames
m_msObjectiveNames holds an array of objective names.
Definition: OSInstance.h:2406
int * m_miTimeDomainStageVariableNumber
m_miTimeDomainStageVariableNumber holds the number of variables in each stage.
Definition: OSInstance.h:3016
TimeDomainStage ** stage
stage is pointer to an array of stage object pointers
Definition: OSInstance.h:2107
InstanceHeader()
The InstanceHeader class constructor.
double * m_mdConstraintFunctionValues
m_mdConstraintFunctionValues holds a double array of constraint function values – the size of the arr...
Definition: OSInstance.h:2644
int getNumberOfNonlinearConstraints()
double * m_mdConstraintLowerBounds
m_mdConstraintLowerBounds holds an array of constraint lower bounds (default = -INF).
Definition: OSInstance.h:2470
int m_iObjectiveNumber
m_iObjectiveNumber is the number of objective functions.
Definition: OSInstance.h:2396
double weight
weight is the weight applied to the given objective function, 1.0 by default
Definition: OSInstance.h:167
bool setConstraintNumber(int number)
set the number of constraints.
a double vector data structure
Definition: OSGeneral.h:609
bool m_bNonlinearExpressionTreeModIndexesProcessed
m_bNonlinearExpressionTreeModIndexesProcessed is true if getNonlinearExpressionTreeModIndexes has bee...
Definition: OSInstance.h:2593
The in-memory representation of the &lt;obj&gt; element.
Definition: OSInstance.h:141
~InstanceData()
The InstanceData class destructor.
Nl ** nl
nl is pointer to an array of Nl object pointers
Definition: OSInstance.h:469
DoubleVector * value
a pointer to the array of nonzero values being stored
Definition: OSInstance.h:315
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 &lt;objectives&gt; element.
Definition: OSInstance.h:188
fint end
double lb
lb corresponds to the optional attribute that holds the variable lower bound.
Definition: OSInstance.h:56
double horizon
horizon is the end of the planning period in the &lt;interval&gt; element.
Definition: OSInstance.h:2132
a sparse matrix data structure
Definition: OSGeneral.h:223
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
Definition: OSInstance.h:162
int m_iConstraintNumberNonlinear
m_iConstraintNumberNonlinear is the number of constraints that have a nonlinear term.
Definition: OSInstance.h:2460
char * getConstraintTypes()
Get constraint types.
std::map< int, OSExpressionTree * > m_mapExpressionTreesMod
m_mapExpressionTreesMod holds a map of expression trees, with the key being the row index and value b...
Definition: OSInstance.h:1160
Variable ** var
Here we define a pointer to an array of var pointers.
Definition: OSInstance.h:97
std::vector< double > m_vdRangeUnitVec
m_vdRangeUnitVec is a unit vector in the range space
Definition: OSInstance.h:2857
bool m_bProcessExpressionTreesMod
m_bProcessExpressionTreesMod is true if the modified expression trees have been processed.
Definition: OSInstance.h:2638
double start
start is the start of the planning period in the &lt;interval&gt; element.
Definition: OSInstance.h:2127
double * m_mdVariableUpperBounds
m_mdVariableUpperBounds holds a double array of variable upper bounds (default = INF).
Definition: OSInstance.h:2384
int m_iNumberOfIntegerVariables
m_iNumberOfIntegerVariables holds the number of integer variables.
Definition: OSInstance.h:2343
bool m_bProcessTimeInterval
m_bProcessTimeInterval holds whether a time interval has been processed.
Definition: OSInstance.h:2988
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...
Definition: OSInstance.h:2774
std::map< int, OSExpressionTree * > m_mapExpressionTrees
m_mapExpressionTrees holds a hash map of expression tree pointers, with the key being the row index a...
Definition: OSInstance.h:1110
double * m_mdObjectiveWeights
m_mdObjectiveWeights holds an array of objective weights (default = 1.0).
Definition: OSInstance.h:2426
double value
value is the value of the objective function coefficient corresponding to the variable with index idx...
Definition: OSInstance.h:128
The in-memory representation of the &lt;quadraticCoefficients&gt; element.
Definition: OSInstance.h:380
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 &lt;stages&gt; element.
Definition: OSInstance.h:2091
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...
Definition: OSInstance.h:2752
int idxOne
idxOne is the index of the first variable in the quadratic term
Definition: OSInstance.h:358
Objective()
The Objective class constructor.
Definition: OSInstance.cpp:624
bool setTimeDomainStageObjectivesUnordered(int numberOfStages, int *numberOfObjectives, int **varIndex)
This sets the objectives associated with each time domain stage in arbitrary order.
bool m_bProcessTimeDomain
-—— data items for time domain -——
Definition: OSInstance.h:2978
SparseVector ** m_mObjectiveCoefficients
m_mObjectiveCoefficients holds an array of objective coefficients, one set of objective coefficients ...
Definition: OSInstance.h:2432
bool m_bQuadraticRowIndexesProcessed
m_bQuadraticRowIndexesProcessed is true if getQuadraticRowIndexes() has been called.
Definition: OSInstance.h:2533
int numberOfValues
numberOfValues is the number of nonzero elements stored in the &lt;linearConstraintCoefficients&gt; element...
Definition: OSInstance.h:301
bool addConstraint(int index, std::string name, double lowerBound, double upperBound, double constant)
add a constraint.
Constraints()
The Constraints class constructor.
Definition: OSInstance.cpp:704
bool m_bFiniteTimeStages
m_bFiniteTimeStages holds whether the time domain has the form of finite (discrete) stages...
Definition: OSInstance.h:2993
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 * m_miNonLinearVarsReverseMap
m_miNonLinearVarsReverseMap maps the nonlinear variable number back into the original variable space ...
Definition: OSInstance.h:2746
int m_iNumberOfTimeStages
m_iNumberOfTimeStages holds the number of discrete stages
Definition: OSInstance.h:2998
bool setTimeDomain(std::string format)
This sets the format of the time domain (&quot;stages&quot;/&quot;interval&quot;/&quot;none&quot;)
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.
int * m_miNumberOfObjCoef
m_miNumberOfObjCoef holds an integer array of number of objective coefficients (default = 0)...
Definition: OSInstance.h:2416
double ub
ub corresponds to the optional attribute that holds the variable upper bound.
Definition: OSInstance.h:61
int idx
idx gives the index of this constraint
Definition: OSInstance.h:1987
a sparse vector data structure
Definition: OSGeneral.h:122
Variables * variables
variables is a pointer to a Variables object
Definition: OSInstance.h:2185
TimeDomainStage()
The TimeDomainStage class constructor.
ScalarExpressionTree * getLagrangianExpTree()
SparseMatrix * getLinearConstraintCoefficientsInColumnMajor()
Get linear constraint coefficients in column major.
int getTimeDomainStageNumber()
Get the number of stages that make up the time domain.
The in-memory representation of the &lt;timeDomain&gt; element.
Definition: OSInstance.h:2139
The in-memory representation of the &lt;con&gt; element.
Definition: OSInstance.h:1976
int m_iLinearConstraintCoefficientNumber
m_iLinearConstraintCoefficientNumber holds the number of specified (usually nonzero) linear constrain...
Definition: OSInstance.h:2501
bool setVariables(int number, std::string *names, double *lowerBounds, double *upperBounds, char *types)
set all the variable related elements.
~QuadraticCoefficients()
The QuadraticCoefficients class destructor.
Definition: OSInstance.cpp:796
double * getObjectiveConstants()
Get objective constants.
int numberOfConstraints
numberOfConstraints is the number of constraints in the instance
Definition: OSInstance.h:264
~TimeDomainStageObj()
The TimeDomainStageObj class destructor.
int m_iHighestOrderEvaluated
m_iHighestOrderEvaluated is the highest order derivative of the current iterate
Definition: OSInstance.h:2808
int startIdx
startdIdx gives the number of the first variable contained in this stage
Definition: OSInstance.h:1965
a sparse Jacobian matrix data structure
Definition: OSGeneral.h:300
std::string getInstanceName()
Get instance name.
bool m_bProcessVariables
-—— data items for Variables -——
Definition: OSInstance.h:2333
int getADSparsityHessian()
end revised AD code
InstanceData * instanceData
A pointer to an InstanceData object.
Definition: OSInstance.h:2278
int m_iQuadraticTermNumber
m_iQuadraticTermNumber holds the number of specified (usually nonzero) qTerms in the quadratic coeffi...
Definition: OSInstance.h:2549
int startIdx
startdIdx gives the number of the first constraint contained in this stage
Definition: OSInstance.h:2008
bool addQTermsToExressionTree()
The in-memory representation of the &lt;nl&gt; element.
Definition: OSInstance.h:410
int ** getTimeDomainStageConList()
Get the list of constraints in each stage.
an integer Vector data structure
Definition: OSGeneral.h:469
int idx
idx holds the row index of the nonlinear expression
Definition: OSInstance.h:414
std::vector< double > m_vdYval
m_vdYval is a vector of function values
Definition: OSInstance.h:2826
bool processVariables()
process variables.
char * m_mcConstraintTypes
m_mcConstraintTypes holds a char array of constraint types (R for range; L for &lt;=; G for &gt;=; E for =;...
Definition: OSInstance.h:2487
std::string * getObjectiveNames()
Get objective names.
double ** m_mmdDenseObjectiveCoefficients
m_mmdDenseObjectiveCoefficients holds an array of pointers, each pointer points to a vector of dense ...
Definition: OSInstance.h:2443
int m_iNonlinearExpressionNumber
m_iNonlinearExpressionNumber holds the number of nonlinear expressions.
Definition: OSInstance.h:2622
int getConstraintNumber()
Get number of constraints.
Objective ** obj
coef is pointer to an array of ObjCoef object pointers
Definition: OSInstance.h:205
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
Definition: OSInstance.h:2051
double getTimeDomainIntervalHorizon()
Get the horizon for the time domain interval.
bool setInstanceSource(std::string source)
set the instance source.
double * m_mdVariableLowerBounds
m_mdVariableLowerBounds holds a double array of variable lower bounds (default = 0.0).
Definition: OSInstance.h:2379
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 (&quot;&quot;) if a stage has not been given a name...
bool setInstanceDescription(std::string description)
set the instance description.
bool m_bProcessNonlinearExpressions
m_bProcessNonlinearExpressions holds whether the nonlinear expressions are processed.
Definition: OSInstance.h:2617
The in-memory representation of the &lt;instanceHeader&gt; element.
Definition: OSInstance.h:47
double coef
coef is the coefficient of the quadratic term
Definition: OSInstance.h:366
int getNumberOfQuadraticTerms()
Get the number of specified (usually nonzero) qTerms in the quadratic coefficients.
~TimeDomainStageVar()
The TimeDomainStageVar class destructor.
int * m_miTimeDomainStageConstraintNumber
m_miTimeDomainStageConstraintNumber holds the number of constraints in each stage.
Definition: OSInstance.h:3026
bool m_bDeleteExpressionTree
m_bDeleteExpressionTree is true, if in garbage collection, we should delete the osExpression tree obj...
Definition: OSInstance.h:427
TimeDomainStageConstraints * constraints
constraints is a pointer to a TimeDomainConstraints object
Definition: OSInstance.h:2081
The in-memory representation of the &lt;variables&gt; child of the &lt;stage&gt; element.
Definition: OSInstance.h:1951
std::string description
the problem instance description
Definition: OSInstance.h:57
bool m_bProcessTimeStages
m_bProcessTimeStages holds whether the time stages have been processed.
Definition: OSInstance.h:2983
QuadraticTerms * m_quadraticTerms
m_quadraticTerms holds the data structure for all the quadratic terms in the instance.
Definition: OSInstance.h:2555
Nl()
default constructor.
Definition: OSInstance.cpp:816
Objectives * objectives
objectives is a pointer to a Objectives object
Definition: OSInstance.h:2188
TimeDomainStageVar ** var
var is a pointer to an array of TimeDomainStageVar object pointers
Definition: OSInstance.h:1968
~QuadraticTerm()
The QuadraticTerm class destructor.
Definition: OSInstance.cpp:777
The in-memory representation of the &lt;stage&gt; element.
Definition: OSInstance.h:2062
std::vector< ExprNode * > getNonlinearExpressionTreeInPrefix(int rowIdx)
Get the prefix tokens for a given row index.
std::string getInstanceSource()
Get instance source.
bool initForAlgDiff()
This should be called by nonlinear solvers using callback functions.
int ** getTimeDomainStageObjList()
Get the list of objectives in each stage.
std::map< int, ScalarExpressionTree * > getAllNonlinearExpressionTrees()
TimeDomainStageVariables()
The TimeDomainStageVariables class constructor.
int * m_miQuadRowIndexes
m_miQuadRowIndexes is an integer pointer to the distinct row indexes with a quadratic term...
Definition: OSInstance.h:2538
double * calculateAllObjectiveFunctionValues(double *x, double *objLambda, double *conLambda, bool new_x, int highestOrder)
Calculate all of the objective function values.
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...
Definition: OSInstance.h:2587
double * getVariableUpperBounds()
Get variable upper bounds.
int ** getTimeDomainStageVarList()
Get the list of variables in each stage.
bool m_bColumnMajor
m_bColumnMajor holds whether the linear constraint coefficients are stored in column major (if m_bCol...
Definition: OSInstance.h:2507
std::vector< double > reverseAD(int p, std::vector< double > vdlambda)
Perform an AD reverse sweep.
The in-memory representation of the &lt;objectives&gt; child of the &lt;stage&gt; element.
Definition: OSInstance.h:2037
int numberOfNonlinearExpressions
numberOfNonlinearExpressions is the number of &lt;nl&gt; elements in the &lt;nonlinearExpressions&gt; element...
Definition: OSInstance.h:466
int numberOfObjCoef
numberOfObjCoef is the number of variables with a nonzero objective function coefficient ...
Definition: OSInstance.h:172
std::string m_sTimeDomainFormat
m_sTimeDomainFormat holds the format (&quot;stages&quot;/&quot;interval&quot;) of the time domain.
Definition: OSInstance.h:3003
std::vector< bool > m_vbLagHessNonz
m_vbLagHessNonz is a boolean vector holding the nonzero pattern of the Lagrangian of the Hessian ...
Definition: OSInstance.h:2832
int numberOfQuadraticTerms
numberOfQuadraticTerms is the number of quadratic terms in the &lt;quadraticCoefficients&gt; element...
Definition: OSInstance.h:393
int m_iNumberOfQuadraticRowIndexes
-—— data items for quadratic coefficients -——
Definition: OSInstance.h:2528
TimeDomainInterval * interval
interval is a pointer to an Interval object
Definition: OSInstance.h:2155
~Constraint()
The Constraint class destructor.
Definition: OSInstance.cpp:697
~TimeDomain()
The TimeDomain class destructor.
Objectives()
The Objectives class constructor.
Definition: OSInstance.cpp:657
bool getSparseJacobianFromRowMajor()
bool m_bOSADFunIsCreated
m_bOSADFunIsCreated is true if we have created the OSInstanc OSAD Function
Definition: OSInstance.h:2768
bool m_bNonLinearStructuresInitialized
m_bNonLinearStructuresInitialized is true if initializeNonLinearStructures() has been called...
Definition: OSInstance.h:2790
std::string * m_msConstraintNames
m_msConstraintNames holds an array of constraint names.
Definition: OSInstance.h:2465
TimeDomainStages()
The Stages class constructor.
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
Definition: OSInstance.h:2084
bool setVariableNumber(int number)
set the number of variables.
The in-memory representation of an OSiL instance..
Definition: OSInstance.h:2262
SparseMatrix * m_linearConstraintCoefficientsInColumnMajor
m_linearConstraintCoefficientsInColumnMajor holds the standard three-array data structure for linear ...
Definition: OSInstance.h:2514
~TimeDomainStages()
The Stages class destructor.
The in-memory representation of the variables element.
Definition: OSInstance.h:83
bool m_bQTermsAdded
m_bQTermsAdded is true if we added the quadratic terms to the expression tree
Definition: OSInstance.h:2559
bool processObjectives()
process objectives.
TimeDomainStageObj()
The TimeDomainStageObj class constructor.
QuadraticCoefficients * quadraticCoefficients
quadraticCoefficients is a pointer to a QuadraticCoefficients object
Definition: OSInstance.h:2201
~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)...
Definition: OSInstance.h:2665
int idx
idx is the index of the variable corresponding to the coefficient
Definition: OSInstance.h:123
~NonlinearExpressions()
The NonlinearExpressions class destructor.
Definition: OSInstance.cpp:853
OSExpressionTree * osExpressionTree
osExpressionTree contains the root of the OSExpressionTree
Definition: OSInstance.h:401
Constraint()
The Constraint class constructor.
Definition: OSInstance.cpp:685
int numberOfStages
numberOfStages is the number of stages in the &lt;stages&gt; element.
Definition: OSInstance.h:2104
int idx
idx is the index of the row in which the quadratic term appears
Definition: OSInstance.h:353
double * m_mdObjectiveFunctionValues
m_mdObjectiveFunctionValues holds a double array of objective function values – the size of the array...
Definition: OSInstance.h:2650
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 -——
Definition: OSInstance.h:2310
int * getTimeDomainStageNumberOfObjectives()
Get the number of objectives contained in each time stage.
The in-memory representation of a SparseHessianMatrix..
Definition: OSGeneral.h:376
char * m_mcVariableTypes
m_mcVariableTypes holds a char array of variable types (default = &#39;C&#39;).
Definition: OSInstance.h:2374
int m_iNumberOfBinaryVariables
m_iNumberOfBinaryVariables holds the number of binary variables.
Definition: OSInstance.h:2348
Used to hold the instance in memory.
std::string * getConstraintNames()
Get constraint names.
std::vector< double > m_vdYjacval
m_vdYval is a vector equal to a column or row of the Jacobian
Definition: OSInstance.h:2837
bool m_bGetDenseObjectives
m_bGetDenseObjectives holds whether the dense objective functions are processed.
Definition: OSInstance.h:2437
int m_iNumberOfNonlinearExpressionTreeIndexes
-—— data items for nonlinear expressions -——
Definition: OSInstance.h:2567
bool initializeNonLinearStructures()
Initialize the data structures for the nonlinear API.
int * getObjectiveCoefficientNumbers()
Get objective coefficient number.
~Objectives()
The Objectives class destructor.
Definition: OSInstance.cpp:666
LinearConstraintCoefficients * linearConstraintCoefficients
linearConstraintCoefficients is a pointer to a LinearConstraintCoefficients object ...
Definition: OSInstance.h:2196
int * m_miNonlinearExpressionTreeModIndexes
m_miNonlinearExpressionTreeModIndexes is an integer pointer to the distinct rows indexes in the modif...
Definition: OSInstance.h:2599
std::string source
the source of the problem instance
Definition: OSInstance.h:63
std::map< int, int > m_mapOSADFunRangeIndex
m_mapOSADFunRangeIndex is an inverse of the previous map.
Definition: OSInstance.h:2703
The in-memory representation of the &lt;qTerm&gt; element.
Definition: OSInstance.h:340
unsigned int m_iNumberOfNonlinearVariables
m_iNumberOfNonlinearVariables is the number of variables that appear in a nonlinear expression...
Definition: OSInstance.h:2612
double constant
constant is a value that is added to the constraint
Definition: OSInstance.h:232
std::vector< double > forwardAD(int p, std::vector< double > vdX)
Perform an AD forward sweep.
The in-memory representation of the variable element.
Definition: OSInstance.h:44
SparseMatrix * m_linearConstraintCoefficientsInRowMajor
m_linearConstraintCoefficientsInRowMajor holds the standard three-array data structure for linear con...
Definition: OSInstance.h:2521
bool m_bLagrangianExpTreeCreated
m_bLagrangianHessionCreated is true if a Lagrangian function for the Hessian has been created ...
Definition: OSInstance.h:2724
int * getQuadraticRowIndexes()
Get the indexes of rows which have a quadratic term.
int iNumberOfStartElements
iNumberOfStartElements counts the number of elements in the &lt;start&gt; section of &lt;linearConstraintCoeff...
Definition: OSInstance.h:322
bool processLinearConstraintCoefficients()
process linear constraint coefficients.
SparseJacobianMatrix * m_sparseJacMatrix
m_sparseJacMatrix is the Jacobian matrix stored in sparse matrix format
Definition: OSInstance.h:2681
~Variable()
The Variable class destructor.
Definition: OSInstance.cpp:570
int getNumberOfBinaryVariables()
getNumberOfBinaryVariables
std::string getInstanceDescription()
Get instance description.
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()
void fint fint fint real fint real * x
The in-memory representation of the &lt;con&gt; element.
Definition: OSInstance.h:218
int getNumberOfNonlinearExpressionTreeIndexes()
Get the number of unique nonlinear expression tree indexes.
std::string name
name is the name of the constraint
Definition: OSInstance.h:229
int getNumberOfNonlinearObjectives()
std::string getTimeDomainFormat()
Get the format of the time domain (&quot;stages&quot;/&quot;interval&quot;)
bool m_binitForAlgDiff
-—— data items for automatic differentiation -——
Definition: OSInstance.h:2606
QuadraticTerm()
The QuadraticTerm class constructor.
Definition: OSInstance.cpp:763
std::vector< ExprNode * > getNonlinearExpressionTreeInPostfix(int rowIdx)
Get the postfix tokens for a given row index.