OS  2.9.3
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
OSInstance.h
Go to the documentation of this file.
1 /* $Id: OSInstance.h 4985 2015-03-12 14:14:49Z tkr $ */
29 #ifndef OSINSTANCE_H
30 #define OSINSTANCE_H
31 #include "OSConfig.h"
32 #include "OSParameters.h"
33 #include "OSGeneral.h"
34 #include "OSMatrix.h"
35 #include "OSnLNode.h"
36 #include "OSExpressionTree.h"
37 #include <string>
38 #include <map>
39 
40 
44 class Variable
45 {
46 public:
48  Variable();
49 
51  ~Variable();
52 
56  double lb;
57 
61  double ub;
62 
66  char type;
67 
71  std::string name;
72 
76  bool IsEqual(Variable *that);
77 }; // class Variable
78 
79 
83 class Variables
84 {
85 public:
86 
88  Variables();
89 
91  ~Variables();
92 
95 
98 
102  bool IsEqual(Variables *that);
103 }; // class Variables
104 
105 
110 class ObjCoef
111 {
112 public:
113 
115  ObjCoef();
116 
118  ~ObjCoef();
119 
123  int idx;
124 
128  double value;
129 
133  bool IsEqual(ObjCoef *that);
134 };//class ObjCoef
135 
136 
142 {
143 public:
144 
146  Objective();
147 
149  ~Objective();
150 
152  std::string name;
153 
157  std::string maxOrMin;
158 
162  double constant;
163 
167  double weight;
168 
173 
177 
181  bool IsEqual(Objective *that);
182 };//class Objective
183 
189 {
190 public:
191 
193  Objectives();
194 
196  ~Objectives();
197 
202 
206 
210  bool IsEqual(Objectives *that);
211 };//class Objectives
212 
213 
219 {
220 public:
221 
223  Constraint();
224 
226  ~Constraint();
227 
229  std::string name;
230 
232  double constant;
233 
235  double lb;
236 
238  double ub;
239 
243  bool IsEqual(Constraint *that);
244 };//class Constraint
245 
246 
252 {
253 public:
254 
256  Constraints();
257 
259  ~Constraints();
260 
265 
269 
273  bool IsEqual(Constraints *that);
274 };//class Constraints
275 
276 
289 {
290 public:
291 
294 
297 
302 
303 
304 
309 
312 
315 
325 
330 };//class LinearConstraintCoefficients
331 
332 
343 {
344 public:
345 
347  QuadraticTerm();
348 
350  ~QuadraticTerm();
351 
355  int idx;
356 
360  int idxOne;
361 
365  int idxTwo;
366 
368  double coef;
369 
373  bool IsEqual(QuadraticTerm *that);
374 }; // QuadraticTerm
375 
376 
383 {
384 public:
385 
388 
391 
396 
400 
404  bool IsEqual(QuadraticCoefficients *that);
405 }; // QuadraticCoefficients
406 
407 
412 class Nl
413 {
414 public:
416  int idx;
417 
423 
430 
433 
437  Nl();
438 
442  ~Nl();
443 
447  bool IsEqual(Nl *that);
448 };//end Nl
449 
455 {
456 public:
457 
460 
463 
469 
471  Nl **nl;
472 
476  bool IsEqual(NonlinearExpressions *that);
477 }; // NonlinearExpressions
478 
479 
484 class Matrices
485 {
486 public:
487 
489  Matrices();
490 
492  ~Matrices();
493 
499 
502 
506  bool IsEqual(Matrices *that);
507 
517  bool setRandom(double density, bool conformant, int iMin, int iMax);
518 
524  bool deepCopyFrom(Matrices *that);
525 }; // Matrices
526 
527 
532 class Cone
533 {
534 public:
535 
537  Cone();
538 
540  ~Cone();
541 
547 
556 
559 
561  std::string name;
562 
564  int idx;
565 
569  virtual std::string getConeName();
570 
577  virtual std::string getConeInXML() = 0;
578 
579 
583  bool IsEqual(Cone *that);
584 
594  bool setRandom(double density, bool conformant, int iMin, int iMax);
595 
601  bool deepCopyFrom(Cone *that);
602 }; // Cone
603 
611 class NonnegativeCone : public Cone
612 {
613 public:
617  NonnegativeCone();
618 
623 
627  virtual std::string getConeName();
628 
635  virtual std::string getConeInXML();
636 
640  bool IsEqual(NonnegativeCone *that);
641 
651  bool setRandom(double density, bool conformant, int iMin, int iMax);
652 
658  bool deepCopyFrom(NonnegativeCone *that);
659 
660 };//end NonnegativeCone
661 
669 class NonpositiveCone : public Cone
670 {
671 public:
675  NonpositiveCone();
676 
681 
685  virtual std::string getConeName();
686 
693  virtual std::string getConeInXML();
694 
698  bool IsEqual(NonpositiveCone *that);
699 
709  bool setRandom(double density, bool conformant, int iMin, int iMax);
710 
716  bool deepCopyFrom(NonpositiveCone *that);
717 
718 };//end NonpositiveCone
719 
720 
728 class OrthantCone : public Cone
729 {
730 public:
735  double* ub;
736  double* lb;
737 
741  OrthantCone();
742 
746  ~OrthantCone();
747 
751  virtual std::string getConeName();
752 
759  virtual std::string getConeInXML();
760 
764  bool IsEqual(OrthantCone *that);
765 
775  bool setRandom(double density, bool conformant, int iMin, int iMax);
776 
782  bool deepCopyFrom(OrthantCone *that);
783 };//end OrthantCone
784 
788 class PolyhedralCone : public Cone
789 {
790 public:
791 
793  PolyhedralCone();
794 
796  ~PolyhedralCone();
797 
803 
811 
813  int coneType;
814 
816  int idx;
817 
820 
824  virtual std::string getConeName();
825 
832  virtual std::string getConeInXML();
833 
837  bool IsEqual(PolyhedralCone *that);
838 
848  bool setRandom(double density, bool conformant, int iMin, int iMax);
849 
855  bool deepCopyFrom(PolyhedralCone *that);
856 }; // PolyhedralCone
857 
858 
862 class QuadraticCone : public Cone
863 {
864 public:
865 
867  QuadraticCone();
868 
870  ~QuadraticCone();
871 
877 
885 
887  int coneType;
888 
890  int idx;
891 
900 
911 
915  virtual std::string getConeName();
916 
923  virtual std::string getConeInXML();
924 
928  bool IsEqual(QuadraticCone *that);
929 
939  bool setRandom(double density, bool conformant, int iMin, int iMax);
940 
946  bool deepCopyFrom(QuadraticCone *that);
947 }; // QuadraticCone
948 
949 
954 {
955 public:
956 
959 
962 
968 
976 
978  int coneType;
979 
981  int idx;
982 
991 
1003 
1007  virtual std::string getConeName();
1008 
1015  virtual std::string getConeInXML();
1016 
1020  bool IsEqual(RotatedQuadraticCone *that);
1021 
1031  bool setRandom(double density, bool conformant, int iMin, int iMax);
1032 
1038  bool deepCopyFrom(RotatedQuadraticCone *that);
1039 }; // RotatedQuadraticCone
1040 
1041 /* Not yet implemented:
1042  ENUM_CONE_TYPE_normed,
1043 */
1044 
1048 class SemidefiniteCone : public Cone
1049 {
1050 public:
1051 
1053  SemidefiniteCone();
1054 
1057 
1063 
1071 
1074 
1076  int idx;
1077 
1079  std::string semidefiniteness;
1080 
1083 
1087  virtual std::string getConeName();
1088 
1095  virtual std::string getConeInXML();
1096 
1100  bool IsEqual(SemidefiniteCone *that);
1101 
1111  bool setRandom(double density, bool conformant, int iMin, int iMax);
1112 
1118  bool deepCopyFrom(SemidefiniteCone *that);
1119 }; // SemidefiniteCone
1120 
1121 
1130 {
1131 public:
1136 
1141 
1145  virtual std::string getConeName();
1146 
1153  virtual std::string getConeInXML();
1154 
1158  bool IsEqual(CopositiveMatricesCone *that);
1159 
1170  bool setRandom(double density, bool conformant, int iMin, int iMax);
1171 
1178 
1179 };//end CopositiveMatricesCone
1180 
1181 
1190 {
1191 public:
1197 
1202 
1206  virtual std::string getConeName();
1207 
1215  virtual std::string getConeInXML();
1216 
1221 
1231  bool setRandom(double density, bool conformant, int iMin, int iMax);
1232 
1239 
1240 };//end CompletelyPositiveMatricesCone
1241 
1242 /* Not yet implemented:
1243  ENUM_CONE_TYPE_hyperbolicity,
1244  ENUM_CONE_TYPE_nonnegativePolynomials,
1245  ENUM_CONE_TYPE_moments,
1246 */
1247 
1251 class ProductCone : public Cone
1252 {
1253 public:
1254 
1256  ProductCone();
1257 
1259  ~ProductCone();
1260 
1266 
1274 
1277 
1279  int idx;
1280 
1285 
1289  virtual std::string getConeName();
1290 
1297  virtual std::string getConeInXML();
1298 
1302  bool IsEqual(ProductCone *that);
1303 
1313  bool setRandom(double density, bool conformant, int iMin, int iMax);
1314 
1315 
1321  bool deepCopyFrom(ProductCone *that);
1322 }; // ProductCone
1323 
1327 class IntersectionCone : public Cone
1328 {
1329 public:
1330 
1332  IntersectionCone();
1333 
1336 
1342 
1350 
1353 
1355  int idx;
1356 
1361 
1365  virtual std::string getConeName();
1366 
1373  virtual std::string getConeInXML();
1374 
1378  bool IsEqual(IntersectionCone *that);
1379 
1389  bool setRandom(double density, bool conformant, int iMin, int iMax);
1390 
1396  bool deepCopyFrom(IntersectionCone *that);
1397 }; // IntersectionCone
1398 
1399 
1403 class DualCone : public Cone
1404 {
1405 public:
1406 
1408  DualCone();
1409 
1411  ~DualCone();
1412 
1418 
1426 
1429 
1431  int idx;
1432 
1435 
1439  virtual std::string getConeName();
1440 
1444  bool IsEqual(DualCone *that);
1445 
1455  bool setRandom(double density, bool conformant, int iMin, int iMax);
1456 
1462  bool deepCopyFrom(DualCone *that);
1463 }; // DualCone
1464 
1468 class PolarCone : public Cone
1469 {
1470 public:
1471 
1473  PolarCone();
1474 
1476  ~PolarCone();
1477 
1483 
1491 
1494 
1496  int idx;
1497 
1500 
1504  virtual std::string getConeName();
1505 
1509  bool IsEqual(PolarCone *that);
1510 
1520  bool setRandom(double density, bool conformant, int iMin, int iMax);
1521 
1527  bool deepCopyFrom(PolarCone *that);
1528 }; // PolarCone
1529 
1530 
1535 class Cones
1536 {
1537 public:
1538 
1540  Cones();
1541 
1543  ~Cones();
1544 
1550 
1553 
1557  bool IsEqual(Cones *that);
1558 
1568  bool setRandom(double density, bool conformant, int iMin, int iMax);
1569 
1575  bool deepCopyFrom(Cones *that);
1576 }; // Cones
1577 
1578 
1584 {
1585 public:
1586 
1588  MatrixVar();
1589 
1591  ~MatrixVar();
1592 
1595 
1598 
1603 
1608 
1611 
1614 
1617 
1620 
1622  std::string name;
1623 
1625  char varType;
1626 }; // MatrixVar
1627 
1628 
1634 {
1635 public:
1636 
1638  MatrixVariables();
1639 
1641  ~MatrixVariables();
1642 
1645 
1648 
1649 }; // MatrixVariables
1650 
1651 
1657 {
1658 public:
1659 
1661  MatrixObj();
1662 
1664  ~MatrixObj();
1665 
1668 
1671 
1676 
1681 
1686 
1689 
1691  std::string name;
1692 }; // MatrixObj
1693 
1694 
1700 {
1701 public:
1702 
1704  MatrixObjectives();
1705 
1708 
1711 
1714 
1715 }; // MatrixObjectives
1716 
1717 
1723 {
1724 public:
1725 
1727  MatrixCon();
1728 
1730  ~MatrixCon();
1731 
1734 
1737 
1742 
1747 
1750 
1753 
1756 
1759 
1761  std::string name;
1762 }; // MatrixCon
1763 
1764 
1770 {
1771 public:
1772 
1775 
1778 
1781 
1784 
1785 }; // MatrixConstraints
1786 
1794 {
1795 public:
1797  int idx;
1798 
1804 
1811 
1814 
1816  MatrixExpression();
1817 
1820 
1824  bool IsEqual(MatrixExpression *that);
1825 }; // MatrixExpression
1826 
1827 
1833 {
1834 public:
1835 
1838 
1841 
1844 
1849 
1853  bool IsEqual(MatrixExpressions *that);
1854 }; // MatrixExpressions
1855 
1861 {
1862 public:
1863 
1866 
1869 
1872 
1875 
1878 
1881 
1885  bool IsEqual(MatrixProgramming *that);
1886 
1896  bool setRandom(double density, bool conformant, int iMin, int iMax);
1897 
1904  bool deepCopyFrom(MatrixProgramming *that);
1905 }; // MatrixProgramming
1906 
1907 
1913 {
1914 public:
1915 
1918 
1921 
1923  int idx;
1924 }; // TimeDomainStageVar
1925 
1931 {
1932 public:
1933 
1936 
1939 
1942 
1945 
1948 }; // TimeDomainStageVariables
1949 
1950 
1956 {
1957 public:
1958 
1961 
1964 
1966  int idx;
1967 }; // TimeDomainStageCon
1968 
1974 {
1975 public:
1976 
1979 
1982 
1985 
1988 
1991 }; // TimeDomainStageConstraints
1992 
1993 
1999 {
2000 public:
2001 
2004 
2007 
2009  int idx;
2010 }; // TimeDomainStageObj
2011 
2017 {
2018 public:
2019 
2022 
2025 
2028 
2031 
2034 }; // TimeDomainStageObjectives
2035 
2036 
2042 {
2043 public:
2044 
2046  TimeDomainStage();
2047 
2049  ~TimeDomainStage();
2050 
2054  std::string name;
2055 
2058 
2061 
2064 }; // TimeDomainStage
2065 
2071 {
2072 public:
2073 
2075  TimeDomainStages();
2076 
2079 
2084 
2087 }; // Stages
2088 
2094 {
2095 public:
2096 
2099 
2102 
2106  double start;
2107 
2111  double horizon;
2112 }; // Interval
2113 
2119 {
2120 public:
2121 
2123  TimeDomain();
2124 
2126  ~TimeDomain();
2127 
2131 
2135 }; // TimeDomain
2136 
2154 {
2155 public:
2156 
2158  InstanceData();
2159 
2161  ~InstanceData();
2162 
2165 
2168 
2171 
2176 
2181 
2186 
2191 
2196 
2201 
2206 
2210  bool IsEqual(InstanceData *that);
2211 }; // class InstanceData
2212 
2213 
2242 {
2243 public:
2244 
2246  OSInstance();
2247 
2249  ~OSInstance();
2250 
2255 
2258 
2262  bool IsEqual(OSInstance *that);
2263 
2268 
2273 
2278 
2283 
2284 private:
2288  std::string m_sInstanceName;
2292  std::string m_sInstanceSource;
2296  std::string m_sInstanceDescription;
2300  std::string m_sInstanceCreator;
2304  std::string m_sInstanceLicence;
2305 
2309  bool m_bProcessVariables;
2310 
2314  int m_iVariableNumber;
2315 
2319  int m_iNumberOfIntegerVariables;
2320 
2324  int m_iNumberOfBinaryVariables;
2325 
2329  int m_iNumberOfSemiContinuousVariables;
2330 
2334  int m_iNumberOfSemiIntegerVariables;
2335 
2339  int m_iNumberOfStringVariables;
2340 
2344  int m_iNumberOfQuadraticRowIndexes;
2345 
2349  bool m_bQuadraticRowIndexesProcessed;
2350 
2354  int *m_miQuadRowIndexes;
2355 
2360  int m_iNumberOfNonlinearExpressionTreeIndexes;
2361 
2366  bool m_bNonlinearExpressionTreeIndexesProcessed;
2367 
2373  int *m_miNonlinearExpressionTreeIndexes;
2374 
2380  int m_iNumberOfNonlinearExpressionTreeModIndexes;
2381 
2386  bool m_bNonlinearExpressionTreeModIndexesProcessed;
2387 
2392  int *m_miNonlinearExpressionTreeModIndexes;
2393 
2397  std::string* m_msVariableNames;
2398 
2403  char* m_mcVariableTypes;
2404 
2408  double* m_mdVariableLowerBounds;
2409 
2413  double* m_mdVariableUpperBounds;
2414 
2418  bool m_bProcessObjectives;
2419 
2423  int m_iObjectiveNumber;
2424 
2428  int m_iObjectiveNumberNonlinear;
2429 
2433  std::string* m_msObjectiveNames;
2434 
2438  std::string* m_msMaxOrMins;
2439 
2443  int* m_miNumberOfObjCoef;
2444 
2448  double* m_mdObjectiveConstants;
2449 
2453  double* m_mdObjectiveWeights;
2454 
2459  SparseVector** m_mObjectiveCoefficients;
2460 
2464  bool m_bGetDenseObjectives;
2465 
2470  double** m_mmdDenseObjectiveCoefficients;
2471 
2475  bool m_bProcessConstraints;
2476 
2480  int m_iConstraintNumber;
2481 
2485  int m_iConstraintNumberNonlinear;
2486 
2490  std::string* m_msConstraintNames;
2491 
2495  double* m_mdConstraintLowerBounds;
2496 
2500  double* m_mdConstraintUpperBounds;
2501 
2506  double* m_mdConstraintConstants;
2507 
2512  char* m_mcConstraintTypes;
2513 
2518  bool m_bProcessLinearConstraintCoefficients;
2519 
2524  int m_iLinearConstraintCoefficientNumber;
2525 
2530  bool m_bColumnMajor;
2531 
2535  bool m_binitForAlgDiff;
2536 
2537 
2543  SparseMatrix* m_linearConstraintCoefficientsInColumnMajor;
2544 
2550  SparseMatrix* m_linearConstraintCoefficientsInRowMajor;
2551 
2552 
2556  bool m_bProcessQuadraticTerms;
2557 
2562  int m_iQuadraticTermNumber;
2563 
2568  double *m_mdConstraintFunctionValues;
2569 
2574  double *m_mdObjectiveFunctionValues;
2575 
2579  int m_iJacValueSize;
2580 
2584  int *m_miJacStart;
2585 
2589  int *m_miJacIndex;
2590 
2594  double *m_mdJacValue;
2595 
2596 
2601  int *m_miJacNumConTerms;
2602 
2606  SparseJacobianMatrix *m_sparseJacMatrix;
2607 
2612  int m_iHighestTaylorCoeffOrder;
2613 
2618  QuadraticTerms* m_quadraticTerms;
2619 
2622  bool m_bQTermsAdded;
2623 
2628  unsigned int m_iNumberOfNonlinearVariables;
2629 
2633  bool m_bProcessNonlinearExpressions;
2634 
2638  int m_iNonlinearExpressionNumber;
2639 
2644  int* m_miNonlinearExpressionIndexes;
2645 
2649  bool m_bProcessExpressionTrees;
2650 
2654  bool m_bProcessExpressionTreesMod;
2655 
2664  std::map<int, ScalarExpressionTree*> m_mapExpressionTrees;
2665 
2670  std::map<int, int> m_mapOSADFunRangeIndex;
2671 
2672 
2681  std::map<int, MatrixExpressionTree*> m_mapMatrixExpressionTrees;
2682 
2687  ScalarExpressionTree *m_LagrangianExpTree;
2688 
2692  bool m_bLagrangianExpTreeCreated;
2693 
2697  SparseHessianMatrix* m_LagrangianSparseHessian;
2698 
2703  bool m_bLagrangianSparseHessianCreated;
2704 
2708  std::map<int, int> m_mapAllNonlinearVariablesIndex;
2709 
2713  int *m_miNonLinearVarsReverseMap;
2714 
2719  bool m_bAllNonlinearVariablesIndex;
2720 
2727  std::map<int, ScalarExpressionTree*> m_mapExpressionTreesMod ;
2728 
2734  bool m_bOSADFunIsCreated;
2735 
2740  bool m_bCppADTapesBuilt;
2741 
2746  bool m_bCppADMustReTape;
2747 
2751  bool m_bDuplicateExpressionTreesMap;
2752 
2756  bool m_bNonLinearStructuresInitialized;
2757 
2761  bool m_bSparseJacobianCalculated;
2762 
2767  std::map<int, std::vector<OSnLNode*> > m_mapExpressionTreesInPostfix ;
2768 
2769 
2774  int m_iHighestOrderEvaluated;
2775 
2780  double **m_mmdObjGradient;
2781 
2782  //define the vectors
2783 
2787  std::vector<double> m_vdX;
2788 
2792  std::vector<double> m_vdYval;
2793 
2798  std::vector<bool> m_vbLagHessNonz;
2799 
2803  std::vector<double> m_vdYjacval;
2804 
2808  std::vector<double> m_vdw;
2809 
2813  std::vector<double> m_vdLambda;
2814 
2815 
2819  std::vector<double> m_vdDomainUnitVec;
2820 
2824  std::vector<double> m_vdRangeUnitVec;
2825 
2826 
2830  bool m_bProcessTimeDomain;
2831 
2835  bool m_bProcessTimeStages;
2836 
2840  bool m_bProcessTimeInterval;
2841 
2845  bool m_bFiniteTimeStages;
2846 
2850  int m_iNumberOfTimeStages;
2851 
2855  std::string m_sTimeDomainFormat;
2856 
2860  std::string* m_msTimeDomainStageNames;
2861 
2865  int* m_miTimeDomainStageVariableNumber;
2866 
2870  int** m_mmiTimeDomainStageVarList;
2871 
2875  int* m_miTimeDomainStageConstraintNumber;
2876 
2880  int** m_mmiTimeDomainStageConList;
2881 
2885  int* m_miTimeDomainStageObjectiveNumber;
2886 
2890  int** m_mmiTimeDomainStageObjList;
2891 
2892 
2899  bool processVariables();
2900 
2907  bool processObjectives();
2908 
2909 
2916  bool processConstraints();
2917 
2918 
2925  bool processLinearConstraintCoefficients();
2926 
2927 
2928 public:
2929 
2934  std::string getInstanceName();
2935 
2940  std::string getInstanceSource();
2941 
2947  std::string getInstanceDescription();
2948 
2953  std::string getInstanceCreator();
2954 
2960  std::string getInstanceLicence();
2961 
2962 
2968  int getVariableNumber();
2969 
2976  std::string* getVariableNames();
2977 
2985  //double* getVariableInitialValues();
2986 
2994  //std::string* getVariableInitialStringValues();
2995 
3007  char* getVariableTypes();
3008 
3014 
3020 
3026 
3032 
3038 
3045  double* getVariableLowerBounds();
3046 
3053  double* getVariableUpperBounds();
3054 
3060  int getObjectiveNumber();
3061 
3062 
3069  std::string* getObjectiveNames();
3070 
3077  std::string* getObjectiveMaxOrMins();
3078 
3079 
3089 
3096  double* getObjectiveConstants();
3097 
3104  double* getObjectiveWeights();
3105 
3117 
3124  double** getDenseObjectiveCoefficients();
3125 
3131  int getConstraintNumber();
3132 
3139  std::string* getConstraintNames();
3140 
3147  double* getConstraintLowerBounds();
3148 
3155  double *getConstraintUpperBounds();
3156 
3163  double *getConstraintConstants();
3164 
3178  char* getConstraintTypes();
3179 
3186 
3187 
3195 
3196 
3204 
3212 
3219 
3229 
3237  int* getQuadraticRowIndexes();
3238 
3245 
3246 
3247 /*********************************************************************
3248  * *
3249  * Here we have a number of methods for dealing with *
3250  * scalar-valued expression trees. *
3251  * Even though the tree can contain OSnLMNodes (e.g., to compute *
3252  * the trace of a matrix), the root of the tree is of type OSnLNode. *
3253  * *
3254  *********************************************************************/
3255 
3262 
3269 
3276 
3284 
3293  std::vector<ExprNode*> getNonlinearExpressionTreeInPostfix( int rowIdx);
3294 
3302  std::vector<ExprNode*> getNonlinearExpressionTreeModInPostfix( int rowIdx);
3303 
3310  std::vector<ExprNode*> getNonlinearExpressionTreeInPrefix( int rowIdx);
3311 
3319  std::string getNonlinearExpressionTreeInInfix( int rowIdx);
3320 
3321 
3329  std::vector<ExprNode*> getNonlinearExpressionTreeModInPrefix( int rowIdx);
3330 
3331 
3336 
3341 
3346  std::map<int, ScalarExpressionTree* > getAllNonlinearExpressionTrees();
3347 
3351  std::map<int, ScalarExpressionTree* > getAllNonlinearExpressionTreesMod();
3352 
3359 
3360 
3367 
3368 
3377 
3378 
3386 
3387 /***********************************************************************
3388  * *
3389  * Here we have a number of methods for dealing with *
3390  * matrix-valued expression trees. *
3391  * Even though the tree can contain OSnLNodes (e.g., to compute the *
3392  * scalar multiple of a matrix), the root of the tree is an OSnLMNode. *
3393  * *
3394  ***********************************************************************/
3395 
3402 
3409 
3416  std::vector<ExprNode*> getMatrixExpressionTreeInPostfix( int rowIdx);
3417 
3425  std::vector<ExprNode*> getMatrixExpressionTreeModInPostfix( int rowIdx);
3426 
3433  std::vector<ExprNode*> getMatrixExpressionTreeInPrefix( int rowIdx);
3434 
3442  std::string getMatrixExpressionTreeInInfix( int rowIdx);
3443 
3444 
3449 
3454 
3459 
3463  std::map<int, MatrixExpressionTree* > getAllMatrixExpressionTrees();
3464 
3465 
3469  std::map<int, MatrixExpressionTree* > getAllMatrixExpressionTreesMod();
3470 
3478 
3479 
3486 
3487 //===============================================
3488 
3494  std::string getTimeDomainFormat();
3495 
3502 
3508  std::string* getTimeDomainStageNames();
3509 
3516 
3517 
3524 
3531 
3537  int** getTimeDomainStageVarList();
3538 
3544  int** getTimeDomainStageConList();
3545 
3551  int** getTimeDomainStageObjList();
3552 
3558  double getTimeDomainIntervalStart();
3559 
3566 
3567 
3568 
3569  // the set() methods
3570 
3571 
3578  bool setInstanceName(std::string name);
3579 
3586  bool setInstanceSource(std::string source);
3587 
3594  bool setInstanceDescription(std::string description);
3595 
3602  bool setInstanceCreator(std::string fileCreator);
3603 
3610  bool setInstanceLicence(std::string licence);
3611 
3612 
3619  bool setVariableNumber(int number);
3620 
3636  bool addVariable(int index, std::string name, double lowerBound, double upperBound, char type);
3637 
3657  bool setVariables(int number, std::string* names, double* lowerBounds,
3658  double* upperBounds, char* types);
3659 
3660 
3667  bool setObjectiveNumber(int number);
3668 
3686  bool addObjective(int index, std::string name, std::string maxOrMin, double constant, double weight, SparseVector* objectiveCoefficients);
3687 
3703  bool setObjectives(int number, std::string *names, std::string *maxOrMins, double *constants, double *weights, SparseVector **objectitiveCoefficients);
3704 
3711  bool setConstraintNumber(int number);
3712 
3726  bool addConstraint(int index, std::string name, double lowerBound, double upperBound, double constant);
3727 
3741  bool setConstraints(int number, std::string* names, double* lowerBounds, double* upperBounds, double* constants);
3742 
3761  bool setLinearConstraintCoefficients(int numberOfValues, bool isColumnMajor,
3762  double* values, int valuesBegin, int valuesEnd,
3763  int* indexes, int indexesBegin, int indexesEnd,
3764  int* starts, int startsBegin, int startsEnd);
3765 
3784  bool copyLinearConstraintCoefficients(int numberOfValues, bool isColumnMajor,
3785  double* values, int valuesBegin, int valuesEnd,
3786  int* indexes, int indexesBegin, int indexesEnd,
3787  int* starts, int startsBegin, int startsEnd);
3788 
3797  bool setNumberOfQuadraticTerms(int nq);
3798 
3815  bool setQuadraticCoefficients(int number,
3816  int* rowIndexes, int* varOneIndexes, int* varTwoIndexes,
3817  double* coefficients, int begin, int end);
3818 
3819 
3834  int* rowIndexes, int* varOneIndexes, int* varTwoIndexes, double* coefficients);
3835 
3845  bool setNonlinearExpressions(int nexpr, Nl** root);
3846 
3853  bool setMatrixNumber(int number);
3854 
3877  bool addMatrix(int index, std::string name, int numberOfRows, int numberOfColumns,
3878  ENUM_MATRIX_SYMMETRY symmetry, ENUM_MATRIX_TYPE matrixType,
3879  unsigned int inumberOfChildren, MatrixNode **m_mChildren);
3880 
3881 
3888  bool setConeNumber(int number);
3889 
3916  bool addCone(int index, int numberOfRows, int numberOfColumns, ENUM_CONE_TYPE coneType,
3917  std::string name, int numberOfOtherIndexes = 0, int* otherIndexes = NULL);
3918 
3945  bool addCone(int index, int numberOfRows, int numberOfColumns, ENUM_CONE_TYPE coneType,
3946  std::string name, int numberOfComponents, int* components,
3947  int numberOfOtherIndexes = 0, int* otherIndexes = NULL);
3948 
3975  bool addCone(int index, int numberOfRows, int numberOfColumns, ENUM_CONE_TYPE coneType,
3976  std::string name, int referenceIdx, int numberOfOtherIndexes = 0, int* otherIndexes = NULL);
3977 
4003  bool addCone(int index, int numberOfRows, int numberOfColumns, ENUM_CONE_TYPE coneType,
4004  std::string name, std::string semidefiniteness, int numberOfOtherIndexes = 0, int* otherIndexes = NULL);
4005 
4032  bool addCone(int index, int numberOfRows, int numberOfColumns, ENUM_CONE_TYPE coneType,
4033  std::string name, int distortionMatrixIdx, double normFactor, int axisDirection,
4034  int numberOfOtherIndexes = 0, int* otherIndexes = NULL);
4035 
4063  bool addCone(int index, int numberOfRows, int numberOfColumns, ENUM_CONE_TYPE coneType,
4064  std::string name, int distortionMatrixIdx, double normFactor, int firstAxisDirection,
4065  int secondAxisDirection, int numberOfOtherIndexes = 0, int* otherIndexes = NULL);
4066 
4093  bool addCone(int index, int numberOfRows, int numberOfColumns, ENUM_CONE_TYPE coneType,
4094  std::string name, int distortionMatrixIdx, double normFactor, int axisDirection, double pNorm,
4095  int numberOfOtherIndexes = 0, int* otherIndexes = NULL);
4096 
4127  bool addCone(int index, int numberOfRows, int numberOfColumns, ENUM_CONE_TYPE coneType,
4128  std::string name, int maxDegree, int numberOfUB, double* ub, int numberOfLB, double* lb,
4129  int numberOfOtherIndexes = 0, int* otherIndexes = NULL);
4130 
4131 
4132  // methods to print the current model or parts of it
4133 
4138  std::string printModel( );
4139 
4147  std::string printModel( int rowIdx);
4148 
4149 
4150 
4151  // nonlinear API methods
4152 
4153 
4160 
4174  double calculateFunctionValue(int idx, double* x, bool new_x);
4175 
4190  double *calculateAllConstraintFunctionValues(double* x, double *objLambda, double *conLambda,
4191  bool new_x, int highestOrder);
4192 
4206  double *calculateAllConstraintFunctionValues(double* x, bool new_x);
4207 
4223  double *calculateAllObjectiveFunctionValues(double* x, double *objLambda, double *conLambda,
4224  bool new_x, int highestOrder);
4225 
4239  double *calculateAllObjectiveFunctionValues(double* x, bool new_x);
4240 
4241 
4256  SparseJacobianMatrix *calculateAllConstraintFunctionGradients(double* x, double *objLambda,
4257  double *conLambda, bool new_x, int highestOrder);
4258 
4259 
4275  SparseVector *calculateConstraintFunctionGradient(double* x, double *objLambda, double *conLambda,
4276  int idx, bool new_x, int highestOrder);
4277 
4291  SparseVector *calculateConstraintFunctionGradient(double* x, int idx, bool new_x );
4292 
4307  double **calculateAllObjectiveFunctionGradients(double* x, double *objLambda, double *conLambda,
4308  bool new_x, int highestOrder);
4309 
4325  double *calculateObjectiveFunctionGradient(double* x, double *objLambda, double *conLambda,
4326  int objIdx, bool new_x, int highestOrder);
4327 
4341  double *calculateObjectiveFunctionGradient(double* x, int objIdx, bool new_x );
4342 
4360  SparseHessianMatrix *calculateLagrangianHessian( double* x, double *objLambda, double *conLambda,
4361  bool new_x, int highestOrder);
4362 
4375  SparseHessianMatrix *calculateHessian( double* x, int idx, bool new_x);
4376 
4377 
4383 
4389 
4395 
4400  std::map<int, int> getAllNonlinearVariablesIndexMap( );
4401 
4407 
4414  bool addQTermsToExressionTree();
4415 
4423 
4429 
4435 
4436 #ifdef OS_HAS_CPPAD
4437 
4441  CppAD::ADFun<double> *Fad;
4442 #endif
4443 
4454  bool createOSADFun(std::vector<double> vdX );
4455 
4466  std::vector<double> forwardAD(int p, std::vector<double> vdX);
4467 
4478  std::vector<double> reverseAD(int p, std::vector<double> vdlambda);
4479 
4492  int getADSparsityHessian();
4493 
4513  bool getIterateResults(double *x, double *objLambda, double *conLambda,
4514  bool new_x, int highestOrder);
4515 
4516 
4517 
4530  bool getZeroOrderResults(double *x, double *objLambda, double *conLambda);
4531 
4544  bool getFirstOrderResults(double *x, double *objLambda, double *conLambda );
4545 
4558  bool getSecondOrderResults(double *x, double *objLambda, double *conLambda );
4559 
4560 
4570  bool initForAlgDiff();
4571 
4581  bool initObjGradients();
4582 
4583 
4589 
4590 
4594  bool setTimeDomain(std::string format);
4595 
4599  bool setTimeDomainStages(int number, std::string *names);
4600 
4607  bool setTimeDomainStageVariablesOrdered(int numberOfStages, int *numberOfVariables, int *startIdx);
4608 
4615  bool setTimeDomainStageVariablesUnordered(int numberOfStages, int *numberOfVariables, int **varIndex);
4616 
4622  bool setTimeDomainStageConstraintsOrdered(int numberOfStages, int *numberOfConstraints, int *startIdx);
4623 
4629  bool setTimeDomainStageConstraintsUnordered(int numberOfStages, int *numberOfConstraints, int **conIndex);
4630 
4636  bool setTimeDomainStageObjectivesOrdered(int numberOfStages, int *numberOfObjectives, int *startIdx);
4637 
4643  bool setTimeDomainStageObjectivesUnordered(int numberOfStages, int *numberOfObjectives, int **varIndex);
4644 
4648  bool setTimeDomainInterval(double start, double horizon);
4649 
4650 
4651 }; //class OSInstance
4652 
4653 #endif
4654 
IntVector * factors
the list of &quot;factors&quot; contributing to the product each factor contains a reference to a previously de...
Definition: OSInstance.h:1284
bool IsEqual(QuadraticTerm *that)
A function to check for the equality of two objects.
int numberOfRows
numberOfRows gives the number of rows of this matrix
Definition: OSInstance.h:1667
QuadraticTerms * getQuadraticTerms()
Get all the quadratic terms in the instance.
int numberOfOtherIndexes
Multidimensional tensors can also form cones (the Kronecker product, for instance, can be thought of as a four-dimensional tensor).
Definition: OSInstance.h:1489
~MatrixVar()
The MatrixVar class destructor.
The in-memory representation of the &lt;objectives&gt; element.
Definition: OSInstance.h:188
~RotatedQuadraticCone()
The RotatedQuadraticCone class destructor.
bool setRandom(double density, bool conformant, int iMin, int iMax)
A function to make a random instance of this class.
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
int ubMatrixIdx
ubMatrixIdx gives an upper bound for this matrixCon
Definition: OSInstance.h:1755
int ubConeIdx
ubConeIdx gives a cone that must contain ubMatrix - matrixVar
Definition: OSInstance.h:1619
The in-memory representation of the objective function &lt;coef&gt; element.
Definition: OSInstance.h:110
int numberOfRows
Every cone has (at least) two dimensions; no distinction is made between vector cones and matrix cone...
Definition: OSInstance.h:1416
TimeDomainStageConstraints * constraints
constraints is a pointer to a TimeDomainConstraints object
Definition: OSInstance.h:2060
bool setInstanceName(std::string name)
set the instance name.
The in-memory representation of the &lt;variables&gt; child of the &lt;stage&gt; element.
Definition: OSInstance.h:1930
bool setTimeDomainStageVariablesOrdered(int numberOfStages, int *numberOfVariables, int *startIdx)
This sets the variables associated with each time domain stage in temporal order. ...
The NonnegativeCone Class.
Definition: OSInstance.h:611
std::string name
The cone can have a name for easier identification.
Definition: OSInstance.h:561
int numberOfMatrixVar
numberOfMatrixVar gives the number of &lt;matrixVar&gt; children
Definition: OSInstance.h:1644
bool initForAlgDiff()
This should be called by nonlinear solvers using callback functions.
~OrthantCone()
default destructor.
The in-memory representation of a polar cone.
Definition: OSInstance.h:1468
DoubleVector * value
a pointer to the array of nonzero values being stored
Definition: OSInstance.h:317
bool bObjectivesModified
bObjectivesModified is true if the objective function data has been modified.
Definition: OSInstance.h:2272
a double vector data structure
Definition: OSGeneral.h:609
std::vector< ExprNode * > getMatrixExpressionTreeInPrefix(int rowIdx)
Get the prefix tokens for a given row index.
IntVector * components
the list of components contributing to the intersection each component contains a reference to a prev...
Definition: OSInstance.h:1360
The in-memory representation of a generic cone Specific cone types are derived from this generic clas...
Definition: OSInstance.h:532
ScalarExpressionTree * getLagrangianExpTree()
std::string getInstanceName()
Get instance name.
int numberOfColumns
Definition: OSInstance.h:1417
bool bConstraintsModified
bConstraintsModified is true if the constraints data has been modified.
Definition: OSInstance.h:2277
bool deepCopyFrom(Cones *that)
A function to make a deep copy of an instance of this class.
int getNumberOfNonlinearExpressions()
Get number of nonlinear expressions.
~CopositiveMatricesCone()
default destructor.
int idx
cones are referenced by an (automatically created) index
Definition: OSInstance.h:981
bool initObjGradients()
This should be called by initForAlgDiff()
MatrixVariables()
The MatrixVariables class constructor.
int getNumberOfSemiIntegerVariables()
getNumberOfSemiIntegerVariables
~MatrixObj()
The MatrixVar class destructor.
Used to hold the instance in memory.
bool IsEqual(Variable *that)
A function to check for the equality of two objects.
MatrixVar()
The MatrixVar class constructor.
~TimeDomainStageVariables()
The TimeDomainStageVariables class destructor.
int * getTimeDomainStageNumberOfObjectives()
Get the number of objectives contained in each time stage.
The in-memory representation of the &lt;constraints&gt; element.
Definition: OSInstance.h:251
SparseJacobianMatrix * getJacobianSparsityPattern()
~Constraints()
The Constraints class destructor.
Nl ** getNonlinearExpressions()
Get the pointers to the roots of all expression trees.
bool IsEqual(ProductCone *that)
A function to check for the equality of two objects.
virtual std::string getConeInXML()
Write a SemidefiniteCone object in XML format.
TimeDomainStage ** stage
stage is pointer to an array of stage object pointers
Definition: OSInstance.h:2086
~NonlinearExpressions()
The NonlinearExpressions class destructor.
MatrixExpressions * matrixExpressions
a pointer to the matrixExpressions object
Definition: OSInstance.h:1880
~TimeDomainInterval()
The Interval class destructor.
int idx
cones are referenced by an (automatically created) index
Definition: OSInstance.h:1355
~LinearConstraintCoefficients()
The LinearConstraintCoefficients class destructor.
Cones * cones
cones is a pointer to a Cones object
Definition: OSInstance.h:2195
virtual std::string getConeName()
double getTimeDomainIntervalHorizon()
Get the horizon for the time domain interval.
~Cone()
The Cone class destructor.
QuadraticTerm()
The QuadraticTerm class constructor.
bool deepCopyFrom(PolyhedralCone *that)
A function to make a deep copy of an instance of this class.
virtual std::string getConeName()
int numberOfColumns
Definition: OSInstance.h:546
int * otherIndexes
Definition: OSInstance.h:1425
int ubMatrixIdx
ubMatrixIdx gives an upper bound for this matrixVar
Definition: OSInstance.h:1616
double constant
constant is a value that is added to the constraint
Definition: OSInstance.h:232
int * otherIndexes
Definition: OSInstance.h:810
int getNumberOfSemiContinuousVariables()
getNumberOfSemiContinuousVariables
int getObjectiveNumber()
Get number of objectives.
The in-memory representation of the &lt;instanceData&gt; element.
Definition: OSInstance.h:2153
bool IsEqual(PolarCone *that)
A function to check for the equality of two objects.
~TimeDomainStages()
The Stages class destructor.
virtual std::string getConeName()
The in-memory representation of the &lt;matrixVariables&gt; element.
Definition: OSInstance.h:1633
double * calculateAllConstraintFunctionValues(double *x, double *objLambda, double *conLambda, bool new_x, int highestOrder)
Calculate all of the constraint function values.
bool addCone(int index, int numberOfRows, int numberOfColumns, ENUM_CONE_TYPE coneType, std::string name, int numberOfOtherIndexes=0, int *otherIndexes=NULL)
add a cone.
std::map< int, ScalarExpressionTree * > getAllNonlinearExpressionTreesMod()
~SemidefiniteCone()
The SemidefiniteCone class destructor.
bool isPositiveSemiDefinite
information about semidefiniteness is also tracked in a boolean variable
Definition: OSInstance.h:1082
int * getNonlinearExpressionTreeIndexes()
Get all the nonlinear expression tree indexes, i.e., indexes of rows (objectives or constraints) that...
int distortionMatrixIdx
Definition: OSInstance.h:899
ScalarExpressionTree * osExpressionTree
osExpressionTree contains the root of the ScalarExpressionTree
Definition: OSInstance.h:432
int numberOfColumns
Definition: OSInstance.h:876
bool IsEqual(OrthantCone *that)
A function to check for the equality of two objects.
int getADSparsityHessian()
end revised AD code
CopositiveMatricesCone()
default constructor.
int getVariableNumber()
Get number of variables.
int numberOfOtherIndexes
Multidimensional tensors can also form cones (the Kronecker product, for instance, can be thought of as a four-dimensional tensor).
Definition: OSInstance.h:883
double constant
constant is the constant term added to the objective function, 0 by default
Definition: OSInstance.h:162
The in-memory representation of the variable element.
Definition: OSInstance.h:44
The in-memory representation of the &lt;stage&gt; element.
Definition: OSInstance.h:2041
int numberOfVariables
numberOfVariables gives the number of variables contained in this stage
Definition: OSInstance.h:1941
MatrixObjectives()
The MatrixObjectives class constructor.
bool setObjectiveNumber(int number)
set the number of objectives.
~Variable()
The Variable class destructor.
virtual std::string getConeInXML()
Write a RotatedQuadraticCone object in XML format.
~Matrices()
The Matrices class destructor.
Objective()
The Objective class constructor.
int getNumberOfMatrixExpressionTreeIndexes()
Get the number of unique matrix expression tree indexes.
QuadraticCoefficients()
The QuadraticCoefficients class constructor.
std::string name
an optional name to this matrixVar
Definition: OSInstance.h:1622
int numberOfRows
Every cone has (at least) two dimensions; no distinction is made between vector cones and matrix cone...
Definition: OSInstance.h:966
int templateMatrixIdx
templateMatrixIdx refers to a matrix that describes the locations in this matrixVar that are allowed ...
Definition: OSInstance.h:1741
~Cones()
The Cones class destructor.
int getConstraintNumber()
Get number of constraints.
double * getVariableUpperBounds()
Get variable upper bounds.
Cone()
The Cone class constructor.
std::string name
an optional name to this matrixObj
Definition: OSInstance.h:1691
bool m_bDeleteExpressionTree
m_bDeleteExpressionTree is true, if in garbage collection, we should delete the osExpression tree obj...
Definition: OSInstance.h:429
int numberOfRows
numberOfRows gives the number of rows of this matrix
Definition: OSInstance.h:1594
The in-memory representation of the &lt;con&gt; element.
Definition: OSInstance.h:218
SparseMatrix * getLinearConstraintCoefficientsInColumnMajor()
Get linear constraint coefficients in column major.
The in-memory representation of an intersection cone.
Definition: OSInstance.h:1327
int lbConeIdx
lbConeIdx gives a cone that must contain matrixCon - lbMatrix
Definition: OSInstance.h:1752
The in-memory representation of the &lt;con&gt; element.
Definition: OSInstance.h:1955
bool IsEqual(Objective *that)
A function to check for the equality of two objects.
int coneType
The type of the cone (one of the values in ENUM_CONE_TYPE)
Definition: OSInstance.h:887
ENUM_MATRIX_SYMMETRY
Definition: OSParameters.h:698
ScalarExpressionTree * getNonlinearExpressionTree(int rowIdx)
Get the expression tree for a given row index.
IntersectionCone()
The IntersectionCone class constructor.
std::string name
name is the name of the constraint
Definition: OSInstance.h:229
SparseJacobianMatrix * calculateAllConstraintFunctionGradients(double *x, double *objLambda, double *conLambda, bool new_x, int highestOrder)
Calculate the gradient of all constraint functions.
~DualCone()
The DualCone class destructor.
int idx
idx holds the row index of the nonlinear expression
Definition: OSInstance.h:1797
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;objectives&gt; child of the &lt;stage&gt; element.
Definition: OSInstance.h:2016
bool IsEqual(CopositiveMatricesCone *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.
NonpositiveCone()
default constructor.
bool setTimeDomainInterval(double start, double horizon)
This sets the start and end of the time interval.
ObjCoef()
The ObjCoef class constructor.
The in-memory representation of a dual cone.
Definition: OSInstance.h:1403
ENUM_CONE_TYPE
Definition: OSParameters.h:813
double * getConstraintLowerBounds()
Get constraint lower bounds.
int coneType
The type of the cone (one of the values in ENUM_CONE_TYPE)
Definition: OSInstance.h:1352
int idx
cones are referenced by an (automatically created) index
Definition: OSInstance.h:1076
MatrixCon()
The MatrixCon class constructor.
int idx
cones are referenced by an (automatically created) index
Definition: OSInstance.h:1431
int constantMatrixIdx
constantMatrixIdx gives a constant added to the matrixObj
Definition: OSInstance.h:1688
TimeDomainStageCon()
The TimeDomainStageCon class constructor.
bool addObjective(int index, std::string name, std::string maxOrMin, double constant, double weight, SparseVector *objectiveCoefficients)
add an objective.
~QuadraticTerm()
The QuadraticTerm class destructor.
bool setConstraints(int number, std::string *names, double *lowerBounds, double *upperBounds, double *constants)
set all the constraint related elements.
bool deepCopyFrom(Matrices *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 ...
Definition: OSInstance.h:1675
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 variables element.
Definition: OSInstance.h:83
int getNumberOfNonlinearExpressionTreeIndexes()
Get the number of unique nonlinear expression tree indexes.
bool setObjectives(int number, std::string *names, std::string *maxOrMins, double *constants, double *weights, SparseVector **objectitiveCoefficients)
set all the objectives related elements.
virtual std::string getConeInXML()
Write a ProductCone object in XML format.
bool deepCopyFrom(RotatedQuadraticCone *that)
A function to make a deep copy of an instance of this class.
int idx
idx holds the row index of the nonlinear expression
Definition: OSInstance.h:416
DualCone()
The DualCone class constructor.
int * otherIndexes
Definition: OSInstance.h:1490
int getNumberOfMatrixConstraints()
double * getConstraintConstants()
Get constraint constants.
int numberOfColumns
numberOfColumns gives the number of columns of this matrix
Definition: OSInstance.h:1670
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.
double calculateFunctionValue(int idx, double *x, bool new_x)
Calculate the function value for function (constraint or objective) indexed by idx.
int * getNonlinearExpressionTreeModIndexes()
Get all the nonlinear expression tree indexes, i.e., indexes of rows (objectives or constraints) that...
MatrixObj()
The MatrixVar class constructor.
TimeDomain * timeDomain
timeDomain is a pointer to a TimeDomain object
Definition: OSInstance.h:2205
virtual std::string getConeName()
bool setRandom(double density, bool conformant, int iMin, int iMax)
A function to make a random instance of this class.
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*...
Definition: OSInstance.h:910
ENUM_NL_EXPR_SHAPE
Definition: OSParameters.h:780
int * getQuadraticRowIndexes()
Get the indexes of rows which have a quadratic term.
bool setNumberOfQuadraticTerms(int nq)
set the number of quadratic terms
std::string name
the name of the objective function
Definition: OSInstance.h:152
bool deepCopyFrom(PolarCone *that)
A function to make a deep copy of an instance of this class.
std::string getInstanceCreator()
Get instance fileCreator.
bool deepCopyFrom(Cone *that)
A function to make a deep copy of an instance of this class.
MatrixObj ** matrixObj
matrixObj is an array of pointers to the &lt;matrixObj&gt; children
Definition: OSInstance.h:1713
std::vector< double > forwardAD(int p, std::vector< double > vdX)
Perform an AD forward sweep.
std::string getInstanceLicence()
Get instance licence.
bool setMatrixNumber(int number)
set the number of matrices
MatrixExpressionTree * matrixExpressionTree
matrixExpressionTree contains the root of the MatrixExpressionTree
Definition: OSInstance.h:1813
OSMatrix ** matrix
matrix is a pointer to an array of OSMatrix object pointers
Definition: OSInstance.h:501
std::string * getConstraintNames()
Get constraint names.
~TimeDomain()
The TimeDomain class destructor.
TimeDomainStageObjectives()
The TimeDomainStageObjectives class constructor.
SparseHessianMatrix * getLagrangianHessianSparsityPattern()
virtual std::string getConeName()
bool IsEqual(Cones *that)
A function to check for the equality of two objects.
int referenceMatrixIdx
Polyhedral cones use a reference to a previously defined matrix for the extreme rays.
Definition: OSInstance.h:819
bool setConstraintNumber(int number)
set the number of constraints.
bool IsEqual(Nl *that)
A function to check for the equality of two objects.
std::string getInstanceDescription()
Get instance description.
The in-memory representation of the &lt;timeDomain&gt; element.
Definition: OSInstance.h:2118
bool IsEqual(QuadraticCoefficients *that)
A function to check for the equality of two objects.
Matrices * matrices
matrices is a pointer to a Matrices object
Definition: OSInstance.h:2190
int numberOfRows
Every cone has (at least) two dimensions; no distinction is made between vector cones and matrix cone...
Definition: OSInstance.h:1340
Cones()
The Cones class constructor.
The OrthantCone Class.
Definition: OSInstance.h:728
int numberOfColumns
Definition: OSInstance.h:1265
double value
value is the value of the objective function coefficient corresponding to the variable with index idx...
Definition: OSInstance.h:128
std::string name
an optional name to this MatrixCon
Definition: OSInstance.h:1761
int numberOfMatrixCon
numberOfMatrixCon gives the number of &lt;matrixCon&gt; children
Definition: OSInstance.h:1780
int * getTimeDomainStageNumberOfVariables()
Get the number of variables contained in each time stage.
~MatrixVariables()
The MatrixVariables class destructor.
int numberOfOtherIndexes
Multidimensional tensors can also form cones (the Kronecker product, for instance, can be thought of as a four-dimensional tensor).
Definition: OSInstance.h:1069
The in-memory representation of the &lt;nonlinearExpressions&gt; element.
Definition: OSInstance.h:454
int numberOfMatrixObj
numberOfMatrixObj gives the number of &lt;matrixObj&gt; children
Definition: OSInstance.h:1710
bool getLinearConstraintCoefficientMajor()
Get whether the constraint coefficients is in column major (true) or row major (false).
bool setRandom(double density, bool conformant, int iMin, int iMax)
A function to make a random instance of this class.
double ub
ub corresponds to the optional attribute that holds the variable upper bound.
Definition: OSInstance.h:61
int idx
cones are referenced by an (automatically created) index
Definition: OSInstance.h:1279
bool IsEqual(QuadraticCone *that)
A function to check for the equality of two objects.
int firstAxisDirection
The indices of the first two component can be changed Since there are possibly many dimensions...
Definition: OSInstance.h:1001
double start
start is the start of the planning period in the &lt;interval&gt; element.
Definition: OSInstance.h:2106
~TimeDomainStageObj()
The TimeDomainStageObj class destructor.
int coneType
The type of the cone (one of the values in ENUM_CONE_TYPE)
Definition: OSInstance.h:1276
~PolarCone()
The PolarCone class destructor.
The in-memory representation of a quadratic cone.
Definition: OSInstance.h:862
~MatrixExpressions()
The MatrixExpressions class destructor.
int numberOfRows
numberOfRows gives the number of rows of this matrix
Definition: OSInstance.h:1733
bool IsEqual(Objectives *that)
A function to check for the equality of two objects.
bool setRandom(double density, bool conformant, int iMin, int iMax)
A function to make a random instance of this class.
MatrixExpression()
The MatrixExpression class constructor.
MatrixConstraints()
The MatrixConstraints class constructor.
The in-memory representation of the &lt;qTerm&gt; element.
Definition: OSInstance.h:342
NonnegativeCone()
default constructor.
InstanceData()
The InstanceData class constructor.
virtual std::string getConeInXML()
Write a QuadraticCone object in XML format.
a data structure that holds general information about files that conform to one of the OSxL schemas ...
Definition: OSGeneral.h:32
bool IsEqual(Cone *that)
A function to check for the equality of two objects.
bool deepCopyFrom(IntersectionCone *that)
A function to make a deep copy of an instance of this class.
std::string getInstanceSource()
Get instance source.
bool addQTermsToExressionTree()
int idxTwo
idxTwo is the index of the second variable in the quadratic term
Definition: OSInstance.h:365
bool getSparseJacobianFromColumnMajor()
bool getSparseJacobianFromRowMajor()
~MatrixProgramming()
The MatrixProgramming class destructor.
std::map< int, MatrixExpressionTree * > getAllMatrixExpressionTreesMod()
~OSInstance()
The OSInstance class destructor.
~CompletelyPositiveMatricesCone()
default destructor.
MatrixVariables * matrixVariables
a pointer to the matrixVariables object
Definition: OSInstance.h:1871
The in-memory representation of a cone of semidefinite matrices.
Definition: OSInstance.h:1048
TimeDomainInterval * interval
interval is a pointer to an Interval object
Definition: OSInstance.h:2134
int startIdx
startdIdx gives the number of the first variable contained in this stage
Definition: OSInstance.h:1944
TimeDomainStageCon ** con
con is a pointer to an array of TimeDomainStageCon object pointers
Definition: OSInstance.h:1990
The in-memory representation of the &lt;linearConstraintCoefficients&gt; element.
Definition: OSInstance.h:288
bool setTimeDomainStageObjectivesOrdered(int numberOfStages, int *numberOfObjectives, int *startIdx)
This sets the objectives associated with each time domain stage in temporal order.
std::vector< double > reverseAD(int p, std::vector< double > vdlambda)
Perform an AD reverse sweep.
MatrixProgramming()
The MatrixProgramming class constructor.
SparseHessianMatrix * calculateHessian(double *x, int idx, bool new_x)
Calculate the Hessian of a constraint or objective function.
~Objectives()
The Objectives class destructor.
char * getConstraintTypes()
Get constraint types.
The in-memory representation of a SparseHessianMatrix.
Definition: OSGeneral.h:376
double horizon
horizon is the end of the planning period in the &lt;interval&gt; element.
Definition: OSInstance.h:2111
a sparse Jacobian matrix data structure
Definition: OSGeneral.h:300
double * getConstraintUpperBounds()
Get constraint upper bounds.
double lb
lb corresponds to the optional attribute that holds the variable lower bound.
Definition: OSInstance.h:56
Objectives()
The Objectives class constructor.
ENUM_NL_EXPR_SHAPE shape
shape holds the shape of the nonlinear expression (linear/quadratic/convex/general) (see further up i...
Definition: OSInstance.h:422
The CompletelyPositiveMatricesCone Class.
Definition: OSInstance.h:1189
int * otherIndexes
Definition: OSInstance.h:555
The in-memory representation of the &lt;constraints&gt; child of the &lt;stage&gt; element.
Definition: OSInstance.h:1973
NonlinearExpressions * nonlinearExpressions
nonlinearExpressions is a pointer to a NonlinearExpressions object
Definition: OSInstance.h:2185
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
Used to hold part of the instance in memory.
~TimeDomainStageVar()
The TimeDomainStageVar class destructor.
double * lb
Definition: OSInstance.h:736
int lbMatrixIdx
lbMatrixIdx gives a lower bound for this matrixVar
Definition: OSInstance.h:1610
a data structure for holding quadratic terms
Definition: OSGeneral.h:431
int objReferenceMatrixIdx
objReferenceMatrixIdx allows some or all of the components of this matrixObj to be copied from object...
Definition: OSInstance.h:1680
std::vector< ExprNode * > getNonlinearExpressionTreeInPostfix(int rowIdx)
Get the postfix tokens for a given row index.
int numberOfOtherIndexes
Multidimensional tensors can also form cones (the Kronecker product, for instance, can be thought of as a four-dimensional tensor).
Definition: OSInstance.h:974
int idx
idx gives the index of this variable
Definition: OSInstance.h:1923
The CopositiveMatricesCone Class.
Definition: OSInstance.h:1129
The in-memory representation of the &lt;matrixProgramming&gt; element.
Definition: OSInstance.h:1860
MatrixExpression ** getMatrixExpressions()
Get the pointers to the roots of all matrix expression trees.
int idx
idx is the index of the row in which the quadratic term appears
Definition: OSInstance.h:355
bool deepCopyFrom(MatrixProgramming *that)
A function to make a deep copy of an instance of this class.
bool setInstanceCreator(std::string fileCreator)
set the instance creator.
NonlinearExpressions()
The NonlinearExpressions class constructor.
virtual std::string getConeInXML()
Write a PolyhedralCone object in XML format.
a sparse matrix data structure
Definition: OSGeneral.h:223
int referenceConeIdx
Polar cones use a reference to another, previously defined cone.
Definition: OSInstance.h:1499
int numberOfQuadraticTerms
numberOfQuadraticTerms is the number of quadratic terms in the &lt;quadraticCoefficients&gt; element...
Definition: OSInstance.h:395
double normScaleFactor
quadratic cones normally are of the form x0 &gt;= x1^2 + x2^2 + ...
Definition: OSInstance.h:898
bool deepCopyFrom(QuadraticCone *that)
A function to make a deep copy of an instance of this class.
bool IsEqual(NonpositiveCone *that)
A function to check for the equality of two objects.
int ** getTimeDomainStageConList()
Get the list of constraints in each stage.
The in-memory representation of an OSiL instance.
Definition: OSInstance.h:2241
SparseMatrix * getLinearConstraintCoefficientsInRowMajor()
Get linear constraint coefficients in row major.
virtual std::string getConeInXML()
Write an IntersectionCone object in XML format.
~TimeDomainStageConstraints()
The TimeDomainStageConstraints class destructor.
std::string * getObjectiveNames()
Get objective names.
bool IsEqual(RotatedQuadraticCone *that)
A function to check for the equality of two objects.
TimeDomainInterval()
The Interval class constructor.
The in-memory representation of the &lt;expr&gt; element, which is like a nonlinear expression, but since it involves matrices, the expression could be linear, so a &quot;shape&quot; attribute is added to distinguish linear and nonlinear expressions.
Definition: OSInstance.h:1793
int numberOfRows
Every cone has (at least) two dimensions; no distinction is made between vector cones and matrix cone...
Definition: OSInstance.h:801
int idx
cones are referenced by an (automatically created) index
Definition: OSInstance.h:564
int idx
cones are referenced by an (automatically created) index
Definition: OSInstance.h:816
virtual std::string getConeName()
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 setRandom(double density, bool conformant, int iMin, int iMax)
A function to make a random instance of this class.
~MatrixObjectives()
The MatrixObjectives class destructor.
bool IsEqual(LinearConstraintCoefficients *that)
A function to check for the equality of two objects.
The in-memory representation of the &lt;stages&gt; element.
Definition: OSInstance.h:2070
Objectives * objectives
objectives is a pointer to a Objectives object
Definition: OSInstance.h:2167
virtual std::string getConeName()
~MatrixCon()
The MatrixCon class destructor.
std::string printModel()
Print the infix representation of the problem.
~NonpositiveCone()
default destructor.
bool IsEqual(PolyhedralCone *that)
A function to check for the equality of two objects.
int getNumberOfQuadraticTerms()
Get the number of specified (usually nonzero) qTerms in the quadratic coefficients.
int coneType
The type of the cone (one of the values in ENUM_CONE_TYPE)
Definition: OSInstance.h:1073
int numberOfColumns
numberOfColumns gives the number of columns of this matrix
Definition: OSInstance.h:1597
MatrixObjectives * matrixObjectives
a pointer to the matrixObjectives object
Definition: OSInstance.h:1874
Variable()
The Variable class constructor.
The in-memory representation of the element.
Definition: OSInstance.h:1912
~IntersectionCone()
The IntersectionCone class destructor.
PolarCone()
The PolarCone class constructor.
bool setQuadraticCoefficients(int number, int *rowIndexes, int *varOneIndexes, int *varTwoIndexes, double *coefficients, int begin, int end)
set quadratic coefficients into the QuadraticCoefficients-&gt;qTerm data structure
TimeDomainStageConstraints()
The TimeDomainStageConstraints class constructor.
int getNumberOfNonlinearExpressionTreeModIndexes()
Get the number of unique nonlinear expression tree indexes after modifying the expression tree to con...
bool IsEqual(Constraint *that)
A function to check for the equality of two objects.
int getNumberOfIntegerVariables()
getNumberOfIntegerVariables
std::string getMatrixExpressionTreeInInfix(int rowIdx)
Get the infix representation for a given row (or objective function) index.
int coneType
The type of the cone (one of the values in ENUM_CONE_TYPE)
Definition: OSInstance.h:1493
virtual std::string getConeInXML()=0
Write a Cone object in XML format.
bool IsEqual(NonlinearExpressions *that)
A function to check for the equality of two objects.
IntVector * colIdx
a pointer of column indices if the problem is stored by row
Definition: OSInstance.h:314
int numberOfOtherIndexes
Cones can also be formed by Multidimensional tensors.
Definition: OSInstance.h:554
The in-memory representation of a product cone.
Definition: OSInstance.h:1251
QuadraticTerm ** qTerm
qTerm is a pointer to an array of QuadraticTerm object pointers
Definition: OSInstance.h:399
int numberOfColumns
Definition: OSInstance.h:1482
virtual std::string getConeName()
int numberOfRows
Every cone has (at least) two dimensions; no distinction is made between vector cones and matrix cone...
Definition: OSInstance.h:545
bool setVariableNumber(int number)
set the number of variables.
int coneType
The type of the cone (one of the values in ENUM_CONE_TYPE)
Definition: OSInstance.h:813
int * getObjectiveCoefficientNumbers()
Get objective coefficient number.
virtual std::string getConeInXML()
Write a NonpositiveCone object in XML format.
an integer Vector data structure
Definition: OSGeneral.h:469
double * getVariableLowerBounds()
Get variable lower bounds.
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 constraint
Definition: OSInstance.h:1966
int * getTimeDomainStageNumberOfConstraints()
Get the number of constraints contained in each time stage.
a generic class from which we derive matrix constructors (BaseMatrix, MatrixElements, MatrixTransformation and MatrixBlocks) as well as matrix types (OSMatrix and MatrixBlock).
Definition: OSMatrix.h:50
CompletelyPositiveMatricesCone()
default constructor.
int getNumberOfMatrixObjectives()
The in-memory representation of the &lt;matrixObj&gt; element.
Definition: OSInstance.h:1656
~TimeDomainStage()
The TimeDomainStage class destructor.
int idx
cones are referenced by an (automatically created) index
Definition: OSInstance.h:1496
virtual std::string getConeName()
int numberOfNonlinearExpressions
numberOfNonlinearExpressions is the number of &lt;nl&gt; elements in the &lt;nonlinearExpressions&gt; element...
Definition: OSInstance.h:468
bool IsEqual(CompletelyPositiveMatricesCone *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...
Definition: OSInstance.h:1061
virtual std::string getConeInXML()
Write an OrthantCone object in XML format.
MatrixExpressions()
The MatrixExpressions class constructor.
QuadraticCone()
The QuadraticCone class constructor.
bool deepCopyFrom(OrthantCone *that)
A function to make a deep copy of an instance of this class.
MatrixVar ** matrixVar
matrixVar is an array of pointers to the &lt;matrixVar&gt; children
Definition: OSInstance.h:1647
bool deepCopyFrom(CopositiveMatricesCone *that)
A function to make a deep copy of an instance of this class.
TimeDomainStageObj ** obj
obj is a pointer to an array of TimeDomainStageObj object pointers
Definition: OSInstance.h:2033
The in-memory representation of the &lt;matrixCon&gt; element.
Definition: OSInstance.h:1722
~ProductCone()
The ProductCone class destructor.
bool IsEqual(MatrixExpressions *that)
A function to check for the equality of two objects.
QuadraticCoefficients * quadraticCoefficients
quadraticCoefficients is a pointer to a QuadraticCoefficients object
Definition: OSInstance.h:2180
bool setInstanceDescription(std::string description)
set the instance description.
int ** getTimeDomainStageVarList()
Get the list of variables in each stage.
Constraint ** con
con is pointer to an array of Constraint object pointers
Definition: OSInstance.h:268
bool setRandom(double density, bool conformant, int iMin, int iMax)
A function to make a random instance of this class.
bool IsEqual(ObjCoef *that)
A function to check for the equality of two objects.
The in-memory representation of the &lt;quadraticCoefficients&gt; element.
Definition: OSInstance.h:382
int numberOfColumns
numberOfColumns gives the number of columns of this matrix
Definition: OSInstance.h:1736
bool IsEqual(NonnegativeCone *that)
A function to check for the equality of two objects.
InstanceData * instanceData
A pointer to an InstanceData object.
Definition: OSInstance.h:2257
int numberOfCones
numberOfCones is the number of &lt;nl&gt; elements in the &lt;cones&gt; element.
Definition: OSInstance.h:1549
std::string semidefiniteness
we need to distinguish positive and negative semidefiniteness
Definition: OSInstance.h:1079
Nl()
default constructor.
bool getIterateResults(double *x, double *objLambda, double *conLambda, bool new_x, int highestOrder)
end revised AD code
TimeDomainStages()
The Stages class constructor.
char type
type corresponds to the attribute that holds the variable type: C (Continuous), B (binary)...
Definition: OSInstance.h:66
~Nl()
default destructor.
int coneType
The type of the cone (one of the values in ENUM_CONE_TYPE)
Definition: OSInstance.h:978
bool initializeNonLinearStructures()
Initialize the data structures for the nonlinear API.
int conReferenceMatrixIdx
conReferenceMatrixIdx allows some or all of the components of this matrixCon to be copied from constr...
Definition: OSInstance.h:1746
bool IsEqual(SemidefiniteCone *that)
A function to check for the equality of two objects.
The in-memory representation of the &lt;matrices&gt; element.
Definition: OSInstance.h:484
int getNumberOfMatrixVariables()
MatrixExpression ** expr
a pointer to an array of linear and nonlinear expressions that evaluate to matrices ...
Definition: OSInstance.h:1848
The in-memory representation of the &lt;cones&gt; element.
Definition: OSInstance.h:1535
virtual std::string getConeInXML()
Write a CopositiveMatricesCone object in XML format.
bool bVariablesModified
bVariablesModified is true if the variables data has been modified.
Definition: OSInstance.h:2267
Constraint()
The Constraint class constructor.
The in-memory representation of the &lt;matrixObjectives&gt; element.
Definition: OSInstance.h:1699
virtual std::string getConeName()
virtual std::string getConeName()
double * getObjectiveConstants()
Get objective constants.
bool setQuadraticTermsInNonlinearExpressions(int number, int *rowIndexes, int *varOneIndexes, int *varTwoIndexes, double *coefficients)
set quadratic terms in nonlinearExpressions
Matrices()
The Matrices class constructor.
double lb
lb is the lower bound on the constraint
Definition: OSInstance.h:235
OSInstance()
The OSInstance class constructor.
~PolyhedralCone()
The PolyhedralCone class destructor.
ENUM_NL_EXPR_SHAPE shape
shape holds the shape of the nonlinear expression (linear/quadratic/convex/general) (see further up i...
Definition: OSInstance.h:1803
int getNumberOfQuadraticRowIndexes()
Get the number of rows which have a quadratic term.
ObjCoef ** coef
coef is pointer to an array of ObjCoef object pointers
Definition: OSInstance.h:176
bool addConstraint(int index, std::string name, double lowerBound, double upperBound, double constant)
add a constraint.
bool setRandom(double density, bool conformant, int iMin, int iMax)
A function to make a random instance of this class.
ENUM_MATRIX_TYPE
An enum to track the many different types of values that a matrix can contain Note that these types a...
Definition: OSParameters.h:596
int getNumberOfBinaryVariables()
getNumberOfBinaryVariables
int varReferenceMatrixIdx
varReferenceMatrixIdx allows some or all of the components of this matrix variable to be copied from ...
Definition: OSInstance.h:1607
bool setRandom(double density, bool conformant, int iMin, int iMax)
A function to make a random instance of this class.
This file defines the OSnLNode class along with its derived classes.
int getTimeDomainStageNumber()
Get the number of stages that make up the time domain.
bool deepCopyFrom(CompletelyPositiveMatricesCone *that)
A function to make a deep copy of an instance of this class.
~InstanceData()
The InstanceData class destructor.
virtual std::string getConeName()
The in-memory representation of a rotated quadratic cone.
Definition: OSInstance.h:953
bool setRandom(double density, bool conformant, int iMin, int iMax)
A function to make a random instance of this class.
int numberOfOtherIndexes
Multidimensional tensors can also form cones (the Kronecker product, for instance, can be thought of as a four-dimensional tensor).
Definition: OSInstance.h:1348
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.
virtual std::string getConeName()
bool getZeroOrderResults(double *x, double *objLambda, double *conLambda)
Calculate function values.
bool m_bDeleteExpressionTree
m_bDeleteExpressionTree is true, if in garbage collection, we should delete the osExpression tree obj...
Definition: OSInstance.h:1810
int numberOfVariables
numberOfVariables is the number of variables in the instance
Definition: OSInstance.h:94
The NonpositiveCone Class.
Definition: OSInstance.h:669
double ** calculateAllObjectiveFunctionGradients(double *x, double *objLambda, double *conLambda, bool new_x, int highestOrder)
Calculate the gradient of all objective functions.
bool setNonlinearExpressions(int nexpr, Nl **root)
set nonlinear expressions
a sparse vector data structure
Definition: OSGeneral.h:122
~MatrixExpression()
The MatrixExpression class destructor.
bool setRandom(double density, bool conformant, int iMin, int iMax)
A function to make a random instance of this class.
double * calculateAllObjectiveFunctionValues(double *x, double *objLambda, double *conLambda, bool new_x, int highestOrder)
Calculate all of the objective function values.
ProductCone()
The ProductCone 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)...
bool IsEqual(MatrixExpression *that)
A function to check for the equality of two objects.
~Variables()
The Variables class destructor.
Constraints * constraints
constraints is a pointer to a Constraints object
Definition: OSInstance.h:2170
The in-memory representation of the &lt;obj&gt; element.
Definition: OSInstance.h:1998
TimeDomainStageVariables()
The TimeDomainStageVariables class constructor.
IntVector * start
a pointer to the start of each row or column stored in sparse format
Definition: OSInstance.h:308
bool setRandom(double density, bool conformant, int iMin, int iMax)
A function to make a random instance of this class.
SemidefiniteCone()
The SemidefiniteCone class constructor.
The in-memory representation of the &lt;matrixExpressions&gt; element.
Definition: OSInstance.h:1832
GeneralFileHeader * instanceHeader
the instanceHeader is implemented as a general file header object to allow sharing of classes between...
Definition: OSInstance.h:2254
double ** getDenseObjectiveCoefficients()
getDenseObjectiveCoefficients.
std::string maxOrMin
declare the objective function to be a max or a min
Definition: OSInstance.h:157
int numberOfConstraints
numberOfConstraints is the number of constraints in the instance
Definition: OSInstance.h:264
LinearConstraintCoefficients()
The LinearConstraintCoefficients class constructor.
int templateMatrixIdx
templateMatrixIdx refers to a matrix that describes the locations in this matrixVar that are allowed ...
Definition: OSInstance.h:1602
int ** getTimeDomainStageObjList()
Get the list of objectives in each stage.
The in-memory representation of the &lt;nl&gt; element.
Definition: OSInstance.h:412
bool deepCopyFrom(SemidefiniteCone *that)
A function to make a deep copy of an instance of this class.
std::string name
name corresponds to the optional attribute that holds the variable name, the default value is empty ...
Definition: OSInstance.h:71
int numberOfRows
Every cone has (at least) two dimensions; no distinction is made between vector cones and matrix cone...
Definition: OSInstance.h:875
ENUM_CONE_TYPE coneType
The type of the cone.
Definition: OSInstance.h:558
~NonnegativeCone()
default destructor.
virtual std::string getConeInXML()
Write a CompletelyPositiveMatricesCone object in XML format.
TimeDomainStages * stages
stages is a pointer to a Stages object
Definition: OSInstance.h:2130
int numberOfObjectives
numberOfObjectives gives the number of objectives contained in this stage
Definition: OSInstance.h:2027
bool IsEqual(IntersectionCone *that)
A function to check for the equality of two objects.
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.
TimeDomainStageObj()
The TimeDomainStageObj class constructor.
Objective ** obj
coef is pointer to an array of ObjCoef object pointers
Definition: OSInstance.h:205
bool setInstanceLicence(std::string licence)
set the instance licence.
bool setRandom(double density, bool conformant, int iMin, int iMax)
A function to make a random instance of this class.
std::vector< ExprNode * > getMatrixExpressionTreeModInPostfix(int rowIdx)
Get the postfix tokens for a given row index for the modified Expression Tree (quadratic terms added)...
int getNumberOfNonlinearObjectives()
MatrixConstraints * matrixConstraints
a pointer to the matrixConstraints object
Definition: OSInstance.h:1877
int getNumberOfStringVariables()
getNumberOfStringVariables
char * getVariableTypes()
Get variable initial values.
bool IsEqual(OSInstance *that)
A function to check for the equality of two objects.
bool deepCopyFrom(ProductCone *that)
A function to make a deep copy of an instance of this class.
Variables()
The Variables class constructor.
bool setTimeDomainStageConstraintsOrdered(int numberOfStages, int *numberOfConstraints, int *startIdx)
This sets the constraints associated with each time domain stage in temporal order.
std::map< int, MatrixExpressionTree * > getAllMatrixExpressionTrees()
int numberOfValues
numberOfValues is the number of nonzero elements stored in the &lt;linearConstraintCoefficients&gt; element...
Definition: OSInstance.h:301
Constraints()
The Constraints class constructor.
bool setTimeDomainStages(int number, std::string *names)
This sets the number (and optionally names) of the time stages.
int numberOfConstraints
numberOfConstraints gives the number of constraints contained in this stage
Definition: OSInstance.h:1984
int * getMatrixExpressionTreeIndexes()
Get all the matrix expression tree indexes, i.e.
bool addVariable(int index, std::string name, double lowerBound, double upperBound, char type)
add a variable.
int numberOfOtherIndexes
Multidimensional tensors can also form cones (the Kronecker product, for instance, can be thought of as a four-dimensional tensor).
Definition: OSInstance.h:1272
bool setRandom(double density, bool conformant, int iMin, int iMax)
A function to make a random instance of this class.
MatrixProgramming * matrixProgramming
matrixProgramming is a pointer to a MatrixProgramming object
Definition: OSInstance.h:2200
~QuadraticCone()
The QuadraticCone class destructor.
double getTimeDomainIntervalStart()
Get the start for the time domain interval.
bool deepCopyFrom(NonpositiveCone *that)
A function to make a deep copy of an instance of this class.
std::string name
name corresponds to the optional attribute that holds the name of the stage; the default value is emp...
Definition: OSInstance.h:2054
~Constraint()
The Constraint class destructor.
bool setTimeDomain(std::string format)
This sets the format of the time domain (&quot;stages&quot;/&quot;interval&quot;/&quot;none&quot;)
Variables * variables
variables is a pointer to a Variables object
Definition: OSInstance.h:2164
bool IsEqual(InstanceData *that)
A function to check for the equality of two objects.
bool getSecondOrderResults(double *x, double *objLambda, double *conLambda)
Calculate second derivatives.
std::string * getVariableNames()
Get variable names.
bool bAMatrixModified
bAMatrixModified is true if the A matrix data has been modified.
Definition: OSInstance.h:2282
int * otherIndexes
Definition: OSInstance.h:1273
std::string getNonlinearExpressionTreeInInfix(int rowIdx)
Get the infix representation for a given row (or objective function) index.
a data structure to represent a matrix object (derived from MatrixType)
Definition: OSMatrix.h:1137
int numberOfMatrices
numberOfMatrices is the number of &lt;nl&gt; elements in the &lt;matrices&gt; element.
Definition: OSInstance.h:498
MatrixExpressionTree * getMatrixExpressionTree(int rowIdx)
Get the matrix expression tree for a given row index.
LinearConstraintCoefficients * linearConstraintCoefficients
linearConstraintCoefficients is a pointer to a LinearConstraintCoefficients object ...
Definition: OSInstance.h:2175
int numberOfObjectives
numberOfObjectives is the number of objective functions in the instance
Definition: OSInstance.h:201
int numberOfOtherIndexes
Multidimensional tensors can also form cones (the Kronecker product, for instance, can be thought of as a four-dimensional tensor).
Definition: OSInstance.h:809
Cone ** cone
cone is pointer to an array of Cone object pointers
Definition: OSInstance.h:1552
~Objective()
The Objective class destructor.
OrthantCone()
default constructor.
ScalarExpressionTree * getNonlinearExpressionTreeMod(int rowIdx)
Get the expression tree for a given row index for the modified expression trees (quadratic terms adde...
IntVector * rowIdx
a pointer of row indices if the problem is stored by column
Definition: OSInstance.h:311
int orderConeIdx
orderConeIdx gives a cone that expresses preferences during the optimization x is (weakly) preferred ...
Definition: OSInstance.h:1685
char varType
an optional type for each component of this matrixVar
Definition: OSInstance.h:1625
int idx
cones are referenced by an (automatically created) index
Definition: OSInstance.h:890
double * getObjectiveWeights()
Get objective weights.
int lbMatrixIdx
lbMatrixIdx gives a lower bound for this matrixCon
Definition: OSInstance.h:1749
void duplicateExpressionTreesMap()
duplicate the map of expression trees.
int numberOfRows
Every cone has (at least) two dimensions; no distinction is made between vector cones and matrix cone...
Definition: OSInstance.h:1481
int getNumberOfNonlinearConstraints()
double * ub
For each dimension of the cone, give the upper and lower bounds The upper bound can be only zero or +...
Definition: OSInstance.h:735
TimeDomainStageVar ** var
var is a pointer to an array of TimeDomainStageVar object pointers
Definition: OSInstance.h:1947
bool setConeNumber(int number)
set the number of cones
~QuadraticCoefficients()
The QuadraticCoefficients class destructor.
TimeDomain()
The TimeDomain class constructor.
int numberOfStages
numberOfStages is the number of stages in the &lt;stages&gt; element.
Definition: OSInstance.h:2083
int numberOfOtherIndexes
Multidimensional tensors can also form cones (the Kronecker product, for instance, can be thought of as a four-dimensional tensor).
Definition: OSInstance.h:1424
TimeDomainStageVariables * variables
variables is a pointer to a TimeDomainVariables object
Definition: OSInstance.h:2057
int getLinearConstraintCoefficientNumber()
Get number of specified (usually nonzero) linear constraint coefficient values.
int idx
idx is the index of the variable corresponding to the coefficient
Definition: OSInstance.h:123
The in-memory representation of the &lt;matrixVar&gt; element.
Definition: OSInstance.h:1583
int idx
idx gives the index of this variable
Definition: OSInstance.h:2009
std::string * getObjectiveMaxOrMins()
Get objective maxOrMins.
bool setTimeDomainStageVariablesUnordered(int numberOfStages, int *numberOfVariables, int **varIndex)
This sets the variables associated with each time domain stage in srbitrary order.
std::map< int, int > getAllNonlinearVariablesIndexMap()
TimeDomainStageObjectives * objectives
objectives is a pointer to a TimeDomainObjectives object
Definition: OSInstance.h:2063
The in-memory representation of the &lt;matrixConstraints&gt; element.
Definition: OSInstance.h:1769
~TimeDomainStageObjectives()
The TimeDomainStageObjectives class destructor.
int numberOfObjCoef
numberOfObjCoef is the number of variables with a nonzero objective function coefficient ...
Definition: OSInstance.h:172
bool IsEqual(DualCone *that)
A function to check for the equality of two objects.
std::string getTimeDomainFormat()
Get the format of the time domain (&quot;stages&quot;/&quot;interval&quot;)
int startIdx
startdIdx gives the number of the first constraint contained in this stage
Definition: OSInstance.h:1987
bool IsEqual(Constraints *that)
A function to check for the equality of two objects.
bool addQTermsToExpressionTree()
This method adds quadratic terms into the array of expression trees.
int numberOfRows
Every cone has (at least) two dimensions; no distinction is made between vector cones and matrix cone...
Definition: OSInstance.h:1264
virtual std::string getConeInXML()
Write a NonnegativeCone object in XML format.
std::vector< ExprNode * > getMatrixExpressionTreeInPostfix(int rowIdx)
Get the postfix tokens for a given row index.
bool setRandom(double density, bool conformant, int iMin, int iMax)
A function to make a random instance of this class.
std::map< int, ScalarExpressionTree * > getAllNonlinearExpressionTrees()
int iNumberOfStartElements
iNumberOfStartElements counts the number of elements in the &lt;start&gt; section of &lt;linearConstraintCoeff...
Definition: OSInstance.h:324
bool deepCopyFrom(NonnegativeCone *that)
A function to make a deep copy of an instance of this class.
int coneType
The type of the cone (one of the values in ENUM_CONE_TYPE)
Definition: OSInstance.h:1428
RotatedQuadraticCone()
The RotatedQuadraticCone class constructor.
bool IsEqual(MatrixProgramming *that)
A function to check for the equality of two objects.
double coef
coef is the coefficient of the quadratic term
Definition: OSInstance.h:368
bool deepCopyFrom(DualCone *that)
A function to make a deep copy of an instance of this class.
TimeDomainStageVar()
The TimeDomainStageVar class constructor.
int idxOne
idxOne is the index of the first variable in the quadratic term
Definition: OSInstance.h:360
int startIdx
startdIdx gives the number of the first objective contained in this stage
Definition: OSInstance.h:2030
int ubConeIdx
ubConeIdx gives a cone that must contain ubMatrix - matrixCon
Definition: OSInstance.h:1758
Nl ** nl
nl is pointer to an array of Nl object pointers
Definition: OSInstance.h:471
bool IsEqual(Variables *that)
A function to check for the equality of two objects.
Variable ** var
Here we define a pointer to an array of var pointers.
Definition: OSInstance.h:97
The in-memory representation of the &lt;obj&gt; element.
Definition: OSInstance.h:141
std::vector< ExprNode * > getNonlinearExpressionTreeInPrefix(int rowIdx)
Get the prefix tokens for a given row index.
double weight
weight is the weight applied to the given objective function, 1.0 by default
Definition: OSInstance.h:167
bool setVariables(int number, std::string *names, double *lowerBounds, double *upperBounds, char *types)
set all the variable related elements.
~TimeDomainStageCon()
The TimeDomainStageCon class destructor.
std::string * getTimeDomainStageNames()
Get the names of the stages (NULL or empty string (&quot;&quot;) if a stage has not been given a name...
int lbConeIdx
lbConeIdx gives a cone that must contain matrixVar - lbMatrix
Definition: OSInstance.h:1613
bool setTimeDomainStageObjectivesUnordered(int numberOfStages, int *numberOfObjectives, int **varIndex)
This sets the objectives associated with each time domain stage in arbitrary order.
virtual std::string getConeName()
~MatrixConstraints()
The MatrixConstraints class destructor.
~ObjCoef()
The ObjCoef class destructor.
SparseVector ** getObjectiveCoefficients()
Get objective coefficients.
int referenceConeIdx
Dual cones use a reference to another, previously defined cone.
Definition: OSInstance.h:1434
int numberOfExpr
numberOfExpr gives the number of expressions
Definition: OSInstance.h:1843
bool setTimeDomainStageConstraintsUnordered(int numberOfStages, int *numberOfConstraints, int **conIndex)
This sets the constraints associated with each time domain stage in srbitrary order.
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 a polyhedral cone.
Definition: OSInstance.h:788
int * otherIndexes
Definition: OSInstance.h:884
TimeDomainStage()
The TimeDomainStage class constructor.
double ub
ub is the upper bound on the constraint
Definition: OSInstance.h:238
bool bUseExpTreeForFunEval
bUseExpTreeForFunEval is set to true if you wish to use the OS Expression Tree for function evaluatio...
Definition: OSInstance.h:4588
bool setInstanceSource(std::string source)
set the instance source.
double normScaleFactor
rotated quadratic cones normally are of the form x0x1 &gt;= x2^2 + x3^2 + ...
Definition: OSInstance.h:989
MatrixCon ** matrixCon
matrixCon is an array of pointers to the &lt;matrixCon&gt; children
Definition: OSInstance.h:1783
bool getFirstOrderResults(double *x, double *objLambda, double *conLambda)
Calculate first derivatives.
PolyhedralCone()
The PolyhedralCone 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)...