My Project
OSInstance.h
Go to the documentation of this file.
1/* $Id$ */
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
45{
46public:
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
84{
85public:
86
88 Variables();
89
91 ~Variables();
92
95
98
102 bool IsEqual(Variables *that);
103}; // class Variables
104
105
111{
112public:
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{
143public:
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{
190public:
191
193 Objectives();
194
196 ~Objectives();
197
202
206
210 bool IsEqual(Objectives *that);
211};//class Objectives
212
213
219{
220public:
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{
253public:
254
256 Constraints();
257
259 ~Constraints();
260
265
269
273 bool IsEqual(Constraints *that);
274};//class Constraints
275
276
329
330
341{
342public:
343
346
349
353 int idx;
354
359
364
366 double coef;
367
371 bool IsEqual(QuadraticTerm *that);
372}; // QuadraticTerm
373
374
381{
382public:
383
386
389
394
398
402 bool IsEqual(QuadraticCoefficients *that);
403}; // QuadraticCoefficients
404
405
410class Nl
411{
412public:
414 int idx;
415
421
428
431
435 Nl();
436
440 ~Nl();
441
445 bool IsEqual(Nl *that);
446};//end Nl
447
453{
454public:
455
458
461
467
470
474 bool IsEqual(NonlinearExpressions *that);
475}; // NonlinearExpressions
476
477
483{
484public:
485
487 Matrices();
488
490 ~Matrices();
491
497
500
504 bool IsEqual(Matrices *that);
505
515 bool setRandom(double density, bool conformant, int iMin, int iMax);
516
523}; // Matrices
524
525
530class Cone
531{
532public:
533
535 Cone();
536
538 virtual ~Cone();
539
545
554
557
559 std::string name;
560
562 int idx;
563
567 virtual std::string getConeName();
568
575 virtual std::string getConeInXML() = 0;
576
577
581 bool IsEqual(Cone *that);
582
592 bool setRandom(double density, bool conformant, int iMin, int iMax);
593
599 bool deepCopyFrom(Cone *that);
600}; // Cone
601
609class NonnegativeCone : public Cone
610{
611public:
616
621
625 virtual std::string getConeName();
626
633 virtual std::string getConeInXML();
634
639
649 bool setRandom(double density, bool conformant, int iMin, int iMax);
650
657
658};//end NonnegativeCone
659
667class NonpositiveCone : public Cone
668{
669public:
674
679
683 virtual std::string getConeName();
684
691 virtual std::string getConeInXML();
692
697
707 bool setRandom(double density, bool conformant, int iMin, int iMax);
708
715
716};//end NonpositiveCone
717
718
726class OrthantCone : public Cone
727{
728public:
733 double* ub;
734 double* lb;
735
739 OrthantCone();
740
744 ~OrthantCone();
745
749 virtual std::string getConeName();
750
757 virtual std::string getConeInXML();
758
762 bool IsEqual(OrthantCone *that);
763
773 bool setRandom(double density, bool conformant, int iMin, int iMax);
774
781};//end OrthantCone
782
786class PolyhedralCone : public Cone
787{
788public:
789
792
795
801
809
812
814 int idx;
815
818
822 virtual std::string getConeName();
823
830 virtual std::string getConeInXML();
831
835 bool IsEqual(PolyhedralCone *that);
836
846 bool setRandom(double density, bool conformant, int iMin, int iMax);
847
854}; // PolyhedralCone
855
856
860class QuadraticCone : public Cone
861{
862public:
863
866
869
875
883
886
888 int idx;
889
898
909
913 virtual std::string getConeName();
914
921 virtual std::string getConeInXML();
922
926 bool IsEqual(QuadraticCone *that);
927
937 bool setRandom(double density, bool conformant, int iMin, int iMax);
938
945}; // QuadraticCone
946
947
952{
953public:
954
957
960
966
974
977
979 int idx;
980
989
1001
1005 virtual std::string getConeName();
1006
1013 virtual std::string getConeInXML();
1014
1018 bool IsEqual(RotatedQuadraticCone *that);
1019
1029 bool setRandom(double density, bool conformant, int iMin, int iMax);
1030
1037}; // RotatedQuadraticCone
1038
1039/* Not yet implemented:
1040 ENUM_CONE_TYPE_normed,
1041*/
1042
1047{
1048public:
1049
1052
1055
1061
1069
1072
1074 int idx;
1075
1077 std::string semidefiniteness;
1078
1081
1085 virtual std::string getConeName();
1086
1093 virtual std::string getConeInXML();
1094
1098 bool IsEqual(SemidefiniteCone *that);
1099
1109 bool setRandom(double density, bool conformant, int iMin, int iMax);
1110
1117}; // SemidefiniteCone
1118
1119
1128{
1129public:
1134
1139
1143 virtual std::string getConeName();
1144
1151 virtual std::string getConeInXML();
1152
1157
1167 bool setRandom(double density, bool conformant, int iMin, int iMax);
1168
1175
1176};//end CopositiveMatricesCone
1177
1178
1187{
1188public:
1194
1199
1203 virtual std::string getConeName();
1204
1212 virtual std::string getConeInXML();
1213
1218
1228 bool setRandom(double density, bool conformant, int iMin, int iMax);
1229
1236
1237};//end CompletelyPositiveMatricesCone
1238
1239/* Not yet implemented:
1240 ENUM_CONE_TYPE_hyperbolicity,
1241 ENUM_CONE_TYPE_nonnegativePolynomials,
1242 ENUM_CONE_TYPE_moments,
1243*/
1244
1248class ProductCone : public Cone
1249{
1250public:
1251
1253 ProductCone();
1254
1256 ~ProductCone();
1257
1263
1271
1274
1276 int idx;
1277
1282
1286 virtual std::string getConeName();
1287
1294 virtual std::string getConeInXML();
1295
1299 bool IsEqual(ProductCone *that);
1300
1310 bool setRandom(double density, bool conformant, int iMin, int iMax);
1311
1312
1319}; // ProductCone
1320
1325{
1326public:
1327
1330
1333
1339
1347
1350
1352 int idx;
1353
1358
1362 virtual std::string getConeName();
1363
1370 virtual std::string getConeInXML();
1371
1375 bool IsEqual(IntersectionCone *that);
1376
1386 bool setRandom(double density, bool conformant, int iMin, int iMax);
1387
1394}; // IntersectionCone
1395
1396
1400class DualCone : public Cone
1401{
1402public:
1403
1405 DualCone();
1406
1408 ~DualCone();
1409
1415
1423
1426
1428 int idx;
1429
1432
1436 virtual std::string getConeName();
1437
1441 bool IsEqual(DualCone *that);
1442
1452 bool setRandom(double density, bool conformant, int iMin, int iMax);
1453
1460}; // DualCone
1461
1465class PolarCone : public Cone
1466{
1467public:
1468
1470 PolarCone();
1471
1473 ~PolarCone();
1474
1480
1488
1491
1493 int idx;
1494
1497
1501 virtual std::string getConeName();
1502
1506 bool IsEqual(PolarCone *that);
1507
1517 bool setRandom(double density, bool conformant, int iMin, int iMax);
1518
1525}; // PolarCone
1526
1527
1533{
1534public:
1535
1537 Cones();
1538
1540 ~Cones();
1541
1547
1550
1554 bool IsEqual(Cones *that);
1555
1564 bool setRandom(double density, bool conformant, int iMin, int iMax);
1565
1571 bool deepCopyFrom(Cones *that);
1572}; // Cones
1573
1574
1580{
1581public:
1584
1587
1592
1597
1600
1603
1606
1609
1611 std::string name;
1612
1617
1619 MatrixVar();
1620
1622 ~MatrixVar();
1623
1627 bool IsEqual(MatrixVar *that);
1628}; // MatrixVar
1629
1630
1636{
1637public:
1640
1643
1646
1649
1653 bool IsEqual(MatrixVariables *that);
1654}; // MatrixVariables
1655
1656
1662{
1663public:
1666
1669
1674
1679
1684
1687
1689 std::string name;
1690
1692 MatrixObj();
1693
1695 ~MatrixObj();
1696
1700 bool IsEqual(MatrixObj *that);
1701}; // MatrixObj
1702
1703
1709{
1710public:
1711
1714
1717
1720
1723
1724
1728 bool IsEqual(MatrixObjectives *that);
1729}; // MatrixObjectives
1730
1731
1737{
1738public:
1741
1744
1749
1754
1757
1760
1763
1766
1768 std::string name;
1769
1771 MatrixCon();
1772
1774 ~MatrixCon();
1775
1779 bool IsEqual(MatrixCon *that);
1780}; // MatrixCon
1781
1782
1788{
1789public:
1790
1793
1796
1799
1802
1803
1807 bool IsEqual(MatrixConstraints *that);
1808}; // MatrixConstraints
1809
1817{
1818public:
1820 int idx;
1821
1827
1830
1837
1840
1843
1847 bool IsEqual(MatrixExpression *that);
1848}; // MatrixExpression
1849
1850
1856{
1857public:
1860
1865
1868
1871
1875 bool IsEqual(MatrixExpressions *that);
1876}; // MatrixExpressions
1877
1883{
1884public:
1887
1890
1893
1896
1899
1902
1903
1907 bool IsEqual(MatrixProgramming *that);
1908
1918 bool setRandom(double density, bool conformant, int iMin, int iMax);
1919
1926}; // MatrixProgramming
1927
1928
1934{
1935public:
1936
1939
1942
1944 int idx;
1945}; // TimeDomainStageVar
1946
1952{
1953public:
1954
1957
1960
1963
1966
1969}; // TimeDomainStageVariables
1970
1971
1977{
1978public:
1979
1982
1985
1987 int idx;
1988}; // TimeDomainStageCon
1989
1995{
1996public:
1997
2000
2003
2006
2009
2012}; // TimeDomainStageConstraints
2013
2014
2020{
2021public:
2022
2025
2028
2030 int idx;
2031}; // TimeDomainStageObj
2032
2038{
2039public:
2040
2043
2046
2049
2052
2055}; // TimeDomainStageObjectives
2056
2057
2063{
2064public:
2065
2068
2071
2075 std::string name;
2076
2079
2082
2085}; // TimeDomainStage
2086
2092{
2093public:
2094
2097
2100
2105
2108}; // Stages
2109
2115{
2116public:
2117
2120
2123
2127 double start;
2128
2132 double horizon;
2133}; // Interval
2134
2140{
2141public:
2142
2144 TimeDomain();
2145
2147 ~TimeDomain();
2148
2152
2156}; // TimeDomain
2157
2233
2234
2263{
2264public:
2265
2267 OSInstance();
2268
2270 ~OSInstance();
2271
2276
2279
2283 bool IsEqual(OSInstance *that);
2284
2289
2294
2299
2304
2305private:
2310 std::string m_sInstanceName;
2327
2328
2334
2339
2344
2349
2354
2359
2364
2368 std::string* m_msVariableNames;
2369
2375
2380
2385
2386
2392
2397
2402
2407
2411 std::string* m_msMaxOrMins;
2412
2417
2422
2427
2433
2438
2444
2445
2451
2456
2461
2466
2471
2476
2482
2488
2489
2496
2502
2508
2515
2522
2523
2529
2534
2539
2544
2550
2556
2560
2561
2568
2574
2581
2588
2594
2600
2601
2607
2613
2618
2623
2629
2634
2639
2645
2651
2656
2661
2666
2671
2677
2682
2688
2697 std::map<int, ScalarExpressionTree*> m_mapExpressionTrees;
2698
2703 std::map<int, int> m_mapOSADFunRangeIndex;
2704
2713 std::map<int, MatrixExpressionTree*> m_mapMatrixExpressionTrees;
2714
2720
2725
2730
2736
2741
2747
2753
2761 std::map<int, ScalarExpressionTree*> m_mapExpressionTreesMod ;
2762
2769
2775
2781
2786
2791
2796
2802 std::map<int, std::vector<OSnLNode*> > m_mapExpressionTreesInPostfix ;
2803
2809
2815
2816
2821 std::vector<double> m_vdX;
2822
2826 std::vector<double> m_vdYval;
2827
2832 std::vector<bool> m_vbLagHessNonz;
2833
2837 std::vector<double> m_vdYjacval;
2838
2842 std::vector<double> m_vdw;
2843
2847 std::vector<double> m_vdLambda;
2848
2852 std::vector<double> m_vdDomainUnitVec;
2853
2857 std::vector<double> m_vdRangeUnitVec;
2858
2859
2865
2870
2876
2882
2887
2892
2896 std::string* m_msMatrixNames;
2897
2906
2907#if 0
2930 GeneralSparseMatrix** m_mExpandedMatricesInColumnMajor;
2931
2935 GeneralSparseMatrix** m_mExpandedMatricesInRowMajor;
2936
2942 ExpandedMatrixBlocks** m_mMatrixBlocksInColumnMajor;
2943
2949 OSnLMNode *m_mMatrixTransformation;
2950#endif
2951
2957
2962
2967
2972
2973
2979
2984
2989
2994
2999
3004
3009
3010
3011
3012
3017
3022
3027
3032
3037
3042
3043
3050 bool processVariables();
3051
3058 bool processObjectives();
3059
3066 bool processConstraints();
3067
3075
3082 bool processMatrices();
3083
3084public:
3085
3090 std::string getInstanceName();
3091
3096 std::string getInstanceSource();
3097
3103 std::string getInstanceDescription();
3104
3109 std::string getInstanceCreator();
3110
3116 std::string getInstanceLicence();
3117
3118
3124 int getVariableNumber();
3125
3132 std::string* getVariableNames();
3133
3141 //double* getVariableInitialValues();
3142
3150 //std::string* getVariableInitialStringValues();
3151
3163 char* getVariableTypes();
3164
3170
3176
3182
3188
3194
3201 double* getVariableLowerBounds();
3202
3209 double* getVariableUpperBounds();
3210
3216 int getObjectiveNumber();
3217
3218
3225 std::string* getObjectiveNames();
3226
3233 std::string* getObjectiveMaxOrMins();
3234
3235
3245
3252 double* getObjectiveConstants();
3253
3260 double* getObjectiveWeights();
3261
3273
3281
3287 int getConstraintNumber();
3288
3295 std::string* getConstraintNames();
3296
3303 double* getConstraintLowerBounds();
3304
3311 double *getConstraintUpperBounds();
3312
3319 double *getConstraintConstants();
3320
3334 char* getConstraintTypes();
3335
3342
3343
3351
3352
3360
3368
3375
3385
3394
3401
3402
3403/*********************************************************************
3404 * *
3405 * Here we have a number of methods for dealing with *
3406 * scalar-valued expression trees. *
3407 * Even though the tree can contain OSnLMNodes (e.g., to compute *
3408 * the trace of a matrix), the root of the tree is of type OSnLNode. *
3409 * *
3410 *********************************************************************/
3411
3418
3425
3432
3440
3449 std::vector<ExprNode*> getNonlinearExpressionTreeInPostfix( int rowIdx);
3450
3458 std::vector<ExprNode*> getNonlinearExpressionTreeModInPostfix( int rowIdx);
3459
3466 std::vector<ExprNode*> getNonlinearExpressionTreeInPrefix( int rowIdx);
3467
3475 std::string getNonlinearExpressionTreeInInfix( int rowIdx);
3476
3477
3485 std::vector<ExprNode*> getNonlinearExpressionTreeModInPrefix( int rowIdx);
3486
3487
3492
3497
3503 std::map<int, ScalarExpressionTree* > getAllNonlinearExpressionTrees();
3504
3508 std::map<int, ScalarExpressionTree* > getAllNonlinearExpressionTreesMod();
3509
3517
3518
3525
3526
3535
3543
3549 int getMatrixNumber();
3550
3564
3575
3583// int getNumberOfBlocksForMatrix(int n);
3584
3593
3602
3611
3619 std::string getMatrixName(int n);
3620
3627 bool matrixHasBase(int n);
3628 bool matrixHasElements(int n);
3629 bool matrixHasTransformations(int n);
3630 bool matrixHasBlocks(int n);
3634
3643
3652
3661
3669// SymmetricMatrixBlocks* getSymmetricMatrixBlocks(int n);
3670
3682 GeneralSparseMatrix* getMatrixBlockInColumnMajorForm(int n, int columnIdx, int rowIdx);
3683
3684
3685/***********************************************************************
3686 * *
3687 * Here we have a number of methods for dealing with *
3688 * matrix programming and matrix-valued expression trees. *
3689 * Even though the tree can contain OSnLNodes (e.g., to compute the *
3690 * scalar multiple of a matrix), the root of the tree is an OSnLMNode. *
3691 * *
3692 ***********************************************************************/
3693
3700
3707
3714
3721
3728
3735
3742 std::vector<ExprNode*> getMatrixExpressionTreeInPostfix( int rowIdx);
3743
3751 std::vector<ExprNode*> getMatrixExpressionTreeModInPostfix( int rowIdx);
3752
3759 std::vector<ExprNode*> getMatrixExpressionTreeInPrefix( int rowIdx);
3760
3768 std::string getMatrixExpressionTreeInInfix( int rowIdx);
3769
3770
3774 std::map<int, MatrixExpressionTree* > getAllMatrixExpressionTrees();
3775
3776
3780 std::map<int, MatrixExpressionTree* > getAllMatrixExpressionTreesMod();
3781
3789
3790
3797
3798//===============================================
3799
3805 std::string getTimeDomainFormat();
3806
3813
3819 std::string* getTimeDomainStageNames();
3820
3827
3828
3835
3842
3849
3856
3863
3870
3877
3878
3879
3880 // the set() methods
3881
3882
3889 bool setInstanceName(std::string name);
3890
3897 bool setInstanceSource(std::string source);
3898
3905 bool setInstanceDescription(std::string description);
3906
3913 bool setInstanceCreator(std::string fileCreator);
3914
3921 bool setInstanceLicence(std::string licence);
3922
3923
3930 bool setVariableNumber(int number);
3931
3947 bool addVariable(int index, std::string name, double lowerBound, double upperBound, char type);
3948
3968 bool setVariables(int number, std::string* names, double* lowerBounds,
3969 double* upperBounds, char* types);
3970
3971
3978 bool setObjectiveNumber(int number);
3979
3997 bool addObjective(int index, std::string name, std::string maxOrMin, double constant, double weight, SparseVector* objectiveCoefficients);
3998
4014 bool setObjectives(int number, std::string *names, std::string *maxOrMins, double *constants, double *weights, SparseVector **objectitiveCoefficients);
4015
4022 bool setConstraintNumber(int number);
4023
4037 bool addConstraint(int index, std::string name, double lowerBound, double upperBound, double constant);
4038
4052 bool setConstraints(int number, std::string* names, double* lowerBounds, double* upperBounds, double* constants);
4053
4072 bool setLinearConstraintCoefficients(int numberOfValues, bool isColumnMajor,
4073 double* values, int valuesBegin, int valuesEnd,
4074 int* indexes, int indexesBegin, int indexesEnd,
4075 int* starts, int startsBegin, int startsEnd);
4076
4095 bool copyLinearConstraintCoefficients(int numberOfValues, bool isColumnMajor,
4096 double* values, int valuesBegin, int valuesEnd,
4097 int* indexes, int indexesBegin, int indexesEnd,
4098 int* starts, int startsBegin, int startsEnd);
4099
4108 bool setNumberOfQuadraticTerms(int nq);
4109
4126 bool setQuadraticCoefficients(int number,
4127 int* rowIndexes, int* varOneIndexes, int* varTwoIndexes,
4128 double* coefficients, int begin, int end);
4129
4130
4145 int* rowIndexes, int* varOneIndexes, int* varTwoIndexes, double* coefficients);
4146
4156 bool setNonlinearExpressions(int nexpr, Nl** root);
4157
4164 bool setMatrixNumber(int number);
4165
4188 bool addMatrix(int index, std::string name, int numberOfRows, int numberOfColumns,
4189 ENUM_MATRIX_SYMMETRY symmetry, ENUM_MATRIX_TYPE matrixType,
4190 unsigned int inumberOfChildren, MatrixNode **m_mChildren);
4191
4192
4199 bool setConeNumber(int number);
4200
4227 bool addCone(int index, int numberOfRows, int numberOfColumns, ENUM_CONE_TYPE coneType,
4228 std::string name, int numberOfOtherIndexes = 0, int* otherIndexes = NULL);
4229
4256 bool addCone(int index, int numberOfRows, int numberOfColumns, ENUM_CONE_TYPE coneType,
4257 std::string name, int numberOfComponents, int* components,
4258 int numberOfOtherIndexes = 0, int* otherIndexes = NULL);
4259
4286 bool addCone(int index, int numberOfRows, int numberOfColumns, ENUM_CONE_TYPE coneType,
4287 std::string name, int referenceIdx, int numberOfOtherIndexes = 0, int* otherIndexes = NULL);
4288
4314 bool addCone(int index, int numberOfRows, int numberOfColumns, ENUM_CONE_TYPE coneType,
4315 std::string name, std::string semidefiniteness, int numberOfOtherIndexes = 0, int* otherIndexes = NULL);
4316
4343 bool addCone(int index, int numberOfRows, int numberOfColumns, ENUM_CONE_TYPE coneType,
4344 std::string name, int distortionMatrixIdx, double normFactor, int axisDirection,
4345 int numberOfOtherIndexes = 0, int* otherIndexes = NULL);
4346
4374 bool addCone(int index, int numberOfRows, int numberOfColumns, ENUM_CONE_TYPE coneType,
4375 std::string name, int distortionMatrixIdx, double normFactor, int firstAxisDirection,
4376 int secondAxisDirection, int numberOfOtherIndexes = 0, int* otherIndexes = NULL);
4377
4404 bool addCone(int index, int numberOfRows, int numberOfColumns, ENUM_CONE_TYPE coneType,
4405 std::string name, int distortionMatrixIdx, double normFactor, int axisDirection, double pNorm,
4406 int numberOfOtherIndexes = 0, int* otherIndexes = NULL);
4407
4438 bool addCone(int index, int numberOfRows, int numberOfColumns, ENUM_CONE_TYPE coneType,
4439 std::string name, int maxDegree, int numberOfUB, double* ub, int numberOfLB, double* lb,
4440 int numberOfOtherIndexes = 0, int* otherIndexes = NULL);
4441
4442
4443 // methods to print the current model or parts of it
4444
4449 std::string printModel( );
4450
4458 std::string printModel( int rowIdx);
4459
4460
4461
4462 // nonlinear API methods
4463
4464
4471
4485 double calculateFunctionValue(int idx, double* x, bool new_x);
4486
4501 double *calculateAllConstraintFunctionValues(double* x, double *objLambda, double *conLambda,
4502 bool new_x, int highestOrder);
4503
4517 double *calculateAllConstraintFunctionValues(double* x, bool new_x);
4518
4534 double *calculateAllObjectiveFunctionValues(double* x, double *objLambda, double *conLambda,
4535 bool new_x, int highestOrder);
4536
4550 double *calculateAllObjectiveFunctionValues(double* x, bool new_x);
4551
4552
4568 double *conLambda, bool new_x, int highestOrder);
4569
4570
4586 SparseVector *calculateConstraintFunctionGradient(double* x, double *objLambda, double *conLambda,
4587 int idx, bool new_x, int highestOrder);
4588
4602 SparseVector *calculateConstraintFunctionGradient(double* x, int idx, bool new_x );
4603
4618 double **calculateAllObjectiveFunctionGradients(double* x, double *objLambda, double *conLambda,
4619 bool new_x, int highestOrder);
4620
4636 double *calculateObjectiveFunctionGradient(double* x, double *objLambda, double *conLambda,
4637 int objIdx, bool new_x, int highestOrder);
4638
4652 double *calculateObjectiveFunctionGradient(double* x, int objIdx, bool new_x );
4653
4671 SparseHessianMatrix *calculateLagrangianHessian( double* x, double *objLambda, double *conLambda,
4672 bool new_x, int highestOrder);
4673
4686 SparseHessianMatrix *calculateHessian( double* x, int idx, bool new_x);
4687
4688
4694
4700
4706
4711 std::map<int, int> getAllNonlinearVariablesIndexMap( );
4712
4718
4726
4734
4740
4746
4747#ifdef OS_HAS_CPPAD
4752 CppAD::ADFun<double> *Fad;
4753#endif
4765 bool createOSADFun(std::vector<double> vdX );
4766
4777 std::vector<double> forwardAD(int p, std::vector<double> vdX);
4778
4789 std::vector<double> reverseAD(int p, std::vector<double> vdlambda);
4790
4804
4824 bool getIterateResults(double *x, double *objLambda, double *conLambda,
4825 bool new_x, int highestOrder);
4826
4827
4828
4841 bool getZeroOrderResults(double *x, double *objLambda, double *conLambda);
4842
4855 bool getFirstOrderResults(double *x, double *objLambda, double *conLambda );
4856
4869 bool getSecondOrderResults(double *x, double *objLambda, double *conLambda );
4870
4871
4881 bool initForAlgDiff();
4882
4892 bool initObjGradients();
4893
4894
4900
4901
4905 bool setTimeDomain(std::string format);
4906
4910 bool setTimeDomainStages(int number, std::string *names);
4911
4918 bool setTimeDomainStageVariablesOrdered(int numberOfStages, int *numberOfVariables, int *startIdx);
4919
4926 bool setTimeDomainStageVariablesUnordered(int numberOfStages, int *numberOfVariables, int **varIndex);
4927
4933 bool setTimeDomainStageConstraintsOrdered(int numberOfStages, int *numberOfConstraints, int *startIdx);
4934
4940 bool setTimeDomainStageConstraintsUnordered(int numberOfStages, int *numberOfConstraints, int **conIndex);
4941
4947 bool setTimeDomainStageObjectivesOrdered(int numberOfStages, int *numberOfObjectives, int *startIdx);
4948
4954 bool setTimeDomainStageObjectivesUnordered(int numberOfStages, int *numberOfObjectives, int **varIndex);
4955
4959 bool setTimeDomainInterval(double start, double horizon);
4960
4961
4962}; //class OSInstance
4963
4964#endif
4965
This file defines the OSnLNode class along with its derived classes.
The CompletelyPositiveMatricesCone Class.
bool setRandom(double density, bool conformant, int iMin, int iMax)
A function to make a random instance of this class.
virtual std::string getConeInXML()
Write a CompletelyPositiveMatricesCone object in XML format.
~CompletelyPositiveMatricesCone()
default destructor.
CompletelyPositiveMatricesCone()
default constructor.
bool deepCopyFrom(CompletelyPositiveMatricesCone *that)
A function to make a deep copy of an instance of this class.
bool IsEqual(CompletelyPositiveMatricesCone *that)
A function to check for the equality of two objects.
virtual std::string getConeName()
The in-memory representation of a generic cone Specific cone types are derived from this generic clas...
Definition OSInstance.h:531
int numberOfOtherIndexes
Cones can also be formed by Multidimensional tensors.
Definition OSInstance.h:552
std::string name
The cone can have a name for easier identification.
Definition OSInstance.h:559
virtual ~Cone()
The Cone class destructor.
virtual std::string getConeName()
int idx
cones are referenced by an (automatically created) index
Definition OSInstance.h:562
bool IsEqual(Cone *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.
ENUM_CONE_TYPE coneType
The type of the cone.
Definition OSInstance.h:556
virtual std::string getConeInXML()=0
Write a Cone object in XML format.
bool deepCopyFrom(Cone *that)
A function to make a deep copy of an instance of this class.
int * otherIndexes
Definition OSInstance.h:553
int numberOfRows
Every cone has (at least) two dimensions; no distinction is made between vector cones and matrix cone...
Definition OSInstance.h:543
Cone()
The Cone class constructor.
int numberOfColumns
Definition OSInstance.h:544
The in-memory representation of the <cones> element.
~Cones()
The Cones class destructor.
Cone ** cone
cone is pointer to an array of Cone object pointers
bool setRandom(double density, bool conformant, int iMin, int iMax)
A function to make a random instance of this class.
bool IsEqual(Cones *that)
A function to check for the equality of two objects.
Cones()
The Cones class constructor.
bool deepCopyFrom(Cones *that)
A function to make a deep copy of an instance of this class.
int numberOfCones
numberOfCones is the number of <nl> elements in the <cones> element.
The in-memory representation of the <con> element.
Definition OSInstance.h:219
double constant
constant is a value that is added to the constraint
Definition OSInstance.h:232
double ub
ub is the upper bound on the constraint
Definition OSInstance.h:238
bool IsEqual(Constraint *that)
A function to check for the equality of two objects.
double lb
lb is the lower bound on the constraint
Definition OSInstance.h:235
Constraint()
The Constraint class constructor.
~Constraint()
The Constraint class destructor.
std::string name
name is the name of the constraint
Definition OSInstance.h:229
The in-memory representation of the <constraints> element.
Definition OSInstance.h:252
int numberOfConstraints
numberOfConstraints is the number of constraints in the instance
Definition OSInstance.h:264
Constraint ** con
con is pointer to an array of Constraint object pointers
Definition OSInstance.h:268
~Constraints()
The Constraints class destructor.
Constraints()
The Constraints class constructor.
bool IsEqual(Constraints *that)
A function to check for the equality of two objects.
The CopositiveMatricesCone Class.
virtual std::string getConeInXML()
Write a CopositiveMatricesCone object in XML format.
bool setRandom(double density, bool conformant, int iMin, int iMax)
A function to make a random instance of this class.
CopositiveMatricesCone()
default constructor.
bool deepCopyFrom(CopositiveMatricesCone *that)
A function to make a deep copy of an instance of this class.
bool IsEqual(CopositiveMatricesCone *that)
A function to check for the equality of two objects.
~CopositiveMatricesCone()
default destructor.
virtual std::string getConeName()
a double vector data structure
Definition OSGeneral.h:610
The in-memory representation of a dual cone.
int coneType
The type of the cone (one of the values in ENUM_CONE_TYPE)
int numberOfOtherIndexes
Multidimensional tensors can also form cones (the Kronecker product, for instance,...
int numberOfColumns
int referenceConeIdx
Dual cones use a reference to another, previously defined cone.
virtual std::string getConeName()
~DualCone()
The DualCone class destructor.
int numberOfRows
Every cone has (at least) two dimensions; no distinction is made between vector cones and matrix cone...
int idx
cones are referenced by an (automatically created) index
bool IsEqual(DualCone *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.
int * otherIndexes
bool deepCopyFrom(DualCone *that)
A function to make a deep copy of an instance of this class.
DualCone()
The DualCone class constructor.
a sparse matrix data structure for matrices that can hold nonconstant values and have block structure...
Definition OSMatrix.h:1769
a data structure that holds general information about files that conform to one of the OSxL schemas
Definition OSGeneral.h:33
a sparse matrix data structure for matrices that can hold nonconstant values
Definition OSMatrix.h:1655
The in-memory representation of the <instanceData> element.
Variables * variables
variables is a pointer to a Variables object
QuadraticCoefficients * quadraticCoefficients
quadraticCoefficients is a pointer to a QuadraticCoefficients object
Constraints * constraints
constraints is a pointer to a Constraints object
Cones * cones
cones is a pointer to a Cones object
NonlinearExpressions * nonlinearExpressions
nonlinearExpressions is a pointer to a NonlinearExpressions object
MatrixProgramming * matrixProgramming
matrixProgramming is a pointer to a MatrixProgramming object
TimeDomain * timeDomain
timeDomain is a pointer to a TimeDomain object
bool IsEqual(InstanceData *that)
A function to check for the equality of two objects.
InstanceData()
The InstanceData class constructor.
Matrices * matrices
matrices is a pointer to a Matrices object
~InstanceData()
The InstanceData class destructor.
Objectives * objectives
objectives is a pointer to a Objectives object
LinearConstraintCoefficients * linearConstraintCoefficients
linearConstraintCoefficients is a pointer to a LinearConstraintCoefficients object
an integer Vector data structure
Definition OSGeneral.h:470
The in-memory representation of an intersection cone.
~IntersectionCone()
The IntersectionCone class destructor.
bool deepCopyFrom(IntersectionCone *that)
A function to make a deep copy of an instance of this class.
virtual std::string getConeInXML()
Write an IntersectionCone object in XML format.
int coneType
The type of the cone (one of the values in ENUM_CONE_TYPE)
IntersectionCone()
The IntersectionCone class constructor.
bool IsEqual(IntersectionCone *that)
A function to check for the equality of two objects.
int numberOfOtherIndexes
Multidimensional tensors can also form cones (the Kronecker product, for instance,...
int idx
cones are referenced by an (automatically created) index
bool setRandom(double density, bool conformant, int iMin, int iMax)
A function to make a random instance of this class.
virtual std::string getConeName()
IntVector * components
the list of components contributing to the intersection each component contains a reference to a prev...
int numberOfRows
Every cone has (at least) two dimensions; no distinction is made between vector cones and matrix cone...
The in-memory representation of the <linearConstraintCoefficients> element.
Definition OSInstance.h:289
DoubleVector * value
a pointer to the array of nonzero values being stored
Definition OSInstance.h:315
int iNumberOfStartElements
iNumberOfStartElements counts the number of elements in the <start> section of <linearConstraintCoeff...
Definition OSInstance.h:322
int numberOfValues
numberOfValues is the number of nonzero elements stored in the <linearConstraintCoefficients> element
Definition OSInstance.h:301
IntVector * start
a pointer to the start of each row or column stored in sparse format
Definition OSInstance.h:306
~LinearConstraintCoefficients()
The LinearConstraintCoefficients class destructor.
bool IsEqual(LinearConstraintCoefficients *that)
A function to check for the equality of two objects.
IntVector * rowIdx
a pointer of row indices if the problem is stored by column
Definition OSInstance.h:309
LinearConstraintCoefficients()
The LinearConstraintCoefficients class constructor.
IntVector * colIdx
a pointer of column indices if the problem is stored by row
Definition OSInstance.h:312
The in-memory representation of the <matrices> element.
Definition OSInstance.h:483
bool setRandom(double density, bool conformant, int iMin, int iMax)
A function to make a random instance of this class.
bool IsEqual(Matrices *that)
A function to check for the equality of two objects.
~Matrices()
The Matrices class destructor.
int numberOfMatrices
numberOfMatrices is the number of <nl> elements in the <matrices> element.
Definition OSInstance.h:496
OSMatrix ** matrix
matrix is a pointer to an array of OSMatrix object pointers
Definition OSInstance.h:499
Matrices()
The Matrices class constructor.
bool deepCopyFrom(Matrices *that)
A function to make a deep copy of an instance of this class.
The in-memory representation of the <matrixCon> element.
MatrixCon()
The MatrixCon class constructor.
int numberOfColumns
numberOfColumns gives the number of columns of this matrix
~MatrixCon()
The MatrixCon class destructor.
std::string name
an optional name to this MatrixCon
int lbConeIdx
lbConeIdx gives a cone that must contain matrixCon - lbMatrix
int ubConeIdx
ubConeIdx gives a cone that must contain ubMatrix - matrixCon
int lbMatrixIdx
lbMatrixIdx gives a lower bound for this matrixCon
int numberOfRows
numberOfRows gives the number of rows of this matrix
int templateMatrixIdx
templateMatrixIdx refers to a matrix that describes the locations in this matrixVar that are allowed ...
bool IsEqual(MatrixCon *that)
A function to check for the equality of two objects.
int conReferenceMatrixIdx
conReferenceMatrixIdx allows some or all of the components of this matrixCon to be copied from constr...
int ubMatrixIdx
ubMatrixIdx gives an upper bound for this matrixCon
The in-memory representation of the <matrixConstraints> element.
~MatrixConstraints()
The MatrixConstraints class destructor.
int numberOfMatrixCon
numberOfMatrixCon gives the number of <matrixCon> children
bool IsEqual(MatrixConstraints *that)
A function to check for the equality of two objects.
MatrixConstraints()
The MatrixConstraints class constructor.
MatrixCon ** matrixCon
matrixCon is an array of pointers to the <matrixCon> children
The in-memory representation of the <expr> element, which is like a nonlinear expression,...
int idx
idx holds the row index of the nonlinear expression
bool IsEqual(MatrixExpression *that)
A function to check for the equality of two objects.
MatrixExpressionTree * matrixExpressionTree
matrixExpressionTree contains the root of the MatrixExpressionTree
~MatrixExpression()
The MatrixExpression class destructor.
bool m_bDeleteExpressionTree
if m_bDeleteExpressionTree is true during garbage collection, we should delete the osExpression tree ...
MatrixExpression()
The MatrixExpression class constructor.
ENUM_NL_EXPR_SHAPE shape
shape holds the shape of the nonlinear expression (linear/quadratic/convex/general) (see further up i...
Used to hold the instance in memory.
The in-memory representation of the <matrixExpressions> element.
int numberOfExpr
numberOfExpr gives the number of expressions
bool IsEqual(MatrixExpressions *that)
A function to check for the equality of two objects.
MatrixExpressions()
The MatrixExpressions class constructor.
MatrixExpression ** expr
a pointer to an array of linear and nonlinear expressions that evaluate to matrices
~MatrixExpressions()
The MatrixExpressions class destructor.
a generic class from which we derive matrix constructors (BaseMatrix, MatrixElements,...
Definition OSMatrix.h:51
The in-memory representation of the <matrixObj> element.
int numberOfColumns
numberOfColumns gives the number of columns of this matrix
int numberOfRows
numberOfRows gives the number of rows of this matrix
bool IsEqual(MatrixObj *that)
A function to check for the equality of two objects.
int orderConeIdx
orderConeIdx gives a cone that expresses preferences during the optimization x is (weakly) preferred ...
MatrixObj()
The MatrixVar class constructor.
int constantMatrixIdx
constantMatrixIdx gives a constant added to the matrixObj
~MatrixObj()
The MatrixVar class destructor.
int templateMatrixIdx
templateMatrixIdx refers to a matrix that describes the locations in this matrixObj that are allowed ...
std::string name
an optional name to this matrixObj
int objReferenceMatrixIdx
objReferenceMatrixIdx allows some or all of the components of this matrixObj to be copied from object...
The in-memory representation of the <matrixObjectives> element.
~MatrixObjectives()
The MatrixObjectives class destructor.
bool IsEqual(MatrixObjectives *that)
A function to check for the equality of two objects.
MatrixObjectives()
The MatrixObjectives class constructor.
int numberOfMatrixObj
numberOfMatrixObj gives the number of <matrixObj> children
MatrixObj ** matrixObj
matrixObj is an array of pointers to the <matrixObj> children
The in-memory representation of the <matrixProgramming> element.
MatrixObjectives * matrixObjectives
a pointer to the matrixObjectives object
bool setRandom(double density, bool conformant, int iMin, int iMax)
A function to make a random instance of this class.
~MatrixProgramming()
The MatrixProgramming class destructor.
bool deepCopyFrom(MatrixProgramming *that)
A function to make a deep copy of an instance of this class.
MatrixProgramming()
The MatrixProgramming class constructor.
MatrixConstraints * matrixConstraints
a pointer to the matrixConstraints object
bool IsEqual(MatrixProgramming *that)
A function to check for the equality of two objects.
MatrixExpressions * matrixExpressions
a pointer to the matrixExpressions object
MatrixVariables * matrixVariables
a pointer to the matrixVariables object
The in-memory representation of the <matrixVar> element.
int ubConeIdx
ubConeIdx gives a cone that must contain ubMatrix - matrixVar
bool IsEqual(MatrixVar *that)
A function to check for the equality of two objects.
char varType
an optional variable type (C, B, I, D, J, S).
int lbMatrixIdx
lbMatrixIdx gives a lower bound for this matrixVar
~MatrixVar()
The MatrixVar class destructor.
std::string name
an optional name to this matrixVar
int lbConeIdx
lbConeIdx gives a cone that must contain matrixVar - lbMatrix
int numberOfRows
numberOfRows gives the number of rows of this matrix
int varReferenceMatrixIdx
varReferenceMatrixIdx allows some or all of the components of this matrix variable to be copied from ...
int numberOfColumns
numberOfColumns gives the number of columns of this matrix
MatrixVar()
The MatrixVar class constructor.
int ubMatrixIdx
ubMatrixIdx gives an upper bound for this matrixVar
int templateMatrixIdx
templateMatrixIdx refers to a matrix that describes the locations in this matrixVar that are allowed ...
The in-memory representation of the <matrixVariables> element.
MatrixVariables()
The MatrixVariables class constructor.
MatrixVar ** matrixVar
matrixVar is an array of pointers to the <matrixVar> children
bool IsEqual(MatrixVariables *that)
A function to check for the equality of two objects.
~MatrixVariables()
The MatrixVariables class destructor.
int numberOfMatrixVar
numberOfMatrixVar gives the number of <matrixVar> children
The in-memory representation of the <nl> element.
Definition OSInstance.h:411
int idx
idx holds the row index of the nonlinear expression
Definition OSInstance.h:414
ScalarExpressionTree * osExpressionTree
osExpressionTree contains the root of the ScalarExpressionTree
Definition OSInstance.h:430
ENUM_NL_EXPR_SHAPE shape
shape holds the shape of the nonlinear expression (linear/quadratic/convex/general) (see further up i...
Definition OSInstance.h:420
bool IsEqual(Nl *that)
A function to check for the equality of two objects.
~Nl()
default destructor.
Nl()
default constructor.
bool m_bDeleteExpressionTree
m_bDeleteExpressionTree is true, if in garbage collection, we should delete the osExpression tree obj...
Definition OSInstance.h:427
The in-memory representation of the <nonlinearExpressions> element.
Definition OSInstance.h:453
~NonlinearExpressions()
The NonlinearExpressions class destructor.
int numberOfNonlinearExpressions
numberOfNonlinearExpressions is the number of <nl> elements in the <nonlinearExpressions> element.
Definition OSInstance.h:466
Nl ** nl
nl is pointer to an array of Nl object pointers
Definition OSInstance.h:469
NonlinearExpressions()
The NonlinearExpressions class constructor.
bool IsEqual(NonlinearExpressions *that)
A function to check for the equality of two objects.
The NonnegativeCone Class.
Definition OSInstance.h:610
virtual std::string getConeInXML()
Write a NonnegativeCone object in XML format.
virtual std::string getConeName()
bool setRandom(double density, bool conformant, int iMin, int iMax)
A function to make a random instance of this class.
bool deepCopyFrom(NonnegativeCone *that)
A function to make a deep copy of an instance of this class.
bool IsEqual(NonnegativeCone *that)
A function to check for the equality of two objects.
NonnegativeCone()
default constructor.
~NonnegativeCone()
default destructor.
The NonpositiveCone Class.
Definition OSInstance.h:668
virtual std::string getConeInXML()
Write a NonpositiveCone object in XML format.
bool IsEqual(NonpositiveCone *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.
bool deepCopyFrom(NonpositiveCone *that)
A function to make a deep copy of an instance of this class.
virtual std::string getConeName()
~NonpositiveCone()
default destructor.
NonpositiveCone()
default constructor.
The in-memory representation of an OSiL instance..
bool m_bProcessLinearConstraintCoefficients
----— data items for linear constraint coefficients ----—
bool m_bAllNonlinearVariablesIndex
m_bAllNonlinearVariablesIndexMap is true if the map of the variables in the Lagrangian function has b...
SparseJacobianMatrix * calculateAllConstraintFunctionGradients(double *x, double *objLambda, double *conLambda, bool new_x, int highestOrder)
Calculate the gradient of all constraint functions.
std::vector< ExprNode * > getMatrixExpressionTreeInPostfix(int rowIdx)
Get the postfix tokens for a given row index.
int * m_miQuadRowIndexes
m_miQuadRowIndexes is an integer pointer to the distinct row indexes with a quadratic term.
bool getIterateResults(double *x, double *objLambda, double *conLambda, bool new_x, int highestOrder)
end revised AD code
bool m_bSparseJacobianCalculated
m_bSparseJacobianCalculated is true if getJacobianSparsityPattern() has been called.
std::string m_sInstanceCreator
m_sInstanceSource holds the instance source.
int getNumberOfColumnsForMatrix(int n)
Get the number of blocks in the matrix.
int * m_miMatrixNumberOfColumns
m_miMatrixNumberOfColumns holds the number of columns for each matrix.
bool m_bQTermsAdded
m_bQTermsAdded is true if we added the quadratic terms to the expression tree
double * getObjectiveWeights()
Get objective weights.
ScalarExpressionTree * getLagrangianExpTree()
bool m_bProcessExpressionTrees
m_bProcessExpressionTrees is true if the expression trees have been processed.
std::vector< double > m_vdYjacval
m_vdYval is a vector equal to a column or row of the Jacobian
bool setTimeDomain(std::string format)
This sets the format of the time domain ("stages"/"interval"/"none")
int m_iNumberOfBinaryVariables
m_iNumberOfBinaryVariables holds the number of binary variables.
bool m_bProcessExpressionTreesMod
m_bProcessExpressionTreesMod is true if the modified expression trees have been processed.
std::string getTimeDomainFormat()
Get the format of the time domain ("stages"/"interval")
int ** getTimeDomainStageVarList()
Get the list of variables in each stage.
SparseVector ** m_mObjectiveCoefficients
m_mObjectiveCoefficients holds an array of objective coefficients, one set of objective coefficients ...
std::vector< double > m_vdYval
m_vdYval is a vector of function values
bool m_bProcessObjectives
----— data items for Objectives ----—
bool m_bProcessMatrices
----— data items for matrices ----—
bool m_bProcessNonlinearExpressions
m_bProcessNonlinearExpressions holds whether the nonlinear expressions are processed.
bool processMatrices()
process matrices.
double * getConstraintLowerBounds()
Get constraint lower bounds.
int getNumberOfQuadraticTerms()
Get the number of specified (usually nonzero) qTerms in the quadratic coefficients.
int m_iNumberOfSemiContinuousVariables
m_iNumberOfSemiContinuousVariables holds the number of semi-continuous variables.
bool setInstanceLicence(std::string licence)
set the instance licence.
bool m_bFiniteTimeStages
m_bFiniteTimeStages holds whether the time domain has the form of finite (discrete) stages.
ENUM_MATRIX_SYMMETRY * m_miMatrixSymmetry
m_miMatrixSymmetry holds the symmetry property of each matrix.
bool m_bProcessTimeInterval
m_bProcessTimeInterval holds whether a time interval has been processed.
MatrixExpression ** getMatrixExpressions()
Get the pointers to the roots of all matrix expression trees.
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
std::string m_sInstanceLicence
m_sInstanceDescription holds the instance fileCreator info.
double * getVariableUpperBounds()
Get variable upper bounds.
bool setConstraintNumber(int number)
set the number of constraints.
int ** m_mmiTimeDomainStageObjList
m_mmiTimeDomainStageObjList holds the list of objectives in each stage.
double * m_mdObjectiveConstants
m_mdObjectiveConstants holds an array of objective constants (default = 0.0).
bool setTimeDomainStages(int number, std::string *names)
This sets the number (and optionally names) of the time stages.
std::vector< double > m_vdDomainUnitVec
m_vdDomainUnitVec is a unit vector in the domain space
bool matrixHasBase(int n)
Several tools to parse the constructor list of a matrix.
std::string m_sTimeDomainFormat
m_sTimeDomainFormat holds the format ("stages"/"interval") of the time domain.
bool bVariablesModified
bVariablesModified is true if the variables data has been modified.
int m_iVariableNumber
m_iVariableNumber holds the variable number.
int m_iHighestTaylorCoeffOrder
m_iHighestTaylorCoeffOrder is the order of highest calculated Taylor coefficient
std::vector< bool > m_vbLagHessNonz
m_vbLagHessNonz is a boolean vector holding the nonzero pattern of the Lagrangian of the Hessian
std::map< int, std::vector< OSnLNode * > > m_mapExpressionTreesInPostfix
m_mapExpressionTreesInPostfix holds a hash map of expression trees in postfix format,...
bool setInstanceCreator(std::string fileCreator)
set the instance creator.
int * m_miNonlinearExpressionTreeIndexes
m_miNonlinearExpressionTreeIndexes is an integer pointer to the distinct rows indexes in the nonlinea...
SparseJacobianMatrix * getJacobianSparsityPattern()
std::vector< double > forwardAD(int p, std::vector< double > vdX)
Perform an AD forward sweep.
bool matrixHasTransformations(int n)
double * m_mdObjectiveWeights
m_mdObjectiveWeights holds an array of objective weights (default = 1.0).
int getNumberOfBlocksConstructors(int n)
double * m_mdConstraintFunctionValues
m_mdConstraintFunctionValues holds a double array of constraint function values – the size of the arr...
bool bObjectivesModified
bObjectivesModified is true if the objective function data has been modified.
int m_iConstraintNumberNonlinear
m_iConstraintNumberNonlinear is the number of constraints that have a nonlinear term.
int * m_miJacStart
m_miJacStart holds a int array of starts for the Jacobian matrix in sparse form (row major).
GeneralSparseMatrix * getMatrixBlockInColumnMajorForm(int n, int columnIdx, int rowIdx)
Get the (nonzero) elements of the matrix in symmetric block form.
int getADSparsityHessian()
end revised AD code
unsigned int m_iNumberOfNonlinearVariables
m_iNumberOfNonlinearVariables is the number of variables that appear in a nonlinear expression.
std::vector< double > m_vdRangeUnitVec
m_vdRangeUnitVec is a unit vector in the range space
bool addQTermsToExressionTree()
bool m_bNonlinearExpressionTreeIndexesProcessed
m_bNonlinearExpressionTreeIndexesProcessed is true if getNonlinearExpressionTreeIndexes() has been ca...
bool addVariable(int index, std::string name, double lowerBound, double upperBound, char type)
add a variable.
bool bAMatrixModified
bAMatrixModified is true if the A matrix data has been modified.
bool setTimeDomainStageConstraintsUnordered(int numberOfStages, int *numberOfConstraints, int **conIndex)
This sets the constraints associated with each time domain stage in srbitrary order.
int m_iMatrixVarNumber
----— data items for matrix programming ----—
std::string printModel()
Print the infix representation of the problem.
int getNumberOfNonlinearExpressionTreeIndexes()
Get the number of unique nonlinear expression tree indexes.
int m_iQuadraticTermNumber
m_iQuadraticTermNumber holds the number of specified (usually nonzero) qTerms in the quadratic coeffi...
int ** m_mmiTimeDomainStageConList
m_mmiTimeDomainStageConList holds the list of constraints in each stage.
std::vector< double > m_vdw
m_vdYval is a vector of derivatives – output from a reverse sweep
int getNumberOfNonlinearExpressionTreeModIndexes()
Get the number of unique nonlinear expression tree indexes after modifying the expression tree to con...
bool getZeroOrderResults(double *x, double *objLambda, double *conLambda)
Calculate function values.
int m_iMatrixNumber
m_iMatrixNumber holds the number of matrices
bool m_bProcessQuadraticTerms
m_bProcessQuadraticTerms holds whether the quadratic terms are processed.
std::string * m_msVariableNames
m_msVariableNames holds an array of variable names.
int getTimeDomainStageNumber()
Get the number of stages that make up the time domain.
int getNumberOfIntegerVariables()
getNumberOfIntegerVariables
bool getSparseJacobianFromColumnMajor()
bool processConstraints()
process constraints.
OSMatrix ** m_mMatrix
m_mMatrix holds the list of constructors for each matrix.
bool bUseExpTreeForFunEval
bUseExpTreeForFunEval is set to true if you wish to use the OS Expression Tree for function evaluatio...
bool setNumberOfQuadraticTerms(int nq)
set the number of quadratic terms
int * m_miTimeDomainStageVariableNumber
m_miTimeDomainStageVariableNumber holds the number of variables in each stage.
bool m_bNonlinearExpressionTreeModIndexesProcessed
m_bNonlinearExpressionTreeModIndexesProcessed is true if getNonlinearExpressionTreeModIndexes has bee...
int * getTimeDomainStageNumberOfObjectives()
Get the number of objectives contained in each time stage.
bool setConeNumber(int number)
set the number of cones
bool m_bQuadraticRowIndexesProcessed
m_bQuadraticRowIndexesProcessed is true if getQuadraticRowIndexes() has been called.
bool getFirstOrderResults(double *x, double *objLambda, double *conLambda)
Calculate first derivatives.
bool addConstraint(int index, std::string name, double lowerBound, double upperBound, double constant)
add a constraint.
double getTimeDomainIntervalHorizon()
Get the horizon for the time domain interval.
int getNumberOfBinaryVariables()
getNumberOfBinaryVariables
int * m_miNonlinearExpressionTreeModIndexes
m_miNonlinearExpressionTreeModIndexes is an integer pointer to the distinct rows indexes in the modif...
int getNumberOfNonlinearObjectives()
bool setQuadraticTermsInNonlinearExpressions(int number, int *rowIndexes, int *varOneIndexes, int *varTwoIndexes, double *coefficients)
set quadratic terms in nonlinearExpressions
bool setNonlinearExpressions(int nexpr, Nl **root)
set nonlinear expressions
bool matrixHasElements(int n)
int * m_miTimeDomainStageObjectiveNumber
m_miTimeDomainStageObjectiveNumber holds the number of objectives in each stage.
bool getLinearConstraintCoefficientMajor()
Get whether the constraint coefficients is in column major (true) or row major (false).
int m_iObjectiveNumberNonlinear
m_iObjectiveNumber is the number of objective functions with a nonlinear term.
int m_iNumberOfTimeStages
m_iNumberOfTimeStages holds the number of discrete stages
std::string getInstanceDescription()
Get instance description.
std::string getInstanceSource()
Get instance source.
std::vector< ExprNode * > getNonlinearExpressionTreeInPrefix(int rowIdx)
Get the prefix tokens for a given row index.
int * m_miNumberOfObjCoef
m_miNumberOfObjCoef holds an integer array of number of objective coefficients (default = 0).
bool addCone(int index, int numberOfRows, int numberOfColumns, ENUM_CONE_TYPE coneType, std::string name, int numberOfOtherIndexes=0, int *otherIndexes=NULL)
add a cone.
ENUM_MATRIX_TYPE getMatrixType(int n)
Get the matrix type.
std::map< int, ScalarExpressionTree * > getAllNonlinearExpressionTrees()
std::vector< ExprNode * > getNonlinearExpressionTreeModInPostfix(int rowIdx)
Get the postfix tokens for a given row index for the modified Expression Tree (quadratic terms added)...
bool m_bNonLinearStructuresInitialized
m_bNonLinearStructuresInitialized is true if initializeNonLinearStructures() has been called.
ScalarExpressionTree * getNonlinearExpressionTreeMod(int rowIdx)
Get the expression tree for a given row index for the modified expression trees (quadratic terms adde...
bool m_bLagrangianExpTreeCreated
m_bLagrangianHessionCreated is true if a Lagrangian function for the Hessian has been created
bool initObjGradients()
This should be called by initForAlgDiff()
double * m_mdObjectiveFunctionValues
m_mdObjectiveFunctionValues holds a double array of objective function values – the size of the array...
double * m_mdConstraintUpperBounds
m_mdConstraintUpperBounds holds an array of constraint upper bounds (default = INF).
std::string * m_msObjectiveNames
m_msObjectiveNames holds an array of objective names.
int * m_miJacNumConTerms
m_miJacNumConTerms holds a int array of the number of constant terms (gradient does not change) for t...
int getNumberOfMatrixVariables()
Get the number of matrix variables.
int m_iNonlinearExpressionNumber
m_iNonlinearExpressionNumber holds the number of nonlinear expressions.
int getConstraintNumber()
Get number of constraints.
int m_iLinearConstraintCoefficientNumber
m_iLinearConstraintCoefficientNumber holds the number of specified (usually nonzero) linear constrain...
GeneralSparseMatrix * getMatrixCoefficientsInColumnMajor(int n)
Get the (nonzero) elements of the matrix in column major form.
bool setQuadraticCoefficients(int number, int *rowIndexes, int *varOneIndexes, int *varTwoIndexes, double *coefficients, int begin, int end)
set quadratic coefficients into the QuadraticCoefficients->qTerm data structure
int getNumberOfMatrixExpressionTreeIndexes()
Get the number of unique matrix expression tree indexes.
int * getObjectiveCoefficientNumbers()
Get objective coefficient number.
std::map< int, ScalarExpressionTree * > m_mapExpressionTrees
m_mapExpressionTrees holds a hash map of scalar-valued expression tree pointers.
int m_iMatrixExpressionNumber
m_iMatrixExpressionNumber holds the number of matrix expressions
double * getConstraintConstants()
Get constraint constants.
double * calculateAllConstraintFunctionValues(double *x, double *objLambda, double *conLambda, bool new_x, int highestOrder)
Calculate all of the constraint function values.
int * getTimeDomainStageNumberOfVariables()
Get the number of variables contained in each time stage.
std::string * m_msMaxOrMins
m_msMaxOrMins holds a std::string array of objective maxOrMins ("max" or "min").
int getNumberOfStringVariables()
getNumberOfStringVariables
char * m_mcConstraintTypes
m_mcConstraintTypes holds a char array of constraint types (R for range; L for <=; G for >=; E for =;...
double * m_mdVariableUpperBounds
m_mdVariableUpperBounds holds a double array of variable upper bounds (default = INF).
int m_iNumberOfQuadraticRowIndexes
----— data items for quadratic coefficients ----—
std::map< int, int > m_mapOSADFunRangeIndex
m_mapOSADFunRangeIndex is an inverse of the previous map.
bool bConstraintsModified
bConstraintsModified is true if the constraints data has been modified.
std::map< int, MatrixExpressionTree * > getAllMatrixExpressionTrees()
int getLinearConstraintCoefficientNumber()
Get number of specified (usually nonzero) linear constraint coefficient values.
int getNumberOfSemiIntegerVariables()
getNumberOfSemiIntegerVariables
double * m_mdVariableLowerBounds
m_mdVariableLowerBounds holds a double array of variable lower bounds (default = 0....
int ** getTimeDomainStageObjList()
Get the list of objectives in each stage.
double * m_mdConstraintLowerBounds
m_mdConstraintLowerBounds holds an array of constraint lower bounds (default = -INF).
int ** m_mmiTimeDomainStageVarList
m_mmiTimeDomainStageVarList holds the list of variables in each stage.
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.
SparseMatrix * getLinearConstraintCoefficientsInRowMajor()
Get linear constraint coefficients in row major.
std::string * m_msMatrixNames
m_msMatrixNames holds the names of the matrices
int getNumberOfMatrixConstraints()
Get the number of matrix constraints.
double calculateFunctionValue(int idx, double *x, bool new_x)
Calculate the function value for function (constraint or objective) indexed by idx.
double ** m_mmdDenseObjectiveCoefficients
m_mmdDenseObjectiveCoefficients holds an array of pointers, each pointer points to a vector of dense ...
int * getTimeDomainStageNumberOfConstraints()
Get the number of constraints contained in each time stage.
double getTimeDomainIntervalStart()
Get the start for the time domain interval.
SparseMatrix * m_linearConstraintCoefficientsInColumnMajor
m_linearConstraintCoefficientsInColumnMajor holds the standard three-array data structure for linear ...
int * m_miNonLinearVarsReverseMap
m_miNonLinearVarsReverseMap maps the nonlinear variable number back into the original variable space
int * getNonlinearExpressionTreeIndexes()
Get all the nonlinear expression tree indexes, i.e., indexes of rows (objectives or constraints) that...
std::string * getTimeDomainStageNames()
Get the names of the stages (NULL or empty string ("") if a stage has not been given a name.
bool m_bProcessTimeDomain
----— data items for time domain ----—
char * getVariableTypes()
Get variable initial values.
int getNumberOfValuesForMatrix(int n)
Get the number of (nonzero) values in the matrix.
std::string m_sInstanceName
----— data items for InstanceHeader ----—
char * m_mcVariableTypes
m_mcVariableTypes holds a char array of variable types (default = 'C').
bool matrixHasBlocks(int n)
int getNumberOfQuadraticRowIndexes()
Get the number of rows which have a quadratic term.
double * calculateAllObjectiveFunctionValues(double *x, double *objLambda, double *conLambda, bool new_x, int highestOrder)
Calculate all of the objective function values.
ENUM_MATRIX_SYMMETRY getMatrixSymmetry(int n)
Get the matrix symmetry.
double * m_mdJacValue
m_mdJacValue holds a double array of partial derivatives for the Jacobian matrix in sparse form (row ...
SparseVector * calculateConstraintFunctionGradient(double *x, double *objLambda, double *conLambda, int idx, bool new_x, int highestOrder)
Calculate the gradient of the constraint function indexed by idx.
bool getSparseJacobianFromRowMajor()
SparseMatrix * getLinearConstraintCoefficientsInColumnMajor()
Get linear constraint coefficients in column major.
int * getQuadraticRowIndexes()
Get the indexes of rows which have a quadratic term.
int m_iMatrixObjNumber
m_iMatrixObjNumber holds the number of matrix objectives
bool processObjectives()
process objectives.
int m_iMatrixConNumber
m_iMatrixConNumber holds the number of matrix constraints
int getNumberOfSemiContinuousVariables()
getNumberOfSemiContinuousVariables
int * m_miTimeDomainStageConstraintNumber
m_miTimeDomainStageConstraintNumber holds the number of constraints in each stage.
double * calculateObjectiveFunctionGradient(double *x, double *objLambda, double *conLambda, int objIdx, bool new_x, int highestOrder)
Calculate the gradient of the objective function indexed by objIdx.
bool m_bProcessTimeStages
m_bProcessTimeStages holds whether the time stages have been processed.
int getMatrixNumber()
Get the number of matrices.
int * getNonlinearExpressionTreeModIndexes()
Get all the nonlinear expression tree indexes, i.e., indexes of rows (objectives or constraints) that...
bool m_bDuplicateExpressionTreesMap
m_bDuplicateExpressionTreeMap is true if m_mapExpressionTrees was duplicated.
bool setTimeDomainStageConstraintsOrdered(int numberOfStages, int *numberOfConstraints, int *startIdx)
This sets the constraints associated with each time domain stage in temporal order.
bool setVariables(int number, std::string *names, double *lowerBounds, double *upperBounds, char *types)
set all the variable related elements.
bool createOSADFun(std::vector< double > vdX)
Create the a CppAD Function object: this is a function where the domain is the set of variables for t...
std::string getInstanceCreator()
Get instance fileCreator.
int m_iNumberOfSemiIntegerVariables
m_iNumberOfSemiIntegerVariables holds the number of semi-integer variables.
bool setTimeDomainStageVariablesOrdered(int numberOfStages, int *numberOfVariables, int *startIdx)
This sets the variables associated with each time domain stage in temporal order.
bool setInstanceSource(std::string source)
set the instance source.
bool m_bColumnMajor
m_bColumnMajor holds whether the linear constraint coefficients are stored in column major (if m_bCol...
std::string getInstanceLicence()
Get instance licence.
QuadraticTerms * m_quadraticTerms
m_quadraticTerms holds the data structure for all the quadratic terms in the instance.
double ** getDenseObjectiveCoefficients()
getDenseObjectiveCoefficients.
bool setTimeDomainStageVariablesUnordered(int numberOfStages, int *numberOfVariables, int **varIndex)
This sets the variables associated with each time domain stage in srbitrary order.
bool initForAlgDiff()
This should be called by nonlinear solvers using callback functions.
int * getMatrixExpressionTreeIndexes()
Get all the matrix expression tree indexes, i.e.
GeneralFileHeader * instanceHeader
the instanceHeader is implemented as a general file header object to allow sharing of classes between...
OSMatrix * getMatrix(int n)
Get the list of constructors of the matrix.
std::map< int, ScalarExpressionTree * > m_mapExpressionTreesMod
m_mapExpressionTreesMod holds a map of expression trees, with the key being the row index and value b...
std::string * m_msConstraintNames
m_msConstraintNames holds an array of constraint names.
int m_iObjectiveNumber
m_iObjectiveNumber is the number of objective functions.
bool m_bCppADMustReTape
is true if a CppAD Expresion Tree has an expression that can change depending on the value of the inp...
Nl ** getNonlinearExpressions()
Get the pointers to the roots of all expression trees.
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 getNumberOfElementConstructors(int n)
InstanceData * instanceData
A pointer to an InstanceData object.
int m_iHighestOrderEvaluated
m_iHighestOrderEvaluated is the highest order derivative of the current iterate
OSInstance()
The OSInstance class constructor.
std::map< int, int > m_mapAllNonlinearVariablesIndex
m_mapAllNonlinearVariablesIndexMap is a map of the variables in the Lagrangian function
std::string getMatrixExpressionTreeInInfix(int rowIdx)
Get the infix representation for a given row (or objective function) index.
int getNumberOfNonlinearExpressions()
Get number of nonlinear expressions.
SparseHessianMatrix * getLagrangianHessianSparsityPattern()
SparseVector ** getObjectiveCoefficients()
Get objective coefficients.
int m_iNumberOfIntegerVariables
m_iNumberOfIntegerVariables holds the number of integer variables.
std::map< int, int > getAllNonlinearVariablesIndexMap()
SparseHessianMatrix * calculateHessian(double *x, int idx, bool new_x)
Calculate the Hessian of a constraint or objective function.
QuadraticTerms * getQuadraticTerms()
Get all the quadratic terms in the instance.
int ** getTimeDomainStageConList()
Get the list of constraints in each stage.
std::vector< double > reverseAD(int p, std::vector< double > vdlambda)
Perform an AD reverse sweep.
SparseMatrix * m_linearConstraintCoefficientsInRowMajor
m_linearConstraintCoefficientsInRowMajor holds the standard three-array data structure for linear con...
std::vector< ExprNode * > getNonlinearExpressionTreeInPostfix(int rowIdx)
Get the postfix tokens for a given row index.
double * getObjectiveConstants()
Get objective constants.
std::string * getObjectiveNames()
Get objective names.
bool processLinearConstraintCoefficients()
process linear constraint coefficients.
int getNumberOfMatrixObjectives()
Get the number of matrix objectives.
double * getVariableLowerBounds()
Get variable lower bounds.
int m_iConstraintNumber
m_iConstraintNumber is the number of constraints.
bool m_bLagrangianSparseHessianCreated
m_bLagrangianSparseHessianCreated is true if the sparse Hessian Matrix for the Lagrangian was created
int getVariableNumber()
Get number of variables.
bool m_bGetDenseObjectives
m_bGetDenseObjectives holds whether the dense objective functions are processed.
std::map< int, MatrixExpressionTree * > getAllMatrixExpressionTreesMod()
bool m_bOSADFunIsCreated
m_bOSADFunIsCreated is true if we have created the OSInstanc OSAD Function
std::string * m_msTimeDomainStageNames
m_msTimeDomainStageNames holds the names of the time stages.
bool m_bCppADTapesBuilt
is true if a CppAD Expresion Tree has been built for each row and objective with a nonlinear expressi...
bool m_binitForAlgDiff
----— data items for automatic differentiation ----—
std::map< int, MatrixExpressionTree * > m_mapMatrixExpressionTrees
m_mapMatrixExpressionTrees holds a hash map of matrix-valued expression tree pointers.
~OSInstance()
The OSInstance class destructor.
bool setTimeDomainStageObjectivesOrdered(int numberOfStages, int *numberOfObjectives, int *startIdx)
This sets the objectives associated with each time domain stage in temporal order.
int m_iNumberOfStringVariables
m_iNumberOfStringVariables holds the number of string-valued variables.
MatrixExpressionTree * getMatrixExpressionTree(int rowIdx)
Get the matrix expression tree for a given row index.
bool setInstanceDescription(std::string description)
set the instance description.
bool setTimeDomainInterval(double start, double horizon)
This sets the start and end of the time interval.
std::string * getVariableNames()
Get variable names.
ENUM_MATRIX_TYPE * m_miMatrixType
m_miMatrixType holds the type of each matrix.
std::vector< ExprNode * > getNonlinearExpressionTreeModInPrefix(int rowIdx)
Get the prefix tokens for a given row index for the modified Expression Tree (quadratic terms added).
bool m_bProcessVariables
----— data items for Variables ----—
bool setObjectives(int number, std::string *names, std::string *maxOrMins, double *constants, double *weights, SparseVector **objectitiveCoefficients)
set all the objectives related elements.
std::string getInstanceName()
Get instance name.
int getNumberOfRowsForMatrix(int n)
Get the number of rows in the matrix.
ScalarExpressionTree * getNonlinearExpressionTree(int rowIdx)
Get the expression tree for a given row index.
bool setTimeDomainStageObjectivesUnordered(int numberOfStages, int *numberOfObjectives, int **varIndex)
This sets the objectives associated with each time domain stage in arbitrary order.
int * m_miMatrixNumberOfRows
m_miMatrixNumberOfRows holds the number of rows for each matrix.
int getNumberOfTransformationConstructors(int n)
std::string m_sInstanceSource
m_sInstanceSource holds the instance source.
int getNumberOfMatrixExpressions()
Get the number of matrix-valued expressions.
char * getConstraintTypes()
Get constraint types.
GeneralSparseMatrix * getMatrixCoefficientsInRowMajor(int n)
Get the (nonzero) elements of the matrix in row major form.
bool processVariables()
process variables.
bool addQTermsToExpressionTree()
This method adds quadratic terms into the array of expression trees.
bool setInstanceName(std::string name)
set the instance name.
SparseHessianMatrix * m_LagrangianSparseHessian
m_LagrangianSparseHessian is the Hessian Matrix of the Lagrangian function in sparse format
int m_iNumberOfNonlinearExpressionTreeModIndexes
m_iNumberOfNonlinearExpressionTreeModIndexes holds the number of distinct rows and objectives with no...
bool addObjective(int index, std::string name, std::string maxOrMin, double constant, double weight, SparseVector *objectiveCoefficients)
add an objective.
bool m_bProcessConstraints
----— data items for Constraints ----—
SparseHessianMatrix * calculateLagrangianHessian(double *x, double *objLambda, double *conLambda, bool new_x, int highestOrder)
Calculate the Hessian of the Lagrangian Expression Tree This method will build the CppAD expression t...
bool setConstraints(int number, std::string *names, double *lowerBounds, double *upperBounds, double *constants)
set all the constraint related elements.
std::string * getConstraintNames()
Get constraint names.
std::vector< double > m_vdLambda
m_vdYval is a vector of Lagrange multipliers
bool setObjectiveNumber(int number)
set the number of objectives.
std::vector< double > m_vdX
----— data vectors for nonlinear optimization ----—
double ** m_mmdObjGradient
m_mdObjGradient holds an array of pointers, each pointer points to gradient of one objective function...
ScalarExpressionTree * m_LagrangianExpTree
m_LagrangianExpTree is an ScalarExpressionTree object that is the expression tree for the Lagrangian ...
int * m_miNonlinearExpressionIndexes
m_miNonlinearExpressionIndexes holds an integer array of nonlinear expression indexes,...
std::vector< ExprNode * > getMatrixExpressionTreeModInPostfix(int rowIdx)
Get the postfix tokens for a given row index for the modified Expression Tree (quadratic terms added)...
std::string getNonlinearExpressionTreeInInfix(int rowIdx)
Get the infix representation for a given row (or objective function) index.
bool setMatrixNumber(int number)
set the number of matrices
int * m_miJacIndex
m_miJacIndex holds a int array of variable indices for the Jacobian matrix in sparse form (row major)...
bool setVariableNumber(int number)
set the number of variables.
std::string * getObjectiveMaxOrMins()
Get objective maxOrMins.
std::string m_sInstanceDescription
m_sInstanceDescription holds the instance description.
bool initializeNonLinearStructures()
Initialize the data structures for the nonlinear API.
double ** calculateAllObjectiveFunctionGradients(double *x, double *objLambda, double *conLambda, bool new_x, int highestOrder)
Calculate the gradient of all objective functions.
double * getConstraintUpperBounds()
Get constraint upper bounds.
int getObjectiveNumber()
Get number of objectives.
SparseJacobianMatrix * m_sparseJacMatrix
m_sparseJacMatrix is the Jacobian matrix stored in sparse matrix format
std::map< int, ScalarExpressionTree * > getAllNonlinearExpressionTreesMod()
int m_iNumberOfNonlinearExpressionTreeIndexes
----— data items for nonlinear expressions ----—
bool getSecondOrderResults(double *x, double *objLambda, double *conLambda)
Calculate second derivatives.
int m_iJacValueSize
m_iJacValueSize is the number of nonzero partial derivates in the Jacobian.
std::vector< ExprNode * > getMatrixExpressionTreeInPrefix(int rowIdx)
Get the prefix tokens for a given row index.
bool IsEqual(OSInstance *that)
A function to check for the equality of two objects.
std::string getMatrixName(int n)
Get the name of the matrix.
int getNumberOfNonlinearConstraints()
double * m_mdConstraintConstants
m_mdConstraintConstants holds an array of constraint constants (default = 0.0).
void duplicateExpressionTreesMap()
duplicate the map of expression trees.
a data structure to represent a matrix object (derived from MatrixType)
Definition OSMatrix.h:2186
The OSnLMNode Class for nonlinear expressions involving matrices.
Definition OSnLNode.h:1761
The in-memory representation of the objective function <coef> element.
Definition OSInstance.h:111
bool IsEqual(ObjCoef *that)
A function to check for the equality of two objects.
double value
value is the value of the objective function coefficient corresponding to the variable with index idx
Definition OSInstance.h:128
ObjCoef()
The ObjCoef class constructor.
int idx
idx is the index of the variable corresponding to the coefficient
Definition OSInstance.h:123
~ObjCoef()
The ObjCoef class destructor.
The in-memory representation of the <obj> element.
Definition OSInstance.h:142
ObjCoef ** coef
coef is pointer to an array of ObjCoef object pointers
Definition OSInstance.h:176
double constant
constant is the constant term added to the objective function, 0 by default
Definition OSInstance.h:162
double weight
weight is the weight applied to the given objective function, 1.0 by default
Definition OSInstance.h:167
bool IsEqual(Objective *that)
A function to check for the equality of two objects.
int numberOfObjCoef
numberOfObjCoef is the number of variables with a nonzero objective function coefficient
Definition OSInstance.h:172
~Objective()
The Objective class destructor.
Objective()
The Objective class constructor.
std::string name
the name of the objective function
Definition OSInstance.h:152
std::string maxOrMin
declare the objective function to be a max or a min
Definition OSInstance.h:157
The in-memory representation of the <objectives> element.
Definition OSInstance.h:189
bool IsEqual(Objectives *that)
A function to check for the equality of two objects.
int numberOfObjectives
numberOfObjectives is the number of objective functions in the instance
Definition OSInstance.h:201
Objective ** obj
coef is pointer to an array of ObjCoef object pointers
Definition OSInstance.h:205
Objectives()
The Objectives class constructor.
~Objectives()
The Objectives class destructor.
The OrthantCone Class.
Definition OSInstance.h:727
bool setRandom(double density, bool conformant, int iMin, int iMax)
A function to make a random instance of this class.
OrthantCone()
default constructor.
virtual std::string getConeInXML()
Write an OrthantCone object in XML format.
~OrthantCone()
default destructor.
virtual std::string getConeName()
bool IsEqual(OrthantCone *that)
A function to check for the equality of two objects.
bool deepCopyFrom(OrthantCone *that)
A function to make a deep copy of an instance of this class.
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:733
double * lb
Definition OSInstance.h:734
The in-memory representation of a polar cone.
int numberOfOtherIndexes
Multidimensional tensors can also form cones (the Kronecker product, for instance,...
bool IsEqual(PolarCone *that)
A function to check for the equality of two objects.
int referenceConeIdx
Polar cones use a reference to another, previously defined cone.
PolarCone()
The PolarCone class constructor.
int numberOfColumns
int * otherIndexes
int idx
cones are referenced by an (automatically created) index
bool setRandom(double density, bool conformant, int iMin, int iMax)
A function to make a random instance of this class.
virtual std::string getConeName()
int numberOfRows
Every cone has (at least) two dimensions; no distinction is made between vector cones and matrix cone...
~PolarCone()
The PolarCone class destructor.
int coneType
The type of the cone (one of the values in ENUM_CONE_TYPE)
bool deepCopyFrom(PolarCone *that)
A function to make a deep copy of an instance of this class.
The in-memory representation of a polyhedral cone.
Definition OSInstance.h:787
bool deepCopyFrom(PolyhedralCone *that)
A function to make a deep copy of an instance of this class.
int idx
cones are referenced by an (automatically created) index
Definition OSInstance.h:814
~PolyhedralCone()
The PolyhedralCone class destructor.
int numberOfOtherIndexes
Multidimensional tensors can also form cones (the Kronecker product, for instance,...
Definition OSInstance.h:807
int numberOfRows
Every cone has (at least) two dimensions; no distinction is made between vector cones and matrix cone...
Definition OSInstance.h:799
int coneType
The type of the cone (one of the values in ENUM_CONE_TYPE)
Definition OSInstance.h:811
bool IsEqual(PolyhedralCone *that)
A function to check for the equality of two objects.
virtual std::string getConeInXML()
Write a PolyhedralCone object in XML format.
PolyhedralCone()
The PolyhedralCone class constructor.
int referenceMatrixIdx
Polyhedral cones use a reference to a previously defined matrix for the extreme rays.
Definition OSInstance.h:817
bool setRandom(double density, bool conformant, int iMin, int iMax)
A function to make a random instance of this class.
virtual std::string getConeName()
The in-memory representation of a product cone.
virtual std::string getConeInXML()
Write a ProductCone object in XML format.
~ProductCone()
The ProductCone class destructor.
IntVector * factors
the list of "factors" contributing to the product each factor contains a reference to a previously de...
int coneType
The type of the cone (one of the values in ENUM_CONE_TYPE)
ProductCone()
The ProductCone class constructor.
virtual std::string getConeName()
int * otherIndexes
int numberOfColumns
bool deepCopyFrom(ProductCone *that)
A function to make a deep copy of an instance of this class.
bool setRandom(double density, bool conformant, int iMin, int iMax)
A function to make a random instance of this class.
int numberOfOtherIndexes
Multidimensional tensors can also form cones (the Kronecker product, for instance,...
int numberOfRows
Every cone has (at least) two dimensions; no distinction is made between vector cones and matrix cone...
bool IsEqual(ProductCone *that)
A function to check for the equality of two objects.
int idx
cones are referenced by an (automatically created) index
The in-memory representation of the <quadraticCoefficients> element.
Definition OSInstance.h:381
QuadraticTerm ** qTerm
qTerm is a pointer to an array of QuadraticTerm object pointers
Definition OSInstance.h:397
bool IsEqual(QuadraticCoefficients *that)
A function to check for the equality of two objects.
QuadraticCoefficients()
The QuadraticCoefficients class constructor.
int numberOfQuadraticTerms
numberOfQuadraticTerms is the number of quadratic terms in the <quadraticCoefficients> element.
Definition OSInstance.h:393
~QuadraticCoefficients()
The QuadraticCoefficients class destructor.
The in-memory representation of a quadratic cone.
Definition OSInstance.h:861
virtual std::string getConeName()
bool deepCopyFrom(QuadraticCone *that)
A function to make a deep copy of an instance of this class.
int numberOfOtherIndexes
Multidimensional tensors can also form cones (the Kronecker product, for instance,...
Definition OSInstance.h:881
int * otherIndexes
Definition OSInstance.h:882
bool setRandom(double density, bool conformant, int iMin, int iMax)
A function to make a random instance of this class.
virtual std::string getConeInXML()
Write a QuadraticCone object in XML format.
~QuadraticCone()
The QuadraticCone class destructor.
int axisDirection
The index of the first component can be changed Since there are possibly many dimensions,...
Definition OSInstance.h:908
int coneType
The type of the cone (one of the values in ENUM_CONE_TYPE)
Definition OSInstance.h:885
bool IsEqual(QuadraticCone *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:873
int distortionMatrixIdx
Definition OSInstance.h:897
int idx
cones are referenced by an (automatically created) index
Definition OSInstance.h:888
QuadraticCone()
The QuadraticCone class constructor.
double normScaleFactor
quadratic cones normally are of the form x0 >= x1^2 + x2^2 + ... However, the appearance can be modif...
Definition OSInstance.h:896
The in-memory representation of the <qTerm> element.
Definition OSInstance.h:341
double coef
coef is the coefficient of the quadratic term
Definition OSInstance.h:366
int idxOne
idxOne is the index of the first variable in the quadratic term
Definition OSInstance.h:358
~QuadraticTerm()
The QuadraticTerm class destructor.
QuadraticTerm()
The QuadraticTerm class constructor.
bool IsEqual(QuadraticTerm *that)
A function to check for the equality of two objects.
int idx
idx is the index of the row in which the quadratic term appears
Definition OSInstance.h:353
int idxTwo
idxTwo is the index of the second variable in the quadratic term
Definition OSInstance.h:363
a data structure for holding quadratic terms
Definition OSGeneral.h:432
The in-memory representation of a rotated quadratic cone.
Definition OSInstance.h:952
int numberOfOtherIndexes
Multidimensional tensors can also form cones (the Kronecker product, for instance,...
Definition OSInstance.h:972
bool IsEqual(RotatedQuadraticCone *that)
A function to check for the equality of two objects.
virtual std::string getConeName()
~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.
double normScaleFactor
rotated quadratic cones normally are of the form x0x1 >= x2^2 + x3^2 + ... However,...
Definition OSInstance.h:987
int coneType
The type of the cone (one of the values in ENUM_CONE_TYPE)
Definition OSInstance.h:976
int idx
cones are referenced by an (automatically created) index
Definition OSInstance.h:979
bool deepCopyFrom(RotatedQuadraticCone *that)
A function to make a deep copy of an instance of this class.
RotatedQuadraticCone()
The RotatedQuadraticCone class constructor.
int firstAxisDirection
The indices of the first two component can be changed Since there are possibly many dimensions,...
Definition OSInstance.h:999
int numberOfRows
Every cone has (at least) two dimensions; no distinction is made between vector cones and matrix cone...
Definition OSInstance.h:964
virtual std::string getConeInXML()
Write a RotatedQuadraticCone object in XML format.
Used to hold part of the instance in memory.
The in-memory representation of a cone of semidefinite matrices.
~SemidefiniteCone()
The SemidefiniteCone class destructor.
bool isPositiveSemiDefinite
information about semidefiniteness is also tracked in a boolean variable
int coneType
The type of the cone (one of the values in ENUM_CONE_TYPE)
SemidefiniteCone()
The SemidefiniteCone class constructor.
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,...
virtual std::string getConeName()
int idx
cones are referenced by an (automatically created) index
virtual std::string getConeInXML()
Write a SemidefiniteCone object in XML format.
bool deepCopyFrom(SemidefiniteCone *that)
A function to make a deep copy of an instance of this class.
std::string semidefiniteness
we need to distinguish positive and negative semidefiniteness
int numberOfRows
Every cone has (at least) two dimensions; no distinction is made between vector cones and matrix cone...
bool IsEqual(SemidefiniteCone *that)
A function to check for the equality of two objects.
The in-memory representation of a SparseHessianMatrix..
Definition OSGeneral.h:377
a sparse Jacobian matrix data structure
Definition OSGeneral.h:301
a sparse matrix data structure
Definition OSGeneral.h:224
a sparse vector data structure
Definition OSGeneral.h:123
The in-memory representation of the <timeDomain> element.
TimeDomainStages * stages
stages is a pointer to a Stages object
TimeDomain()
The TimeDomain class constructor.
TimeDomainInterval * interval
interval is a pointer to an Interval object
~TimeDomain()
The TimeDomain class destructor.
~TimeDomainInterval()
The Interval class destructor.
double start
start is the start of the planning period in the <interval> element.
double horizon
horizon is the end of the planning period in the <interval> element.
TimeDomainInterval()
The Interval class constructor.
The in-memory representation of the <con> element.
int idx
idx gives the index of this constraint
~TimeDomainStageCon()
The TimeDomainStageCon class destructor.
TimeDomainStageCon()
The TimeDomainStageCon class constructor.
The in-memory representation of the <constraints> child of the <stage> element.
int numberOfConstraints
numberOfConstraints gives the number of constraints contained in this stage
~TimeDomainStageConstraints()
The TimeDomainStageConstraints class destructor.
TimeDomainStageConstraints()
The TimeDomainStageConstraints class constructor.
TimeDomainStageCon ** con
con is a pointer to an array of TimeDomainStageCon object pointers
int startIdx
startdIdx gives the number of the first constraint contained in this stage
The in-memory representation of the <stage> element.
TimeDomainStageVariables * variables
variables is a pointer to a TimeDomainVariables object
std::string name
name corresponds to the optional attribute that holds the name of the stage; the default value is emp...
~TimeDomainStage()
The TimeDomainStage class destructor.
TimeDomainStageObjectives * objectives
objectives is a pointer to a TimeDomainObjectives object
TimeDomainStageConstraints * constraints
constraints is a pointer to a TimeDomainConstraints object
TimeDomainStage()
The TimeDomainStage class constructor.
The in-memory representation of the <obj> element.
int idx
idx gives the index of this variable
~TimeDomainStageObj()
The TimeDomainStageObj class destructor.
TimeDomainStageObj()
The TimeDomainStageObj class constructor.
The in-memory representation of the <objectives> child of the <stage> element.
TimeDomainStageObj ** obj
obj is a pointer to an array of TimeDomainStageObj object pointers
int startIdx
startdIdx gives the number of the first objective contained in this stage
TimeDomainStageObjectives()
The TimeDomainStageObjectives class constructor.
int numberOfObjectives
numberOfObjectives gives the number of objectives contained in this stage
~TimeDomainStageObjectives()
The TimeDomainStageObjectives class destructor.
The in-memory representation of the element.
TimeDomainStageVar()
The TimeDomainStageVar class constructor.
int idx
idx gives the index of this variable
~TimeDomainStageVar()
The TimeDomainStageVar class destructor.
The in-memory representation of the <variables> child of the <stage> element.
TimeDomainStageVar ** var
var is a pointer to an array of TimeDomainStageVar object pointers
TimeDomainStageVariables()
The TimeDomainStageVariables class constructor.
int numberOfVariables
numberOfVariables gives the number of variables contained in this stage
int startIdx
startdIdx gives the number of the first variable contained in this stage
~TimeDomainStageVariables()
The TimeDomainStageVariables class destructor.
The in-memory representation of the <stages> element.
TimeDomainStage ** stage
stage is pointer to an array of stage object pointers
TimeDomainStages()
The Stages class constructor.
int numberOfStages
numberOfStages is the number of stages in the <stages> element.
~TimeDomainStages()
The Stages class destructor.
The in-memory representation of the variable element.
Definition OSInstance.h:45
bool IsEqual(Variable *that)
A function to check for the equality of two objects.
Variable()
The Variable class constructor.
double ub
ub corresponds to the optional attribute that holds the variable upper bound.
Definition OSInstance.h:61
std::string name
name corresponds to the optional attribute that holds the variable name, the default value is empty
Definition OSInstance.h:71
~Variable()
The Variable class destructor.
double lb
lb corresponds to the optional attribute that holds the variable lower bound.
Definition OSInstance.h:56
char type
type corresponds to the attribute that holds the variable type: C (Continuous), B (binary),...
Definition OSInstance.h:66
The in-memory representation of the variables element.
Definition OSInstance.h:84
bool IsEqual(Variables *that)
A function to check for the equality of two objects.
Variables()
The Variables class constructor.
~Variables()
The Variables class destructor.
int numberOfVariables
numberOfVariables is the number of variables in the instance
Definition OSInstance.h:94
Variable ** var
Here we define a pointer to an array of var pointers.
Definition OSInstance.h:97
ENUM_NL_EXPR_SHAPE
ENUM_CONE_TYPE
ENUM_MATRIX_TYPE
An enum to track the many different types of values that a matrix can contain Note that these types a...
ENUM_MATRIX_SYMMETRY