22 #include "OSParameters.h"
33 using std::ostringstream;
37 bVariablesModified(false),
38 bObjectivesModified(false),
39 bConstraintsModified(false),
40 bAMatrixModified(false),
42 m_sInstanceSource(
""),
43 m_sInstanceDescription(
""),
44 m_sInstanceCreator(
""),
45 m_sInstanceLicence(
""),
46 m_bProcessVariables(false),
47 m_iVariableNumber(-1),
48 m_iNumberOfIntegerVariables( 0),
49 m_iNumberOfBinaryVariables( 0),
50 m_iNumberOfSemiContinuousVariables( 0),
51 m_iNumberOfSemiIntegerVariables( 0),
52 m_iNumberOfStringVariables( 0),
53 m_msVariableNames(NULL),
54 m_mcVariableTypes(NULL),
55 m_mdVariableLowerBounds(NULL),
56 m_mdVariableUpperBounds(NULL),
59 m_bProcessObjectives(false),
60 m_iObjectiveNumber(-1),
61 m_iObjectiveNumberNonlinear( 0),
62 m_msObjectiveNames(NULL),
64 m_miNumberOfObjCoef(NULL),
65 m_mdObjectiveConstants(NULL),
66 m_mdObjectiveWeights(NULL),
67 m_mObjectiveCoefficients(NULL),
68 m_bGetDenseObjectives(false),
69 m_mmdDenseObjectiveCoefficients(NULL),
70 m_bProcessConstraints(false),
71 m_iConstraintNumber(-1),
72 m_iConstraintNumberNonlinear( 0),
73 m_msConstraintNames(NULL),
74 m_mdConstraintLowerBounds(NULL),
75 m_mdConstraintUpperBounds(NULL),
76 m_mdConstraintConstants( NULL),
77 m_mcConstraintTypes(NULL),
78 m_bProcessLinearConstraintCoefficients(false),
79 m_iLinearConstraintCoefficientNumber(-1),
81 m_linearConstraintCoefficientsInColumnMajor(NULL),
82 m_linearConstraintCoefficientsInRowMajor(NULL),
83 m_iNumberOfQuadraticRowIndexes( 0),
84 m_bQuadraticRowIndexesProcessed(false),
85 m_miQuadRowIndexes( NULL),
86 m_bProcessQuadraticTerms(false),
87 m_iQuadraticTermNumber(-1),
88 m_quadraticTerms( NULL),
89 m_bQTermsAdded( false),
90 m_iNumberOfNonlinearExpressionTreeIndexes( 0),
91 m_bNonlinearExpressionTreeIndexesProcessed( false),
92 m_miNonlinearExpressionTreeIndexes( NULL),
93 m_iNumberOfNonlinearExpressionTreeModIndexes( 0),
94 m_bNonlinearExpressionTreeModIndexesProcessed( false),
95 m_miNonlinearExpressionTreeModIndexes( NULL),
96 m_binitForAlgDiff( false),
97 m_iNumberOfNonlinearVariables( 0),
98 m_bProcessNonlinearExpressions( false),
99 m_iNonlinearExpressionNumber( -1),
100 m_miNonlinearExpressionIndexes( NULL),
101 m_bProcessExpressionTrees( false),
102 m_bProcessExpressionTreesMod( false),
103 m_mdConstraintFunctionValues( NULL),
104 m_mdObjectiveFunctionValues( NULL),
109 m_miJacNumConTerms( NULL),
110 m_sparseJacMatrix( NULL),
111 m_iHighestTaylorCoeffOrder(-1),
112 m_LagrangianExpTree(NULL),
113 m_bLagrangianExpTreeCreated( false),
114 m_LagrangianSparseHessian( NULL),
115 m_bLagrangianSparseHessianCreated( false),
116 m_miNonLinearVarsReverseMap( NULL),
117 m_bAllNonlinearVariablesIndex( false),
118 m_bOSADFunIsCreated( false),
119 m_bCppADTapesBuilt( false),
120 m_bCppADMustReTape( false),
121 m_bDuplicateExpressionTreesMap( false),
122 m_bNonLinearStructuresInitialized( false),
123 m_bSparseJacobianCalculated( false),
124 m_iHighestOrderEvaluated( -1),
125 m_mmdObjGradient( NULL),
126 m_bProcessMatrices( false),
127 m_iMatrixNumber (-1),
128 m_miMatrixSymmetry(NULL),
129 m_miMatrixType(NULL),
130 m_miMatrixNumberOfColumns(NULL),
131 m_miMatrixNumberOfRows(NULL),
132 m_msMatrixNames(NULL),
140 m_iMatrixVarNumber(-1),
141 m_iMatrixObjNumber(-1),
142 m_iMatrixConNumber(-1),
143 m_iMatrixExpressionNumber(-1),
145 m_bProcessTimeDomain( false),
146 m_bProcessTimeStages( false),
147 m_bProcessTimeInterval( false),
148 m_bFiniteTimeStages( false),
149 m_iNumberOfTimeStages(-1),
150 m_sTimeDomainFormat(
""),
151 m_msTimeDomainStageNames(NULL),
152 m_miTimeDomainStageVariableNumber(NULL),
153 m_mmiTimeDomainStageVarList(NULL),
154 m_miTimeDomainStageConstraintNumber(NULL),
155 m_mmiTimeDomainStageConList(NULL),
156 m_miTimeDomainStageObjectiveNumber(NULL),
157 m_mmiTimeDomainStageObjList(NULL),
158 bUseExpTreeForFunEval( false)
169 std::ostringstream outStr;
174 std::map<int, ScalarExpressionTree*>::iterator posMapExpTree;
222 outStr <<
"Delete m_msObjectiveNames" << std::endl;
223 outStr <<
"Delete m_msMaxOrMins" << std::endl;
224 outStr <<
"Delete m_miNumberOfObjCoef" << std::endl;
225 outStr <<
"Delete m_mdObjectiveConstants" << std::endl;
226 outStr <<
"Delete m_mdObjectiveWeights" << std::endl;
285 outStr <<
"deleting Objective function gradient " << i << std::endl;
299 "Do garbage collection for the nonlinear API");
357 outStr <<
"Deleting an expression tree from the map for row " << posMapExpTree->first << std::endl;
401 #ifdef COIN_HAS_CPPAD
405 throw ErrorClass(
"Error: An Algorithmic Differentiation Package Not Available");
442 if (m_mExpandedMatricesInColumnMajor != NULL)
446 if (m_mExpandedMatricesInColumnMajor[i] != NULL)
447 delete m_mExpandedMatricesInColumnMajor[i];
448 m_mExpandedMatricesInColumnMajor[i] = NULL;
450 delete[] m_mExpandedMatricesInColumnMajor;
451 m_mExpandedMatricesInColumnMajor = NULL;
454 if (m_mExpandedMatricesInRowMajor != NULL)
458 if (m_mExpandedMatricesInRowMajor[i] != NULL)
459 delete m_mExpandedMatricesInRowMajor[i];
460 m_mExpandedMatricesInRowMajor[i] = NULL;
462 delete[] m_mExpandedMatricesInRowMajor;
463 m_mExpandedMatricesInRowMajor = NULL;
466 if (m_mMatrixBlocksInColumnMajor != NULL)
470 if (m_mMatrixBlocksInColumnMajor[i] != NULL)
471 delete m_mMatrixBlocksInColumnMajor[i];
472 m_mMatrixBlocksInColumnMajor[i] = NULL;
474 delete[] m_mMatrixBlocksInColumnMajor;
475 m_mMatrixBlocksInColumnMajor = NULL;
479 if (m_mMatrixTransformation != NULL)
483 if (m_mMatrixTransformation[i] != NULL)
484 delete m_mMatrixTransformation[i];
485 m_mMatrixTransformation[i] = NULL;
487 delete[] m_mMatrixTransformation;
488 m_mMatrixTransformation = NULL;
499 if (m_msTimeDomainStageNames != NULL)
501 delete[] m_msTimeDomainStageNames;
502 m_msTimeDomainStageNames = NULL;
505 if (m_miTimeDomainStageVariableNumber != NULL)
507 delete[] m_miTimeDomainStageVariableNumber;
508 m_miTimeDomainStageVariableNumber = NULL;
511 if (m_mmiTimeDomainStageVarList != NULL)
513 for (
int i = 0; i < m_iNumberOfTimeStages; i ++)
514 delete[] m_mmiTimeDomainStageVarList[i];
515 delete[] m_mmiTimeDomainStageVarList;
516 m_mmiTimeDomainStageVarList = NULL;
519 if (m_miTimeDomainStageConstraintNumber != NULL)
521 delete[] m_miTimeDomainStageConstraintNumber;
522 m_miTimeDomainStageConstraintNumber = NULL;
525 if (m_mmiTimeDomainStageConList != NULL)
527 for (
int i = 0; i < m_iNumberOfTimeStages; i ++)
528 delete[] m_mmiTimeDomainStageConList[i];
529 delete[] m_mmiTimeDomainStageConList;
530 m_mmiTimeDomainStageConList = NULL;
533 if (m_miTimeDomainStageObjectiveNumber != NULL)
535 delete[] m_miTimeDomainStageObjectiveNumber;
536 m_miTimeDomainStageObjectiveNumber = NULL;
539 if (m_mmiTimeDomainStageObjList != NULL)
541 for (
int i = 0; i < m_iNumberOfTimeStages; i ++)
542 delete[] m_mmiTimeDomainStageObjList[i];
543 delete[] m_mmiTimeDomainStageObjList;
544 m_mmiTimeDomainStageObjList = NULL;
549 delete instanceHeader;
550 instanceHeader = NULL;
705 numberOfConstraints(0),
736 iNumberOfStartElements( 0)
787 numberOfQuadraticTerms(0),
845 numberOfNonlinearExpressions(0) ,
855 std::ostringstream outStr;
872 outStr <<
"DESTROYING EXPRESSION " << i <<
"(row " <<
nl[ i]->
idx <<
")" << endl;
894 numberOfMatrices(0) ,
904 std::ostringstream outStr;
921 outStr <<
"DESTROYING MATRIX " << i << endl;
950 std::ostringstream outStr;
967 outStr <<
"DESTROYING CONE " << i << endl;
990 numberOfOtherIndexes(0),
1014 return "genericCone";
1033 return "nonnegativeCone";
1052 return "nonpositiveCone";
1083 return "orthantCone";
1087 referenceMatrixIdx(0)
1103 return "polyhedralCone";
1108 normScaleFactor(1.0),
1109 distortionMatrixIdx(-1),
1126 return "quadraticCone";
1131 normScaleFactor(1.0),
1132 distortionMatrixIdx(-1),
1133 firstAxisDirection(0),
1134 secondAxisDirection(1)
1150 return "rotatedQuadraticCone";
1157 semidefiniteness(
"positive"),
1158 isPositiveSemiDefinite(true)
1174 return "semidefiniteCone";
1193 return "copositiveMatricesCone";
1213 return "completelyPositiveMatricesCone";
1236 return "productCone";
1260 return "intersectionCone";
1306 matrixVariables(NULL),
1307 matrixObjectives(NULL),
1308 matrixConstraints(NULL),
1309 matrixExpressions(NULL)
1337 numberOfMatrixVar(0),
1347 std::ostringstream outStr;
1364 outStr <<
"DESTROYING MATRIXVAR " << i << endl;
1385 numberOfMatrixObj(0),
1395 std::ostringstream outStr;
1412 outStr <<
"DESTROYING MATRIXOBJ " << i << endl;
1433 numberOfMatrixCon(0),
1443 std::ostringstream outStr;
1460 outStr <<
"DESTROYING MATRIXCON " << i << endl;
1491 std::ostringstream outStr;
1508 outStr <<
"DESTROYING EXPR " << i <<
"(\"row\" " <<
expr[i]->
idx <<
")" << endl;
1532 templateMatrixIdx(-1),
1533 varReferenceMatrixIdx(-1),
1557 templateMatrixIdx(-1),
1558 objReferenceMatrixIdx(-1),
1560 constantMatrixIdx(-1),
1579 templateMatrixIdx(-1),
1580 conReferenceMatrixIdx(-1),
1641 numberOfVariables(0),
1686 numberOfConstraints(0),
1731 numberOfObjectives(0),
1870 linearConstraintCoefficients(NULL),
1871 quadraticCoefficients(NULL),
1872 nonlinearExpressions(NULL),
1875 matrixProgramming(NULL),
1968 throw ErrorClass(
"instanceHeader object undefined in method getInstanceName()");
1979 throw ErrorClass(
"instanceHeader object undefined in method getInstanceSource()");
1990 throw ErrorClass(
"instanceHeader object undefined in method getInstanceDescription()");
2001 throw ErrorClass(
"instanceHeader object undefined in method getInstanceCreator()");
2012 throw ErrorClass(
"instanceHeader object undefined in method getInstanceLicence()");
2023 throw ErrorClass(
"data object undefined in method getVariableNumber()");
2055 for(i = 0; i <
n; i++)
2098 throw ErrorClass(
"variable type not yet implemented");
2179 throw ErrorClass(
"data object undefined in method getVariableNumber()");
2209 for(i = 0; i <
n; i++)
2218 for(i = 0; i <
n; i++)
2228 throw ErrorClass(
"objective coefficient number inconsistent with objective coefficient array");
2293 int i,
j, numobjcoef;
2301 for(i = 0; i <
m; i++)
2308 for(i = 0; i <
m; i++)
2311 for(j = 0; j <
n; j++)
2316 numobjcoef = sparsevec->
number;
2317 for(j = 0; j < numobjcoef; j++)
2332 throw ErrorClass(
"data object undefined in method getConstraintNumber()");
2346 ostringstream outStr;
2362 for(i = 0; i <
n; i++)
2370 outStr <<
"Constraint " ;
2372 outStr <<
" is infeasible";
2377 outStr <<
"Constraint " ;
2379 outStr <<
" is infeasible";
2444 throw ErrorClass(
"data object undefined in method getLinearConstraintCoefficientNumber()");
2467 throw ErrorClass(
"ambiguous linear constraint coefficient major");
2570 throw ErrorClass(
"data object undefined in method getNumberOfQuadraticTerms()");
2589 if(!quadraticCoefs->
qTerm && n != 0)
2590 throw ErrorClass(
"quadratic term number inconsistent with quadratic term array");
2599 for(i = 0; i <
n; i++)
2625 if(n <= 0)
return NULL;
2628 std::map<int, int> foundIdx;
2629 std::map<int, int>::iterator
pos;
2633 for(i = 0; i <
n; i++)
2642 for(pos = foundIdx.begin(); pos != foundIdx.end(); ++
pos)
2661 throw ErrorClass(
"data object undefined in method getNumberOfNonlinearExpressions()");
2691 std::map<int, ScalarExpressionTree*> expTrees;
2694 std::map<int, ScalarExpressionTree*>::iterator
pos;
2701 for(pos = expTrees.begin(); pos != expTrees.end(); ++
pos)
2724 std::map<int, ScalarExpressionTree*> expTrees;
2726 std::map<int, ScalarExpressionTree*>::iterator
pos;
2733 for(pos = expTrees.begin(); pos != expTrees.end(); ++
pos)
2789 std::vector<ExprNode*> postfixVec;
2799 throw ErrorClass(
"Error in getNonlinearExpressionTreeInPostfix, rowIdx not valid");
2814 std::string resultString;
2819 ostringstream outStr;
2820 std::vector<ExprNode*> postfixVec;
2822 int rowIdx = rowIdx_;
2830 std::string tmp1 =
"";
2831 std::string tmp2 =
"";
2832 std::string tmp3 =
"";
2833 std::stack<ExprNode*> opStack;
2834 std::stack<std::string> tmpStack;
2835 std::stack<std::string> sumStack;
2836 std::stack<std::string> productStack;
2837 std::stack<std::string> minStack;
2838 std::stack<std::string> maxStack;
2851 n = postfixVec.size();
2853 for (i = 0 ; i <
n; i++)
2855 nlnode = postfixVec[ n - 1 - i];
2856 opStack.push( nlnode);
2860 for(i = 0; i <
n; i++)
2862 nlnode = opStack.top();
2871 tmpStack.push(
"PI" );
2875 tmpStack.push(
"E" );
2883 if( (nlnodeVar->
coef > 1.0) || (nlnodeVar->
coef < 1.0) )
2888 outStr << nlnodeVar->
idx;
2890 tmpStack.push(outStr.str() );
2895 outStr << nlnodeVar->
idx;
2896 tmpStack.push(outStr.str() );
2901 if( tmpStack.size() < nlnode->
inumberOfChildren)
throw ErrorClass(
"There is an error in the OSExpression Tree -- Problem writing plus operator");
2902 tmp1 = tmpStack.top();
2904 tmp2 = tmpStack.top();
2906 tmpStack.push(
"(" + tmp2 +
" + " + tmp1 +
")");
2910 if( tmpStack.size() < nlnode->
inumberOfChildren)
throw ErrorClass(
"There is an error in the OSExpression Tree -- Problem writing sum operator");
2916 sumStack.push( tmpStack.top() );
2922 outStr << sumStack.top();
2923 if (j < nlnodeSum->inumberOfChildren - 1) outStr <<
" + ";
2927 tmpStack.push( outStr.str() );
2932 if( tmpStack.size() < nlnode->
inumberOfChildren)
throw ErrorClass(
"There is an error in the OSExpression Tree -- Problem writing minus operator");
2933 tmp1 = tmpStack.top();
2935 tmp2 = tmpStack.top();
2937 tmpStack.push(
"(" + tmp2 +
" - " + tmp1 +
")");
2941 if( tmpStack.size() < nlnode->
inumberOfChildren)
throw ErrorClass(
"There is an error in the OSExpression Tree -- -- Problem writing negate operator");
2942 tmp1 = tmpStack.top();
2944 tmpStack.push(
"-"+ tmp1 );
2950 if( tmpStack.size() < nlnode->
inumberOfChildren)
throw ErrorClass(
"There is an error in the OSExpression Tree -- Problem writing times operator");
2951 tmp1 = tmpStack.top();
2953 tmp2 = tmpStack.top();
2955 tmpStack.push(
"(" + tmp2 +
"*" + tmp1 +
")");
2959 if( tmpStack.size() < nlnode->
inumberOfChildren)
throw ErrorClass(
"There is an error in the OSExpression Tree -- Problem writing divide operator");
2960 tmp1 = tmpStack.top();
2962 tmp2 = tmpStack.top();
2964 tmpStack.push(
"(" + tmp2 +
" / " + tmp1 +
")");
2968 if( tmpStack.size() < nlnode->
inumberOfChildren)
throw ErrorClass(
"There is an error in the OSExpression Tree -- Problem writing power operator");
2969 tmp1 = tmpStack.top();
2971 tmp2 = tmpStack.top();
2973 tmpStack.push(
"(" + tmp2 +
" ^ " + tmp1 +
")");
2978 if( tmpStack.size() < nlnode->
inumberOfChildren)
throw ErrorClass(
"There is an error in the OSExpression Tree -- Problem writing abs operator");
2979 tmp1 = tmpStack.top();
2981 tmpStack.push(
"abs( "+ tmp1 +
")");
2985 if( tmpStack.size() < nlnode->
inumberOfChildren)
throw ErrorClass(
"There is an error in the OSExpression Tree -- Problem writing erf operator");
2986 tmp1 = tmpStack.top();
2988 tmpStack.push(
"erf( "+ tmp1 +
")");
2993 if( tmpStack.size() < nlnode->
inumberOfChildren)
throw ErrorClass(
"There is an error in the OSExpression Tree -- Problem writing square operator ");
2994 tmp1 = tmpStack.top();
2996 tmpStack.push(
"("+ tmp1 +
")^2");
3000 if( tmpStack.size() < nlnode->
inumberOfChildren)
throw ErrorClass(
"There is an error in the OSExpression Tree -- Problem writing ln operator");
3001 tmp1 = tmpStack.top();
3003 tmpStack.push(
"ln( "+ tmp1 +
")");
3007 if( tmpStack.size() < nlnode->
inumberOfChildren)
throw ErrorClass(
"There is an error in the OSExpression Tree -- Problem writing exp operator");
3008 tmp1 = tmpStack.top();
3010 tmpStack.push(
"exp( "+ tmp1 +
")");
3014 if( tmpStack.size() < nlnode->
inumberOfChildren)
throw ErrorClass(
"There is an error in the OSExpression Tree -- Problem writing sin operator");
3015 tmp1 = tmpStack.top();
3017 tmpStack.push(
"sin( "+ tmp1 +
")");
3021 if( tmpStack.size() < nlnode->
inumberOfChildren)
throw ErrorClass(
"There is an error in the OSExpression Tree -- Problem writing cos operator ");
3022 tmp1 = tmpStack.top();
3024 tmpStack.push(
"cos( "+ tmp1 +
")");
3028 if( tmpStack.size() < nlnode->
inumberOfChildren)
throw ErrorClass(
"There is an error in the OSExpression Tree -- Problem writing sqrt operator ");
3029 tmp1 = tmpStack.top();
3031 tmpStack.push(
"sqrt( "+ tmp1 +
")");
3035 if( tmpStack.size() < nlnode->
inumberOfChildren)
throw ErrorClass(
"There is an error in the OSExpression Tree -- Problem writing min operator");
3041 minStack.push( tmpStack.top() );
3047 outStr << minStack.top();
3048 if (j < nlnodeMin->inumberOfChildren - 1) outStr <<
" , ";
3052 tmpStack.push( outStr.str() );
3057 if( tmpStack.size() < nlnode->
inumberOfChildren)
throw ErrorClass(
"There is an error in the OSExpression Tree -- Problem writing max operator");
3063 maxStack.push( tmpStack.top() );
3069 outStr << maxStack.top();
3070 if (j < nlnodeMax->inumberOfChildren - 1) outStr <<
" , ";
3074 tmpStack.push( outStr.str() );
3079 if( tmpStack.size() < nlnode->
inumberOfChildren)
throw ErrorClass(
"There is an error in the OSExpression Tree -- Problem writing if operator ");
3081 tmp1 = tmpStack.top();
3083 tmp2 = tmpStack.top();
3085 tmp3 = tmpStack.top();
3087 tmpStack.push(
"if(" + tmp3 +
"," + tmp2 +
"," + tmp1 +
")" );
3092 if( tmpStack.size() < nlnode->
inumberOfChildren)
throw ErrorClass(
"There is an error in the OSExpression Tree -- Problem writing product operator");
3098 productStack.push( tmpStack.top() );
3104 outStr << productStack.top();
3105 if (j < nlnodeProduct->inumberOfChildren - 1) outStr <<
" * ";
3109 tmpStack.push( outStr.str() );
3120 if(tmpStack.size() != 1)
throw ErrorClass(
"There is an error in the OSExpression Tree -- stack size should be 1 at end");
3121 resultString = tmpStack.top();
3125 return resultString;
3135 throw ErrorClass(
"Error in getNonlinearExpressionTreeInInfix, rowIdx not valid");
3137 return resultString;
3150 std::vector<ExprNode*> postfixVec;
3161 throw ErrorClass(
"Error in getNonlinearExpressionTreeModInPostfix, rowIdx not valid");
3176 std::vector<ExprNode*> prefixVec;
3186 throw ErrorClass(
"Error in getNonlinearExpressionTreeInPrefix, rowIdx not valid");
3201 std::vector<ExprNode*> prefixVec;
3211 throw ErrorClass(
"Error in getNonlinearExpressionTreeInPrefix, rowIdx not valid");
3225 std::map<int, int> foundIdx;
3226 std::map<int, int>::iterator
pos;
3248 if(foundIdx.find( index) != foundIdx.end() )
3262 foundIdx[ index] = i;
3269 foundIdx[ index] = i;
3275 for(pos = foundIdx.begin(); pos != foundIdx.end(); ++
pos)
3306 throw ErrorClass(
"data object undefined in method getMatrixNumber()");
3348 for (
int i=0; i <
n; i++)
3352 for (
int j=0;
j < nCh;
j++)
3386 m_miMatrixNumberOfValues[i] = 0;
3387 m_miMatrixNumberOfBlocks[i] = 0;
3397 throw ErrorClass(
"Illegal reference to baseMatrix while processing matrices");
3400 if (m_mExpandedMatricesInColumnMajor[bm] != NULL)
3401 haveElements =
true;
3402 if (m_mExpandedMatricesInRowMajor[bm] != NULL)
3405 haveElements =
true;
3407 if (m_mMatrixBlocksInColumnMajor != NULL)
3409 if (m_mMatrixTransformation != NULL)
3410 haveTransformation =
true;
3414 == ENUM_MATRIX_CONSTRUCTOR_TYPE_elements)
3416 haveElements =
true;
3420 haveTransformation =
true;
3425 m_miMatrixNumberOfValues[i] =
new int[
n];
3426 m_miMatrixNumberOfBlocks[i] =
new int[
n];
3446 if ( (n < 0) || (n >= nMatrices) )
return false;
3454 if ( (n < 0) || (n >= nMatrices) )
return false;
3462 if ( (n < 0) || (n >= nMatrices) )
return false;
3470 if ( (n < 0) || (n >= nMatrices) )
return false;
3478 if ( (n < 0) || (n >= nMatrices) )
return false;
3486 if ( (n < 0) || (n >= nMatrices) )
return false;
3494 if ( (n < 0) || (n >= nMatrices) )
return false;
3505 throw ErrorClass(
"no matrices defined in method getMatrixCoefficientsInColumnMajor()");
3506 if ( (n < 0) || (n >= nMatrices) )
3507 throw ErrorClass(
"invalid matrix index in method getMatrixCoefficientsInColumnMajor()");
3523 throw ErrorClass(
"no matrices defined in method getMatrixCoefficientsInRowMajor()");
3524 if ( (n < 0) || (n >= nMatrices) )
3525 throw ErrorClass(
"invalid matrix index in method getMatrixCoefficientsInRowMajor()");
3541 throw ErrorClass(
"data object undefined in method getNumberOfMatrixVariables()");
3556 throw ErrorClass(
"data object undefined in method getNumberOfMatrixObjectives()");
3571 throw ErrorClass(
"data object undefined in method getNumberOfMatrixConstraints()");
3586 throw ErrorClass(
"data object undefined in method getNumberOfMatrixExpressions()");
3605 throw ErrorClass(
"data object undefined in method getNumberOfMatrixExpressions()");
3625 return m_iNumberOfMatrixExpressionTreeIndexes;
3630 if(m_bMatrixExpressionTreeIndexesProcessed ==
true)
return m_miMatrixExpressionTreeIndexes;
3631 m_bMatrixExpressionTreeIndexesProcessed =
true;
3632 std::map<int, MatrixExpressionTree*> expTrees;
3634 std::map<int, MatrixExpressionTree*>::iterator
pos;
3638 m_iNumberOfMatrixExpressionTreeIndexes = expTrees.size();
3639 m_miMatrixExpressionTreeIndexes =
new int[ m_iNumberOfMatrixExpressionTreeIndexes ] ;
3641 for(pos = expTrees.begin(); pos != expTrees.end(); ++
pos)
3643 m_miMatrixExpressionTreeIndexes[ i++] = pos->first;
3646 return m_miMatrixExpressionTreeIndexes;
3657 if( m_bProcessMatrixExpressionTrees ==
false )
3669 if( m_bProcessMatrixExpressionTreesMod ==
false )
3673 if( m_mapMatrixExpressionTreesMod.find( rowIdx) != m_mapMatrixExpressionTreesMod.end())
3674 return m_mapMatrixExpressionTreesMod[ rowIdx];
3682 std::vector<ExprNode*> postfixVec;
3692 throw ErrorClass(
"Error in getMatrixExpressionTreeInPostfix, rowIdx not valid");
3706 std::string resultString;
3711 ostringstream outStr;
3712 std::vector<ExprNode*> postfixVec;
3713 int rowIdx = rowIdx_;
3721 std::string tmp1 =
"";
3722 std::string tmp2 =
"";
3723 std::string tmp3 =
"";
3724 std::stack<OSnLNode*> opStack;
3725 std::stack<std::string> tmpStack;
3726 std::stack<std::string> sumStack;
3727 std::stack<std::string> productStack;
3728 std::stack<std::string> minStack;
3729 std::stack<std::string> maxStack;
3742 n = postfixVec.size();
3744 for (i = 0 ; i <
n; i++)
3746 nlnode = postfixVec[ n - 1 - i];
3747 opStack.push( nlnode);
3753 for(i = 0; i <
n; i++)
3756 nlnode = opStack.top();
3766 tmpStack.push(
"PI" );
3770 tmpStack.push(
"E" );
3778 if( (nlnodeVar->
coef > 1.0) || (nlnodeVar->
coef < 1.0) )
3783 outStr << nlnodeVar->
idx;
3785 tmpStack.push(outStr.str() );
3791 outStr << nlnodeVar->
idx;
3792 tmpStack.push(outStr.str() );
3798 if( tmpStack.size() < nlnode->
inumberOfChildren)
throw ErrorClass(
"There is an error in the OSExpression Tree -- Problem writing plus operator");
3799 tmp1 = tmpStack.top();
3801 tmp2 = tmpStack.top();
3803 tmpStack.push(
"(" + tmp2 +
" + " + tmp1 +
")");
3807 if( tmpStack.size() < nlnode->
inumberOfChildren)
throw ErrorClass(
"There is an error in the OSExpression Tree -- Problem writing sum operator");
3813 sumStack.push( tmpStack.top() );
3819 outStr << sumStack.top();
3820 if (j < nlnodeSum->inumberOfChildren - 1) outStr <<
" + ";
3824 tmpStack.push( outStr.str() );
3829 if( tmpStack.size() < nlnode->
inumberOfChildren)
throw ErrorClass(
"There is an error in the OSExpression Tree -- Problem writing minus operator");
3830 tmp1 = tmpStack.top();
3832 tmp2 = tmpStack.top();
3834 tmpStack.push(
"(" + tmp2 +
" - " + tmp1 +
")");
3838 if( tmpStack.size() < nlnode->
inumberOfChildren)
throw ErrorClass(
"There is an error in the OSExpression Tree -- -- Problem writing negate operator");
3839 tmp1 = tmpStack.top();
3841 tmpStack.push(
"-"+ tmp1 );
3847 if( tmpStack.size() < nlnode->
inumberOfChildren)
throw ErrorClass(
"There is an error in the OSExpression Tree -- Problem writing times operator");
3848 tmp1 = tmpStack.top();
3850 tmp2 = tmpStack.top();
3852 tmpStack.push(
"(" + tmp2 +
"*" + tmp1 +
")");
3856 if( tmpStack.size() < nlnode->
inumberOfChildren)
throw ErrorClass(
"There is an error in the OSExpression Tree -- Problem writing divide operator");
3857 tmp1 = tmpStack.top();
3859 tmp2 = tmpStack.top();
3861 tmpStack.push(
"(" + tmp2 +
" / " + tmp1 +
")");
3865 if( tmpStack.size() < nlnode->
inumberOfChildren)
throw ErrorClass(
"There is an error in the OSExpression Tree -- Problem writing power operator");
3866 tmp1 = tmpStack.top();
3868 tmp2 = tmpStack.top();
3870 tmpStack.push(
"(" + tmp2 +
" ^ " + tmp1 +
")");
3875 if( tmpStack.size() < nlnode->
inumberOfChildren)
throw ErrorClass(
"There is an error in the OSExpression Tree -- Problem writing abs operator");
3876 tmp1 = tmpStack.top();
3878 tmpStack.push(
"abs( "+ tmp1 +
")");
3882 if( tmpStack.size() < nlnode->
inumberOfChildren)
throw ErrorClass(
"There is an error in the OSExpression Tree -- Problem writing erf operator");
3883 tmp1 = tmpStack.top();
3885 tmpStack.push(
"erf( "+ tmp1 +
")");
3890 if( tmpStack.size() < nlnode->
inumberOfChildren)
throw ErrorClass(
"There is an error in the OSExpression Tree -- Problem writing square operator ");
3891 tmp1 = tmpStack.top();
3893 tmpStack.push(
"("+ tmp1 +
")^2");
3897 if( tmpStack.size() < nlnode->
inumberOfChildren)
throw ErrorClass(
"There is an error in the OSExpression Tree -- Problem writing ln operator");
3898 tmp1 = tmpStack.top();
3900 tmpStack.push(
"ln( "+ tmp1 +
")");
3905 if( tmpStack.size() < nlnode->
inumberOfChildren)
throw ErrorClass(
"There is an error in the OSExpression Tree -- Problem writing exp operator");
3906 tmp1 = tmpStack.top();
3908 tmpStack.push(
"exp( "+ tmp1 +
")");
3912 if( tmpStack.size() < nlnode->
inumberOfChildren)
throw ErrorClass(
"There is an error in the OSExpression Tree -- Problem writing sin operator");
3913 tmp1 = tmpStack.top();
3915 tmpStack.push(
"sin( "+ tmp1 +
")");
3919 if( tmpStack.size() < nlnode->
inumberOfChildren)
throw ErrorClass(
"There is an error in the OSExpression Tree -- Problem writing cos operator ");
3920 tmp1 = tmpStack.top();
3922 tmpStack.push(
"cos( "+ tmp1 +
")");
3926 if( tmpStack.size() < nlnode->
inumberOfChildren)
throw ErrorClass(
"There is an error in the OSExpression Tree -- Problem writing sqrt operator ");
3927 tmp1 = tmpStack.top();
3929 tmpStack.push(
"sqrt( "+ tmp1 +
")");
3933 if( tmpStack.size() < nlnode->
inumberOfChildren)
throw ErrorClass(
"There is an error in the OSExpression Tree -- Problem writing min operator");
3939 minStack.push( tmpStack.top() );
3945 outStr << minStack.top();
3946 if (j < nlnodeMin->inumberOfChildren - 1) outStr <<
" , ";
3950 tmpStack.push( outStr.str() );
3954 if( tmpStack.size() < nlnode->
inumberOfChildren)
throw ErrorClass(
"There is an error in the OSExpression Tree -- Problem writing max operator");
3960 maxStack.push( tmpStack.top() );
3966 outStr << maxStack.top();
3967 if (j < nlnodeMax->inumberOfChildren - 1) outStr <<
" , ";
3971 tmpStack.push( outStr.str() );
3976 if( tmpStack.size() < nlnode->
inumberOfChildren)
throw ErrorClass(
"There is an error in the OSExpression Tree -- Problem writing if operator ");
3978 tmp1 = tmpStack.top();
3980 tmp2 = tmpStack.top();
3982 tmp3 = tmpStack.top();
3984 tmpStack.push(
"if(" + tmp3 +
"," + tmp2 +
"," + tmp1 +
")" );
3988 if( tmpStack.size() < nlnode->
inumberOfChildren)
throw ErrorClass(
"There is an error in the OSExpression Tree -- Problem writing product operator");
3994 productStack.push( tmpStack.top() );
4000 outStr << productStack.top();
4001 if (j < nlnodeProduct->inumberOfChildren - 1) outStr <<
" * ";
4005 tmpStack.push( outStr.str() );
4016 if(tmpStack.size() != 1)
throw ErrorClass(
"There is an error in the OSExpression Tree -- stack size should be 1 at end");
4017 resultString = tmpStack.top();
4021 return resultString;
4031 throw ErrorClass(
"Error in getNonlinearExpressionTreeInInfix, rowIdx not valid");
4033 return resultString;
4046 std::vector<ExprNode*> postfixVec;
4049 if( m_mapMatrixExpressionTreesMod.find( rowIdx) != m_mapMatrixExpressionTreesMod.end())
4057 throw ErrorClass(
"Error in getMatrixExpressionTreeModInPostfix, rowIdx not valid");
4072 std::vector<ExprNode*> prefixVec;
4082 throw ErrorClass(
"Error in getMatrixExpressionTreeInPrefix, rowIdx not valid");
4092 std::vector<ExprNode*> OSInstance::getMatrixExpressionTreeModInPrefix(
int rowIdx)
4097 std::vector<ExprNode*> prefixVec;
4100 if( m_mapMatrixExpressionTreesMod.find( rowIdx) != m_mapMatrixExpressionTreesMod.end())
4107 throw ErrorClass(
"Error in getMatrixExpressionTreeInPrefix, rowIdx not valid");
4121 std::map<int, int> foundIdx;
4122 std::map<int, int>::iterator
pos;
4147 if(foundIdx.find( index) != foundIdx.end() )
4168 foundIdx[ index] = i;
4175 foundIdx[ index] = i;
4180 for(pos = foundIdx.begin(); pos != foundIdx.end(); ++
pos)
4184 m_iMatrixObjectiveNumberNonlinear++;
4188 m_iMatrixConstraintNumberNonlinear++;
4191 m_bProcessMatrixExpressionTrees =
true;
4215 throw ErrorClass(
"getTimeDomainStageNumber: Continuous time not implemented yet");
4322 int timeDomainStageNumberVar;
4331 for (
int j = 0; j < m_miTimeDomainStageVariableNumber[i]; j++)
4360 int numTimeDomainStageCon;
4369 for (
int j = 0; j < m_miTimeDomainStageConstraintNumber[i]; j++)
4396 int numTimeDomainStageObjNum;
4405 for (
int j = 0; j < m_miTimeDomainStageObjectiveNumber[i]; j++)
4472 if(number < 0)
return false;
4503 double *upperBounds,
char *types)
4505 if(number <= 0)
return false;
4510 throw ErrorClass(
"There is no variables object");
4514 throw ErrorClass(
"input number of variables not equal to number in class");
4518 for(i = 0; i < number; i++)
4526 if(lowerBounds != NULL)
4528 for(i = 0; i < number; i++)
4533 if(upperBounds != NULL)
4535 for(i = 0; i < number; i++)
4542 for(i = 0; i < number; i++)
4560 if(number < 0)
return false;
4576 int arrayIndex = abs(index) -1;
4580 if( (maxOrMin !=
"max") && (maxOrMin !=
"min") )
return false;
4584 int n = objectiveCoefficients->
number;
4595 for(i = 0; i <
n; i++)
4606 if(number < 0)
return false;
4611 throw ErrorClass(
"there is no objectives object");
4615 throw ErrorClass(
"input number of objective not equal to number in class");
4617 if(number == 0)
return true;
4625 if(maxOrMins != NULL)
4627 for(i = 0; i < number; i++)
4629 if(maxOrMins[i] ==
"" || (maxOrMins[i].compare(
"max") != 0 && maxOrMins[i].compare(
"min") !=0))
return false;
4633 if(constants != NULL)
4641 if(objectiveCoefficients != NULL)
4643 for(i = 0; i < number; i++)
4645 int n = (&objectiveCoefficients[i] == NULL || objectiveCoefficients[i]->
indexes == NULL)?0:objectiveCoefficients[i]->number;
4654 for(j = 0; j <
n; j++)
4674 if(number < 0)
return false;
4704 if(number < 0)
return false;
4714 throw ErrorClass(
"there is no constraints object");
4718 throw ErrorClass(
"input number of constraints not equal to number in class");
4721 for(i = 0; i < number; i++)
4729 if(lowerBounds != NULL)
4731 for(i = 0; i < number; i++)
4736 if(upperBounds != NULL)
4738 for(i = 0; i < number; i++)
4743 if(constants != NULL)
4756 double*
values,
int valuesBegin,
int valuesEnd,
4757 int* indexes,
int indexesBegin,
int indexesEnd,
4758 int* starts,
int startsBegin,
int startsEnd)
4760 if(numberOfValues < 0)
return false;
4763 if(numberOfValues == 0)
return true;
4764 if((values == 0 ) ||
4765 (valuesBegin < 0 || (valuesEnd - valuesBegin + 1) != numberOfValues) ||
4767 (indexesBegin < 0 || (indexesEnd - indexesBegin + 1) != numberOfValues) ||
4769 (startsBegin < 0 || startsBegin >= startsEnd))
return false;
4821 double*
values,
int valuesBegin,
int valuesEnd,
4822 int* indexes,
int indexesBegin,
int indexesEnd,
4823 int* starts,
int startsBegin,
int startsEnd)
4825 if (numberOfValues < 0)
return false;
4828 if (numberOfValues == 0)
return true;
4829 if ((values == 0 ) ||
4830 (valuesBegin < 0 || (valuesEnd - valuesBegin + 1) != numberOfValues) ||
4832 (indexesBegin < 0 || (indexesEnd - indexesBegin + 1) != numberOfValues) ||
4834 (startsBegin < 0 || startsBegin >= startsEnd))
return false;
4847 for(i = startsBegin; i <= startsEnd; i++)
4863 for(i = valuesBegin; i <= valuesEnd; i++)
4880 for(i = indexesBegin; i <= indexesEnd; i++)
4896 for(i = indexesBegin; i <= indexesEnd; i++)
4910 throw ErrorClass(
"number of quadratic terms cannot be negative");
4921 int* rowIndexes,
int* varOneIndexes,
int* varTwoIndexes,
4922 double* coefficients,
int begin,
int end)
4924 if(number < 0)
return false;
4925 if(number != (end - begin) + 1)
return false;
4931 if( (rowIndexes == 0) ||
4932 (varOneIndexes == 0) ||
4933 (varTwoIndexes == 0) ||
4934 (coefficients == 0) )
return false;
4947 for(i = begin; i <=
end; i++)
4965 std::vector<ExprNode*> nlNodeVec;
4969 for(i = 0; i < numQPTerms; i++)
4976 nlNodeVariablePoint->
idx = varOneIndexes[ i];
4978 nlNodeVariablePoint->
coef = coefficients[ i];
4979 nlNodeVec.push_back( nlNodeVariablePoint);
4982 nlNodeVariablePoint->
idx = varTwoIndexes[ i];
4983 nlNodeVec.push_back( nlNodeVariablePoint);
4986 nlNodeVec.push_back( (
OSnLNode*)nlNodePoint);
4998 if(nexpr < 0)
return false;
5011 for (
int i=0; i < nexpr; i++)
5017 = (
OSnLNode*)root[i]->osExpressionTree->m_treeRoot->copyNodeAndDescendants();
5024 std::map<int, ScalarExpressionTree*>::iterator posMapExpTree;
5039 (posMapExpTree->second)->getVariableIndicesMap() ;
5066 "in getJacobianSparsityPattern");
5109 std::ostringstream outStr;
5124 for(i = 0; i < numQTerms; i++)
5131 outStr <<
"PROCESSING QTERM " << i << std::endl;
5153 outStr <<
"ADDED THE FOLLOWING VARIABLE TO THE MAP: " << nlNodeVariableOne->
idx << std::endl;
5166 (*expTree->
mapVarIdx)[ nlNodeVariableTwo->
idx] = k + 1;
5170 outStr <<
"ADDED THE FOLLOWING VARIABLE TO THE MAP" << nlNodeVariableTwo->
idx << std::endl;
5174 nlNodeVariableTwo->
coef = 1.;
5204 nlNodeVariableTwo->
coef = 1.;
5242 if(number < 0)
return false;
5257 unsigned int inumberOfChildren,
MatrixNode **m_mChildren)
5264 matrixType,inumberOfChildren,m_mChildren);
5269 if (number < 0)
return false;
5281 std::string name,
int numberOfOtherIndexes,
int* otherIndexes)
5324 = numberOfOtherIndexes;
5334 std::string name,
int numberOfComponents,
int* components,
5335 int numberOfOtherIndexes,
int* otherIndexes)
5376 std::string name,
int referenceIdx,
int numberOfOtherIndexes,
int* otherIndexes)
5425 std::string name, std::string semidefiniteness,
int numberOfOtherIndexes,
int* otherIndexes)
5448 std::string name,
int distortionMatrixIdx,
double normFactor,
int axisDirection,
5449 int numberOfOtherIndexes,
int* otherIndexes)
5474 std::string name,
int distortionMatrixIdx,
double normFactor,
int firstAxisDirection,
5475 int secondAxisDirection,
int numberOfOtherIndexes,
int* otherIndexes)
5505 std::string name,
int distortionMatrixIdx,
double normFactor,
int axisDirection,
double pNorm,
5506 int numberOfOtherIndexes,
int* otherIndexes)
5534 std::string name,
int maxDegree,
int numberOfUB,
double* ub,
int numberOfLB,
double* lb,
5535 int numberOfOtherIndexes,
int* otherIndexes)
5587 std::string resultString =
"";
5588 ostringstream outStr;
5598 outStr << std::endl;
5600 outStr <<
"Objectives:" << std::endl;
5601 for(i = 0; i < numObj; i++)
5603 outStr << objMaxOrMin[i] <<
' ';
5606 outStr << std::endl;
5607 outStr <<
"Constraints:" << std::endl;
5608 for(i = 0; i < numCon; i++)
5613 outStr << std::endl;
5614 outStr <<
"Variables:" << std::endl;
5616 for(i = 0; i < numVar; i++)
5631 outStr <<
" Type = " ;
5633 outStr <<
" Lower Bound = ";
5635 outStr <<
" Upper Bound = ";
5637 outStr << std::endl;
5648 return outStr.str() ;
5654 std::string resultString =
"";
5657 ostringstream outStr;
5664 bool addedLinearTerm =
false;
5691 for(j = 0; j < row_nonz; j++)
5712 if( j < row_nonz - 1) outStr <<
" + ";
5713 addedLinearTerm =
true;
5719 return "row index not found; print command ignored\n";
5724 int obj_idx = -rowIdx - 1;
5728 for(j = 0; j < obj_nonz; j++)
5734 if( j < obj_nonz - 1) outStr <<
" + ";
5738 return "row index not found; print command ignored\n";
5742 if( (addedLinearTerm ==
true) || (obj_nonz > 0) ) outStr <<
" + " ;
5763 outStr << std::endl;
5764 resultString = outStr.str();
5765 return resultString;
5781 ErrorClass(
"constraint index not valid in OSInstance::calculateFunctionValue");
5805 ErrorClass(
"objective function index not valid in OSInstance::calculateFunctionValue");
5815 for(i = 0; i < obj->
number; i++)
5835 bool new_x,
int highestOrder)
5856 int idx, numConstraints;
5859 for(idx = 0; idx < numConstraints; idx++)
5874 bool new_x,
int highestOrder)
5896 int idx, numObjectives;
5899 for(idx = 0; idx < numObjectives; idx++)
5913 bool new_x,
int highestOrder)
5918 if(highestOrder < 1 )
throw ErrorClass(
"When calling calculateAllConstraintFunctionGradients highestOrder should be 1 or 2");
5932 int idx,
bool new_x,
int highestOrder)
5936 if(highestOrder < 1 )
throw ErrorClass(
"When calling calculateConstraintFunctionGradient highestOrder should be 1 or 2");
5938 throw ErrorClass(
"invalid index passed to calculateConstraintFunctionGrad");
5948 for(i = 0; i < sp->
number; i++)
5967 throw ErrorClass(
"invalid index passed to calculateConstraintFunctionGrad");
5977 for(i = 0; i < sp->
number; i++)
5992 bool new_x,
int highestOrder)
5996 if(highestOrder < 1 )
throw ErrorClass(
"When calling calculateAllObjectiveFunctionGradients highestOrder should be 1 or 2");
5999 std::map<int, ScalarExpressionTree*>::iterator posMapExpTree;
6002 if(posMapExpTree->first < 0)
6005 posMapExpTree->first, new_x, highestOrder);
6018 int objIdx,
bool new_x,
int highestOrder)
6025 if(highestOrder < 1 )
throw ErrorClass(
"When calling calculateObjectiveFunctionGradient highestOrder should be 1 or 2");
6029 std::map<int, ScalarExpressionTree*>::iterator posMapExpTree;
6030 std::map<int, int>::iterator posVarIndexMap;
6031 int iHighestOrderEvaluatedStore;
6037 if(posMapExpTree->first == objIdx)
6044 m_vdX.push_back( x[ posVarIndexMap->first]) ;
6086 std::map<int, ScalarExpressionTree*>::iterator posMapExpTree;
6087 std::map<int, int>::iterator posVarIndexMap;
6089 int iHighestOrderEvaluatedStore;
6093 if(posMapExpTree->first == objIdx)
6100 m_vdX.push_back( x[ posVarIndexMap->first]) ;
6136 bool new_x,
int highestOrder)
6140 if(highestOrder != 2 )
throw ErrorClass(
"When calling calculateLagrangianHessian highestOrder should be 2");
6158 throw ErrorClass(
"invalid index passed to calculateHessian");
6165 objLambda[ i] = 0.0;
6169 conLambda[ i] = 0.0;
6175 objLambda[ abs(idx) - 1] = 1.0;
6179 conLambda[ idx] = 1.0;
6199 std::ostringstream outStr;
6208 double *value = NULL;
6222 for ( i = 0; i < iNumRowStarts; i++)
6235 this->instanceData->linearConstraintCoefficients->
numberOfValues > 0)
6238 for (i = 0; i < iNumVariableStarts; i++)
6240 for (j = start[i]; j < start[ i + 1 ]; j++)
6255 if( value[j] > 0 || value[j] < 0)
6259 nlNodeVariable->
coef = value[
j];
6260 nlNodeVariable->
idx = i;
6279 for (i = 1; i < iNumRowStarts; i++ )
6297 this->instanceData->linearConstraintCoefficients->
numberOfValues > 0)
6301 for (i = 0; i < iNumVariableStarts; i++)
6305 for (j = start[i]; j < start[ i + 1 ]; j++)
6321 std::map<int, int>::iterator posVarIdx;
6323 for (i = 0; i < iNumRowStarts - 1; i++ )
6336 posVarIdx->second = iTemp;
6344 outStr <<
"HERE ARE ROW STARTS:" << std::endl;
6345 for (i = 0; i < iNumRowStarts; i++ )
6349 outStr << std::endl << std::endl;
6350 outStr <<
"HERE ARE VARIABLE INDICES:" << std::endl;
6351 for (i = 0; i <
m_miJacStart[ iNumRowStarts - 1]; i++ )
6355 outStr << std::endl << std::endl;
6356 outStr <<
"HERE ARE VALUES:" << std::endl;
6357 for (i = 0; i < m_miJacStart[ iNumRowStarts - 1]; i++ )
6361 outStr << std::endl << std::endl;
6363 outStr <<
"HERE ARE NUMBER OF CONSTANT TERMS:" << std::endl;
6364 for (i = 0; i < iNumRowStarts - 1; i++ )
6369 outStr << std::endl << std::endl;
6378 std::ostringstream outStr;
6383 std::map<int, int>::iterator posVarIdx;
6387 double *value = NULL;
6390 this->instanceData->linearConstraintCoefficients->
numberOfValues > 0)
6402 for ( i = 0; i < iNumJacRowStarts; i++)
6417 this->instanceData->linearConstraintCoefficients->
numberOfValues > 0)
6420 for (i = 0; i < loopLimit; i++)
6423 for (j = start[i]; j < start[ i + 1 ]; j++)
6434 if(value[ j] > 0 || value[j] < 0)
6437 nlNodeVariable->
coef = value[
j];
6438 nlNodeVariable->
idx = index[
j];
6455 for (i = 1; i < iNumJacRowStarts; i++ )
6474 this->instanceData->linearConstraintCoefficients->
numberOfValues > 0)
6476 for (i = 0; i < loopLimit; i++)
6479 for (j = start[i]; j < start[ i + 1 ]; j++)
6492 for (i = 0; i < loopLimit; i++ )
6504 posVarIdx->second =
k;
6512 outStr <<
"HERE ARE ROW STARTS:" << std::endl;
6513 for (i = 0; i < iNumJacRowStarts; i++ )
6517 outStr << std::endl << std::endl;
6518 outStr <<
"HERE ARE VARIABLE INDICES:" << std::endl;
6519 for (i = 0; i <
m_miJacStart[ iNumJacRowStarts - 1]; i++ )
6523 outStr << std::endl << std::endl;
6524 outStr <<
"HERE ARE VALUES:" << std::endl;
6525 for (i = 0; i < m_miJacStart[ iNumJacRowStarts - 1]; i++ )
6529 outStr << std::endl << std::endl;
6531 outStr <<
"HERE ARE NUMBER OF CONSTANT TERMS:" << std::endl;
6532 for (i = 0; i < iNumJacRowStarts - 1; i++ )
6536 outStr << std::endl << std::endl;
6549 std::map<int, ScalarExpressionTree*>::iterator posMapExpTree;
6553 int numChildren = 0;
6567 nlNodeVariable->
coef = 1.;
6570 rowIdx = posMapExpTree->first;
6586 nlNodeSum->
m_mChildren[ numChildren] = nlNodeTimes;
6597 std::ostringstream outStr;
6602 std::map<int, ScalarExpressionTree*>::iterator posMapExpTree;
6603 std::map<int, int>::iterator posVarIdx;
6609 expTree = posMapExpTree->second;
6611 for(posVarIdx = (*expTree->
mapVarIdx).begin(); posVarIdx != (*expTree->
mapVarIdx).
end(); ++posVarIdx)
6625 posVarIdx->second = kount;
6631 outStr <<
"POSITION FIRST = " << posVarIdx->first ;
6632 outStr <<
" POSITION SECOND = " << posVarIdx->second << std::endl;
6643 std::ostringstream outStr;
6654 std::vector<double> vx;
6655 std::map<int, int>::iterator posMap1, posMap2;
6660 vx.push_back( 1.0) ;
6695 outStr <<
"HESSIAN SPARSITY PATTERN" << std::endl;
6729 bool new_x,
int highestOrder)
6734 std::map<int, int>::iterator posVarIndexMap;
6741 m_vdX.push_back( x[ posVarIndexMap->first]) ;
6751 if(
m_vdX.size() == 0)
6755 m_vdX.push_back( x[ posVarIndexMap->first]) ;
6763 switch( highestOrder)
6793 throw ErrorClass(
"Derivative should be order 0, 1, or 2");
6806 std::ostringstream outStr;
6811 int i,
j, rowNum, objNum;
6872 std::ostringstream outStr;
6878 int rowNum, jacIndex;
6879 unsigned int jstart, jend;
6883 std::map<int, ScalarExpressionTree*>::iterator posMapExpTree;
6884 std::map<int, int>::iterator posVarIdx;
6897 idx = posMapExpTree->first;
6908 ErrorClass(
"number of partials not consistent");
6949 idx = posMapExpTree->first;
6974 outStr <<
"JACOBIAN DATA " << std::endl;
6996 std::ostringstream outStr;
7002 int rowNum, jacIndex;
7005 int hessValuesIdx = 0;
7007 std::map<int, ScalarExpressionTree*>::iterator posMapExpTree;
7008 std::map<int, int>::iterator posVarIndexMap;
7009 if( objLambda == NULL)
throw ErrorClass(
"must have a multiplier for the objective function even if zero when calling getSecondOrderResults");
7011 if( conMultipliers == NULL)
throw ErrorClass(
"cannot have a null vector of lagrange multipliers when calling getSecondOrderResults -- okay if zero");
7015 if( posMapExpTree->first >= 0)
7017 m_vdLambda.push_back( conMultipliers[ posMapExpTree->first]);
7022 m_vdLambda.push_back( objLambda[ abs(posMapExpTree->first) - 1] );
7037 idx = posMapExpTree->first;
7088 outStr <<
"JACOBIAN DATA " << std::endl;
7109 std::ostringstream outStr;
7118 std::map<int, ScalarExpressionTree*>::iterator posMapExpTree;
7145 std::ostringstream outStr;
7158 for(i = 0; i <
m; i++)
7161 for(j = 0; j <
n; j++)
7189 if ((format !=
"stages") && (format !=
"interval") && (format !=
"none"))
7195 if (format ==
"stages")
7206 if (format ==
"interval")
7217 if (format ==
"none")
7280 for (
int i = 0; i < number; i++)
7286 for (
int i = 0; i < number; i++)
7342 for (
int i = 0; i < numberOfStages; i++)
7346 for (
int i = 0; i < numberOfStages; i++)
7357 checksum += numberOfVariables[i];
7384 for (
int i = 0; i < numberOfStages; i++)
7388 for (
int i = 0; i < numberOfStages; i++)
7399 for (
int j = 0; j < numberOfVariables[i]; j++)
7404 checksum += numberOfVariables[i];
7411 for (
int i = 0; i < numberOfStages; i++)
7415 if (checkvar[k] != -1)
7450 for (
int i = 0; i < numberOfStages; i++)
7454 for (
int i = 0; i < numberOfStages; i++)
7465 checksum += numberOfConstraints[i];
7492 for (
int i = 0; i < numberOfStages; i++)
7496 for (
int i = 0; i < numberOfStages; i++)
7507 for (
int j = 0; j < numberOfConstraints[i]; j++)
7512 checksum += numberOfConstraints[i];
7519 for (
int i = 0; i < numberOfStages; i++)
7523 if (checkvar[k] != -1)
7560 for (
int i = 0; i < numberOfStages; i++)
7563 for (
int i = 0; i < numberOfStages; i++)
7601 for (
int i = 0; i < numberOfStages; i++)
7604 for (
int i = 0; i < numberOfStages; i++)
7615 for (
int j = 0; j < numberOfObjectives[i]; j++)
7625 for (
int i = 0; i < numberOfStages; i++)
7632 if (checkvar[i] == 0)
7669 std::map<int, ScalarExpressionTree*>::iterator posMapExpTree;
7671 size_t n = vdX.size();
7672 #ifdef COIN_HAS_CPPAD
7674 CppAD::vector< CppAD::AD<double> > vdaX( n );
7675 for(i = 0; i <
n; i++)
7680 CppAD::Independent( vdaX);
7686 CppAD::vector< CppAD::AD<double> > m_vFG;
7700 Fad =
new CppAD::ADFun<double>(vdaX, m_vFG);
7705 throw ErrorClass(
"Error: An Algorithmic Differentiation Package Not Available");
7724 ErrorClass(
"trying to calculate a p order forward when p-1 Taylor coefficient not available");
7728 #ifdef COIN_HAS_CPPAD
7729 return (*Fad).Forward(p, vdX);
7731 throw ErrorClass(
"Error: An Algorithmic Differentiation Package Not Available");
7746 #ifndef COIN_HAS_CPPAD
7747 throw ErrorClass(
"Error: An Algorithmic Differentiation Package Not Available");
7752 ErrorClass(
"trying to calculate a p order reverse when p-1 Taylor coefficient not available");
7754 #ifdef COIN_HAS_CPPAD
7755 return (*Fad).Reverse(p, vdlambda);
7778 r[ i * m_iNumberOfNonlinearVariables + j ] =
false;
7779 r[ i * m_iNumberOfNonlinearVariables + i] =
true;
7783 #ifdef COIN_HAS_CPPAD
7784 (*Fad).ForSparseJac(m_iNumberOfNonlinearVariables, r);
7786 throw ErrorClass(
"Error: An Algorithmic Differentiation Package Not Available");
7791 std::vector<bool>
e( m);
7793 for(i = 0; i <
m; i++) e[i] =
true;
7798 #ifdef COIN_HAS_CPPAD
7799 m_vbLagHessNonz = (*Fad).RevSparseHes(m_iNumberOfNonlinearVariables, e);
7806 if(
m_vbLagHessNonz[ i*m_iNumberOfNonlinearVariables + j] ==
true) numNonz++;
7823 ostringstream outStr;
7828 outStr <<
" name=\"" << name <<
"\"";
7829 outStr <<
"/>" << std::endl;
7830 return outStr.str();
7835 ostringstream outStr;
7836 outStr <<
"<nonnegativeCone";
7840 outStr <<
" name=\"" << name <<
"\"";
7841 outStr <<
"/>" << std::endl;
7842 return outStr.str();
7847 ostringstream outStr;
7848 outStr <<
"<nonpositiveCone";
7852 outStr <<
" name=\"" << name <<
"\"";
7853 outStr <<
"/>" << std::endl;
7854 return outStr.str();
7859 ostringstream outStr;
7860 outStr <<
"<generalOrthantCone";
7864 outStr <<
" name=\"" << name <<
"\"";
7865 outStr <<
">" << std::endl;
7870 while (i < numberOfRows*numberOfColumns)
7874 if (i+mult < numberOfRows*numberOfColumns && ubt ==
ub[i+mult] && lbt ==
lb[i+mult])
7880 outStr <<
"<direction";
7883 outStr <<
" type=\"zero\"";
7885 outStr <<
" type=\"nonpositive\"";
7887 outStr <<
" type=\"nonnegative\"";
7889 outStr <<
" type=\"free\"";
7891 outStr <<
" mult=\"" << mult <<
"\"";
7897 outStr <<
"</generalOrthantCone>" << std::endl;
7898 return outStr.str();
7903 ostringstream outStr;
7904 outStr <<
"<polyhedralCone";
7909 outStr <<
" name=\"" << name <<
"\"";
7910 outStr <<
"/>" << std::endl;
7911 return outStr.str();
7916 ostringstream outStr;
7917 outStr <<
"<quadraticCone";
7921 outStr <<
" name=\"" << name <<
"\"";
7928 outStr <<
"/>" << std::endl;
7929 return outStr.str();
7934 ostringstream outStr;
7935 outStr <<
"<rotatedQuadraticCone";
7939 outStr <<
" name=\"" << name <<
"\"";
7948 outStr <<
"/>" << std::endl;
7949 return outStr.str();
7954 ostringstream outStr;
7955 outStr <<
"<semidefiniteCone";
7960 outStr <<
"/>" << std::endl;
7962 return outStr.str();
7967 ostringstream outStr;
7968 outStr <<
"<nonnegativeCone";
7972 outStr <<
" name=\"" << name <<
"\"";
7973 outStr <<
"/>" << std::endl;
7974 return outStr.str();
7979 ostringstream outStr;
7980 outStr <<
"<nonnegativeCone";
7984 outStr <<
" name=\"" << name <<
"\"";
7985 outStr <<
"/>" << std::endl;
7986 return outStr.str();
7991 ostringstream outStr;
7992 outStr <<
"<productCone";
7996 outStr <<
" name=\"" << name <<
"\"";
7997 outStr <<
">" << std::endl;
7999 outStr <<
"<factors numberOfEl=\"" <<
factors->
numberOfEl <<
"\">" << std::endl;
8001 outStr <<
"</factors>" << std::endl;
8003 outStr <<
"</productCone>" << std::endl;
8004 return outStr.str();
8009 ostringstream outStr;
8010 outStr <<
"<intersectionCone";
8014 outStr <<
" name=\"" << name <<
"\"";
8015 outStr <<
">" << std::endl;
8019 outStr <<
"</components>" << std::endl;
8021 outStr <<
"</intersectionCone>" << std::endl;
8022 return outStr.str();
8043 "First object is NULL, second is not");
8054 "Second object is NULL, first is not");
8084 "First object is NULL, second is not");
8095 "Second object is NULL, first is not");
8139 "First object is NULL, second is not");
8150 "Second object is NULL, first is not");
8180 "First object is NULL, second is not");
8191 "Second object is NULL, first is not");
8197 if (this->
lb != that->
lb)
8199 if (this->
ub != that->
ub)
8201 if (this->type != that->
type)
8203 if (this->name != that->
name)
8224 "First object is NULL, second is not");
8235 "Second object is NULL, first is not");
8265 "First object is NULL, second is not");
8276 "Second object is NULL, first is not");
8282 if (this->name != that->
name)
8284 if (this->maxOrMin != that->
maxOrMin)
8286 if (this->constant != that->
constant)
8315 "First object is NULL, second is not");
8326 "Second object is NULL, first is not");
8332 if (this->
idx != that->
idx)
8355 "First object is NULL, second is not");
8366 "Second object is NULL, first is not");
8396 "First object is NULL, second is not");
8407 "Second object is NULL, first is not");
8413 if (this->name != that->
name)
8415 if (this->constant != that->
constant)
8417 if (this->
lb != that->
lb)
8419 if (this->
ub != that->
ub)
8441 "First object is NULL, second is not");
8452 "Second object is NULL, first is not");
8463 if (!this->rowIdx->IsEqual(that->
rowIdx))
8488 "First object is NULL, second is not");
8500 "Second object is NULL, first is not");
8532 "First object is NULL, second is not");
8543 "Second object is NULL, first is not");
8549 if (this->
idx != that->
idx)
8576 "First object is NULL, second is not");
8587 "Second object is NULL, first is not");
8619 "First object is NULL, second is not");
8630 "Second object is NULL, first is not");
8636 if (this->
idx != that->
idx)
8659 "First object is NULL, second is not");
8670 "Second object is NULL, first is not");
8700 "First object is NULL, second is not");
8711 "Second object is NULL, first is not");
8741 "First object is NULL, second is not");
8752 "Second object is NULL, first is not");
8787 "First object is NULL, second is not");
8798 "Second object is NULL, first is not");
8826 "First object is NULL, second is not");
8837 "Second object is NULL, first is not");
8870 "First object is NULL, second is not");
8881 "Second object is NULL, first is not");
8914 "First object is NULL, second is not");
8925 "Second object is NULL, first is not");
8952 "First object is NULL, second is not");
8963 "Second object is NULL, first is not");
8990 "First object is NULL, second is not");
9001 "Second object is NULL, first is not");
9028 "First object is NULL, second is not");
9039 "Second object is NULL, first is not");
9068 "First object is NULL, second is not");
9079 "Second object is NULL, first is not");
9108 "First object is NULL, second is not");
9119 "Second object is NULL, first is not");
9186 "First object is NULL, second is not");
9197 "Second object is NULL, first is not");
9212 if (that->
matrixVar[i] != NULL)
return false;
9234 "First object is NULL, second is not");
9245 "Second object is NULL, first is not");
9267 if (this->name != that->
name)
9291 "First object is NULL, second is not");
9302 "Second object is NULL, first is not");
9317 if (that->
matrixObj[i] != NULL)
return false;
9340 "First object is NULL, second is not");
9352 "Second object is NULL, first is not");
9370 if (this->name != that->
name)
9392 "First object is NULL, second is not");
9403 "Second object is NULL, first is not");
9418 if (that->
matrixCon[i] != NULL)
return false;
9440 "First object is NULL, second is not");
9451 "Second object is NULL, first is not");
9473 if (this->name != that->
name)
9495 "First object is NULL, second is not");
9506 "Second object is NULL, first is not");
9516 if (this->
expr[i] != NULL)
9521 if (that->
expr[i] != NULL)
return false;
9543 "First object is NULL, second is not");
9554 "Second object is NULL, first is not");
9560 if (this->
idx != that->
idx )
return false;
9561 if (this->
shape != that->
shape)
return false;
int numberOfExpr
numberOfExpr gives the number of expressions
a data structure for holding quadratic terms
double * getConstraintLowerBounds()
Get constraint lower bounds.
bool setTimeDomainStageVariablesOrdered(int numberOfStages, int *numberOfVariables, int *startIdx)
This sets the variables associated with each time domain stage in temporal order. ...
TimeDomain()
The TimeDomain class constructor.
~TimeDomainStageCon()
The TimeDomainStageCon class destructor.
double * getVariableLowerBounds()
Get variable lower bounds.
bool setMatrix(std::string name, int numberOfRows, int numberOfColumns, ENUM_MATRIX_SYMMETRY symmetry, ENUM_MATRIX_TYPE matrixType, unsigned int inumberOfChildren, MatrixNode **m_mChildren)
add values to this matrix.
double * getConstraintUpperBounds()
Get constraint upper bounds.
ENUM_NL_EXPR_SHAPE shape
shape holds the shape of the nonlinear expression (linear/quadratic/convex/general) (see further up i...
ScalarExpressionTree * getNonlinearExpressionTreeMod(int rowIdx)
Get the expression tree for a given row index for the modified expression trees (quadratic terms adde...
~TimeDomainStageVariables()
The TimeDomainStageVariables class destructor.
~TimeDomainStageObjectives()
The TimeDomainStageObjectives class destructor.
MatrixVar ** matrixVar
matrixVar is an array of pointers to the <matrixVar> children
int * getTimeDomainStageNumberOfConstraints()
Get the number of constraints contained in each time stage.
bool IsEqual(Cones *that)
A function to check for the equality of two objects.
int numberOfMatrixCon
numberOfMatrixCon gives the number of <matrixCon> children
double coef
coef is an option coefficient on the variable, the default value is 1.0
bool m_bCppADMustReTape
is true if a CppAD Expresion Tree has an expression that can change depending on the value of the inp...
std::string name
name corresponds to the optional attribute that holds the variable name, the default value is empty ...
Constraints * constraints
constraints is a pointer to a Constraints object
bool setQuadraticCoefficients(int number, int *rowIndexes, int *varOneIndexes, int *varTwoIndexes, double *coefficients, int begin, int end)
set quadratic coefficients into the QuadraticCoefficients->qTerm data structure
int getNumberOfIntegerVariables()
getNumberOfIntegerVariables
~TimeDomainStageConstraints()
The TimeDomainStageConstraints class destructor.
bool m_bProcessLinearConstraintCoefficients
-—— data items for linear constraint coefficients -——
bool processConstraints()
process constraints.
bool getSparseJacobianFromColumnMajor()
~QuadraticCone()
The QuadraticCone class destructor.
virtual std::string getConeInXML()
Write a SemidefiniteCone object in XML format.
~MatrixObjectives()
The MatrixObjectives class destructor.
char * getVariableTypes()
Get variable initial values.
bool m_bProcessMatrices
-—— data items for matrices -——
int getNumberOfMatrixVariables()
Get the number of matrix variables.
ENUM_MATRIX_TYPE * m_miMatrixType
m_miMatrixType holds the type of each matrix.
virtual ~Cone()
The Cone class destructor.
bool isColumnMajor
isColumnMajor holds whether the coefMatrix (AMatrix) holding linear program data is stored by column...
std::string name
the name of the objective function
bool setConeNumber(int number)
set the number of cones
bool matrixHasBase()
Several tools to parse the constructor list of a matrix.
bool m_bDuplicateExpressionTreesMap
m_bDuplicateExpressionTreeMap is true if m_mapExpressionTrees was duplicated.
bool IsEqual(RotatedQuadraticCone *that)
A function to check for the equality of two objects.
ScalarExpressionTree * getNonlinearExpressionTree(int rowIdx)
Get the expression tree for a given row index.
The in-memory representation of a polyhedral cone.
The in-memory representation of a rotated quadratic cone.
bool addVariable(int index, std::string name, double lowerBound, double upperBound, char type)
add a variable.
~MatrixVariables()
The MatrixVariables class destructor.
virtual std::string getConeInXML()
Write an IntersectionCone object in XML format.
The in-memory representation of the <matrices> element.
std::string name
name corresponds to the optional attribute that holds the name of the stage; the default value is emp...
bool bConstraintsModified
bConstraintsModified is true if the constraints data has been modified.
InstanceData()
The InstanceData class constructor.
~Constraints()
The Constraints class destructor.
a sparse matrix data structure for matrices that can hold nonconstant values
int numberOfColumns
numberOfColumns gives the number of columns of this matrix
The in-memory representation of the <obj> element.
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 IsEqual(Nl *that)
A function to check for the equality of two objects.
int idx
idx gives the index of this variable
bool bAMatrixModified
bAMatrixModified is true if the A matrix data has been modified.
bool addQTermsToExpressionTree()
This method adds quadratic terms into the array of expression trees.
~Variables()
The Variables class destructor.
bool getIterateResults(double *x, double *objLambda, double *conLambda, bool new_x, int highestOrder)
end revised AD code
int numberOfMatrixVar
numberOfMatrixVar gives the number of <matrixVar> children
const OSSmartPtr< OSOutput > osoutput
int * getTimeDomainStageNumberOfVariables()
Get the number of variables contained in each time stage.
The in-memory representation of the <matrixObj> element.
LinearConstraintCoefficients()
The LinearConstraintCoefficients class constructor.
IntVector * rowIdx
a pointer of row indices if the problem is stored by column
double * values
values holds a double array of nonzero partial derivatives
bool bDestroyNlNodes
m_bDestroyNlNodes is true if the destructor deletes the nodes in the Expression tree ...
int getNumberOfElementConstructors()
double calculateFunctionValue(int idx, double *x, bool new_x)
Calculate the function value for function (constraint or objective) indexed by idx.
~SemidefiniteCone()
The SemidefiniteCone class destructor.
virtual std::string getConeInXML()
Write a NonnegativeCone object in XML format.
int numberOfRows
Every cone has (at least) two dimensions; no distinction is made between vector cones and matrix cone...
int m_iMatrixConNumber
m_iMatrixConNumber holds the number of matrix constraints
int m_iNumberOfStringVariables
m_iNumberOfStringVariables holds the number of string-valued variables.
int m_iConstraintNumber
m_iConstraintNumber is the number of constraints.
bool IsEqual(MatrixVariables *that)
A function to check for the equality of two objects.
int m_iJacValueSize
m_iJacValueSize is the number of nonzero partial derivates in the Jacobian.
virtual std::string getConeName()
std::string * m_msVariableNames
m_msVariableNames holds an array of variable names.
bool bUseExpTreeForFunEval
bUseExpTreeForFunEval is set to true if you wish to use the OS Expression Tree for function evaluatio...
int ubConeIdx
ubConeIdx gives a cone that must contain ubMatrix - matrixCon
int getNumberOfElementConstructors(int n)
NonlinearExpressions * nonlinearExpressions
nonlinearExpressions is a pointer to a NonlinearExpressions object
int orderConeIdx
orderConeIdx gives a cone that expresses preferences during the optimization x is (weakly) preferred ...
bool setLinearConstraintCoefficients(int numberOfValues, bool isColumnMajor, double *values, int valuesBegin, int valuesEnd, int *indexes, int indexesBegin, int indexesEnd, int *starts, int startsBegin, int startsEnd)
set linear constraint coefficients
bool setTimeDomainStageObjectivesOrdered(int numberOfStages, int *numberOfObjectives, int *startIdx)
This sets the objectives associated with each time domain stage in temporal order.
Variable()
The Variable class constructor.
bool IsEqual(Objectives *that)
A function to check for the equality of two objects.
pos
position where the operator should be printed when printing the expression
int getVariableNumber()
Get number of variables.
bool verifyVarType(char vt)
MatrixExpression ** expr
a pointer to an array of linear and nonlinear expressions that evaluate to matrices ...
std::vector< double > m_vdw
m_vdYval is a vector of derivatives – output from a reverse sweep
std::string printModel()
Print the infix representation of the problem.
double * m_mdObjectiveConstants
m_mdObjectiveConstants holds an array of objective constants (default = 0.0).
bool m_bLagrangianSparseHessianCreated
m_bLagrangianSparseHessianCreated is true if the sparse Hessian Matrix for the Lagrangian was created...
bool setTimeDomainStageVariablesUnordered(int numberOfStages, int *numberOfVariables, int **varIndex)
This sets the variables associated with each time domain stage in srbitrary order.
SparseHessianMatrix * m_LagrangianSparseHessian
m_LagrangianSparseHessian is the Hessian Matrix of the Lagrangian function in sparse format ...
int numberOfMatrixObj
numberOfMatrixObj gives the number of <matrixObj> children
TimeDomain * timeDomain
timeDomain is a pointer to a TimeDomain object
GeneralSparseMatrix * getMatrixCoefficientsInRowMajor(int n)
Get the (nonzero) elements of the matrix in row major form.
int idx
idx gives the index of this variable
int getNumberOfSemiContinuousVariables()
getNumberOfSemiContinuousVariables
ENUM_MATRIX_TYPE
An enum to track the many different types of values that a matrix can contain Note that these types a...
OrthantCone()
default constructor.
int ** m_mmiTimeDomainStageVarList
m_mmiTimeDomainStageVarList holds the list of variables in each stage.
MatrixNode ** m_mChildren
m_mChildren holds all the children, that is, nodes used in the definition or construction of the curr...
int referenceMatrixIdx
Polyhedral cones use a reference to a previously defined matrix for the extreme rays.
IntVector * factors
the list of "factors" contributing to the product each factor contains a reference to a previously de...
std::string m_sInstanceDescription
m_sInstanceDescription holds the instance description.
bool setObjectives(int number, std::string *names, std::string *maxOrMins, double *constants, double *weights, SparseVector **objectitiveCoefficients)
set all the objectives related elements.
SparseHessianMatrix * calculateHessian(double *x, int idx, bool new_x)
Calculate the Hessian of a constraint or objective function.
unsigned int inumberOfChildren
inumberOfChildren is the number of OSnLNode child elements If this number is not fixed, e.g., for a sum node, it is temporarily set to 0
int idx
idx is the index of the variable
CompletelyPositiveMatricesCone()
default constructor.
std::string errormsg
errormsg is the error that is causing the exception to be thrown
bool m_bProcessQuadraticTerms
m_bProcessQuadraticTerms holds whether the quadratic terms are processed.
bool IsEqual(Constraints *that)
A function to check for the equality of two objects.
virtual std::string getConeName()
The in-memory representation of the <matrixProgramming> element.
virtual std::vector< ExprNode * > getPostfixFromExpressionTree()
Get a vector of pointers to ExprNodes that correspond to the expression tree in postfix format...
TimeDomainStageObj ** obj
obj is a pointer to an array of TimeDomainStageObj object pointers
int numberOfRows
Every cone has (at least) two dimensions; no distinction is made between vector cones and matrix cone...
bool IsEqual(Objective *that)
A function to check for the equality of two objects.
static SparseMatrix * convertLinearConstraintCoefficientMatrixToTheOtherMajor(bool isColumnMajor, int startSize, int valueSize, int *start, int *index, double *value, int dimension)
Round a double number to the precision specified.
int getLinearConstraintCoefficientNumber()
Get number of specified (usually nonzero) linear constraint coefficient values.
virtual std::string getConeName()
int * getNonlinearExpressionTreeModIndexes()
Get all the nonlinear expression tree indexes, i.e., indexes of rows (objectives or constraints) that...
ENUM_MATRIX_SYMMETRY * m_miMatrixSymmetry
m_miMatrixSymmetry holds the symmetry property of each matrix.
IntVector * colIdx
a pointer of column indices if the problem is stored by row
std::string maxOrMin
declare the objective function to be a max or a min
~TimeDomainInterval()
The Interval class destructor.
std::string name
an optional name to this matrixObj
QuadraticCoefficients()
The QuadraticCoefficients class constructor.
The in-memory representation of the <linearConstraintCoefficients> element.
SparseVector ** getObjectiveCoefficients()
Get objective coefficients.
TimeDomainStageConstraints()
The TimeDomainStageConstraints class constructor.
bool getFirstOrderResults(double *x, double *objLambda, double *conLambda)
Calculate first derivatives.
ObjCoef ** coef
coef is pointer to an array of ObjCoef object pointers
ENUM_CONE_TYPE coneType
The type of the cone.
bool setQuadraticTermsInNonlinearExpressions(int number, int *rowIndexes, int *varOneIndexes, int *varTwoIndexes, double *coefficients)
set quadratic terms in nonlinearExpressions
bool m_bSparseJacobianCalculated
m_bSparseJacobianCalculated is true if getJacobianSparsityPattern() has been called.
bool m_bProcessObjectives
-—— data items for Objectives -——
~MatrixObj()
The MatrixVar class destructor.
The in-memory representation of the objective function <coef> element.
MatrixCon ** matrixCon
matrixCon is an array of pointers to the <matrixCon> children
int idxTwo
idxTwo is the index of the second variable in the quadratic term
QuadraticTerm ** qTerm
qTerm is a pointer to an array of QuadraticTerm object pointers
Constraint ** con
con is pointer to an array of Constraint object pointers
bool IsEqual(MatrixExpressions *that)
A function to check for the equality of two objects.
bool m_bProcessExpressionTrees
m_bProcessExpressionTrees is true if the expression trees have been processed.
std::string writeIntVectorData(IntVector *v, bool addWhiteSpace, bool writeBase64)
Take an IntVector object and write a string that validates against the OSgL schema.
MatrixConstraints * matrixConstraints
a pointer to the matrixConstraints object
bool matrixHasBlocks(int n)
int * getNonlinearExpressionTreeIndexes()
Get all the nonlinear expression tree indexes, i.e., indexes of rows (objectives or constraints) that...
MatrixVar()
The MatrixVar class constructor.
SparseJacobianMatrix * calculateAllConstraintFunctionGradients(double *x, double *objLambda, double *conLambda, bool new_x, int highestOrder)
Calculate the gradient of all constraint functions.
double * m_mdConstraintConstants
m_mdConstraintConstants holds an array of constraint constants (default = 0.0).
TimeDomainStageVariables * variables
variables is a pointer to a TimeDomainVariables object
std::string m_sInstanceSource
m_sInstanceSource holds the instance source.
bool IsEqual(NonlinearExpressions *that)
A function to check for the equality of two objects.
~PolyhedralCone()
The PolyhedralCone class destructor.
MatrixCon()
The MatrixCon class constructor.
TimeDomainInterval()
The Interval class constructor.
int numberOfConstraints
numberOfConstraints gives the number of constraints contained in this stage
bool IsEqual(OSInstance *that)
A function to check for the equality of two objects.
TimeDomainStageCon ** con
con is a pointer to an array of TimeDomainStageCon object pointers
Cone()
The Cone class constructor.
std::string getMatrixExpressionTreeInInfix(int rowIdx)
Get the infix representation for a given row (or objective function) index.
~Cones()
The Cones class destructor.
ObjCoef()
The ObjCoef class constructor.
std::map< int, int > * getVariableIndicesMap()
Retrieve a map of the indices of the variables that are in the expression tree.
std::vector< ExprNode * > getNonlinearExpressionTreeModInPrefix(int rowIdx)
Get the prefix tokens for a given row index for the modified Expression Tree (quadratic terms added)...
TimeDomainStageObjectives()
The TimeDomainStageObjectives class constructor.
The in-memory representation of a generic cone Specific cone types are derived from this generic clas...
double * m_mdConstraintUpperBounds
m_mdConstraintUpperBounds holds an array of constraint upper bounds (default = INF).
bool IsEqual(ObjCoef *that)
A function to check for the equality of two objects.
int numberOfRows
Every cone has (at least) two dimensions; no distinction is made between vector cones and matrix cone...
std::vector< double > m_vdDomainUnitVec
m_vdDomainUnitVec is a unit vector in the domain space
MatrixExpression ** getMatrixExpressions()
Get the pointers to the roots of all matrix expression trees.
void duplicateExpressionTreesMap()
duplicate the map of expression trees.
int getNumberOfNonlinearExpressionTreeModIndexes()
Get the number of unique nonlinear expression tree indexes after modifying the expression tree to con...
int returnVarType(char vt)
int numberOfRows
numberOfRows gives the number of rows of this matrix
Variables()
The Variables class constructor.
~ObjCoef()
The ObjCoef class destructor.
int * hessColIdx
hessColIdx is an integer array of column indices in the range 0, ..., n - 1.
std::string * m_msMaxOrMins
m_msMaxOrMins holds a std::string array of objective maxOrMins ("max" or "min").
a generic class from which we derive matrix constructors (BaseMatrix, MatrixElements, MatrixTransformation and MatrixBlocks) as well as matrix types (OSMatrix and MatrixBlock).
The in-memory representation of the element.
int getObjectiveNumber()
Get number of objectives.
char type
type corresponds to the attribute that holds the variable type: C (Continuous), B (binary)...
int m_iVariableNumber
m_iVariableNumber holds the variable number.
bool m_bNonlinearExpressionTreeIndexesProcessed
m_bNonlinearExpressionTreeIndexesProcessed is true if getNonlinearExpressionTreeIndexes() has been ca...
bool IsEqual(MatrixExpression *that)
A function to check for the equality of two objects.
QuadraticCone()
The QuadraticCone class constructor.
bool m_bIndexMapGenerated
Retrieve a map of the indices of the variables that are in the expression tree.
int numberOfVariables
numberOfVariables is the number of variables in the instance
int lbConeIdx
lbConeIdx gives a cone that must contain matrixCon - lbMatrix
int m_iObjectiveNumberNonlinear
m_iObjectiveNumber is the number of objective functions with a nonlinear term.
bool IsEqual(QuadraticCoefficients *that)
A function to check for the equality of two objects.
The in-memory representation of the <instanceData> element.
bool IsEqual(SemidefiniteCone *that)
A function to check for the equality of two objects.
std::map< int, int > getAllNonlinearVariablesIndexMap()
~Objective()
The Objective class destructor.
std::string * getVariableNames()
Get variable names.
int * hessRowIdx
hessRowIdx is an integer array of row indices in the range 0, ..., n - 1.
bool IsEqual(MatrixVar *that)
A function to check for the equality of two objects.
ENUM_NL_EXPR_SHAPE shape
shape holds the shape of the nonlinear expression (linear/quadratic/convex/general) (see further up i...
~OSInstance()
The OSInstance class destructor.
std::map< int, ScalarExpressionTree * > m_mapExpressionTreesMod
m_mapExpressionTreesMod holds a map of expression trees, with the key being the row index and value b...
virtual std::string getConeInXML()
Write a CopositiveMatricesCone object in XML format.
bool m_bProcessConstraints
-—— data items for Constraints -——
The in-memory representation of the <constraints> child of the <stage> element.
int inodeInt
inodeInt is the unique integer assigned to the OSnLNode or OSnLMNode in OSParameters.h.
std::map< int, ScalarExpressionTree * > m_mapExpressionTrees
m_mapExpressionTrees holds a hash map of scalar-valued expression tree pointers.
int getNumberOfNonlinearExpressions()
Get number of nonlinear expressions.
bool IsEqual(DoubleVector *that)
std::vector< double > m_vdX
-—— data vectors for nonlinear optimization -——
int numberOfRows
Every cone has (at least) two dimensions; no distinction is made between vector cones and matrix cone...
int ** m_mmiTimeDomainStageObjList
m_mmiTimeDomainStageObjList holds the list of objectives in each stage.
int * m_miJacNumConTerms
m_miJacNumConTerms holds a int array of the number of constant terms (gradient does not change) for t...
int getNumberOfMatrixExpressionTreeIndexes()
Get the number of unique matrix expression tree indexes.
double lb
lb is the lower bound on the constraint
bool IsEqual(IntersectionCone *that)
A function to check for the equality of two objects.
The in-memory representation of the <constraints> element.
int numberOfObjectives
numberOfObjectives is the number of objective functions in the instance
bool getZeroOrderResults(double *x, double *objLambda, double *conLambda)
Calculate function values.
int startSize
startSize is the dimension of the starts array
double ** m_mmdObjGradient
m_mdObjGradient holds an array of pointers, each pointer points to gradient of one objective function...
int ** m_mmiTimeDomainStageConList
m_mmiTimeDomainStageConList holds the list of constraints in each stage.
int numberOfRows
Every cone has (at least) two dimensions; no distinction is made between vector cones and matrix cone...
NonlinearExpressions()
The NonlinearExpressions class constructor.
std::string * m_msTimeDomainStageNames
m_msTimeDomainStageNames holds the names of the time stages.
int * m_miNonlinearExpressionTreeIndexes
m_miNonlinearExpressionTreeIndexes is an integer pointer to the distinct rows indexes in the nonlinea...
std::vector< double > m_vdLambda
m_vdYval is a vector of Lagrange multipliers
int numberOfObjectives
numberOfObjectives gives the number of objectives contained in this stage
std::map< int, int > m_mapAllNonlinearVariablesIndex
m_mapAllNonlinearVariablesIndexMap is a map of the variables in the Lagrangian function ...
std::string m_sInstanceLicence
m_sInstanceDescription holds the instance fileCreator info.
bool setTimeDomainStages(int number, std::string *names)
This sets the number (and optionally names) of the time stages.
int referenceConeIdx
Polar cones use a reference to another, previously defined cone.
TimeDomainStageVar()
The TimeDomainStageVar class constructor.
int * m_miTimeDomainStageObjectiveNumber
m_miTimeDomainStageObjectiveNumber holds the number of objectives in each stage.
IntVector * start
a pointer to the start of each row or column stored in sparse format
GeneralSparseMatrix * getMatrixCoefficientsInRowMajor()
ProductCone()
The ProductCone class constructor.
double * getObjectiveWeights()
Get objective weights.
int * indexes
indexes holds an integer array of rowIdx (or colIdx) elements in coefMatrix (AMatrix).
double ub
ub is the upper bound on the constraint
~LinearConstraintCoefficients()
The LinearConstraintCoefficients class destructor.
bool setTimeDomainStageConstraintsUnordered(int numberOfStages, int *numberOfConstraints, int **conIndex)
This sets the constraints associated with each time domain stage in srbitrary order.
double * m_mdJacValue
m_mdJacValue holds a double array of partial derivatives for the Jacobian matrix in sparse form (row ...
~MatrixVar()
The MatrixVar class destructor.
virtual std::string getConeName()
int getNumberOfStringVariables()
getNumberOfStringVariables
bool setInstanceName(std::string name)
set the instance name.
The in-memory representation of an intersection cone.
OSInstance()
The OSInstance class constructor.
virtual std::string getConeName()
TimeDomainStages * stages
stages is a pointer to a Stages object
MatrixObjectives * matrixObjectives
a pointer to the matrixObjectives object
int m_iMatrixExpressionNumber
m_iMatrixExpressionNumber holds the number of matrix expressions
double ** getDenseObjectiveCoefficients()
getDenseObjectiveCoefficients.
bool initObjGradients()
This should be called by initForAlgDiff()
OSMatrix ** m_mMatrix
m_mMatrix holds the list of constructors for each matrix.
double OSNaN()
returns the value for NaN used in OS
The in-memory representation of the <nonlinearExpressions> element.
virtual std::string getConeName()
virtual std::string getConeName()
The OSnLNodeNumber Class.
int m_iHighestTaylorCoeffOrder
m_iHighestTaylorCoeffOrder is the order of highest calculated Taylor coefficient
PolyhedralCone()
The PolyhedralCone class constructor.
double normScaleFactor
quadratic cones normally are of the form x0 >= x1^2 + x2^2 + ...
bool IsEqual(MatrixProgramming *that)
A function to check for the equality of two objects.
bool getSecondOrderResults(double *x, double *objLambda, double *conLambda)
Calculate second derivatives.
SparseJacobianMatrix * getJacobianSparsityPattern()
Used to hold part of the instance in memory.
void fint fint fint real fint real real real real real real real real real * e
std::map< int, MatrixExpressionTree * > getAllMatrixExpressionTrees()
double getTimeDomainIntervalStart()
Get the start for the time domain interval.
~CompletelyPositiveMatricesCone()
default destructor.
int * m_miJacStart
m_miJacStart holds a int array of starts for the Jacobian matrix in sparse form (row major)...
bool matrixHasBase(int n)
Several tools to parse the constructor list of a matrix.
int numberOfVariables
numberOfVariables gives the number of variables contained in this stage
bool bObjectivesModified
bObjectivesModified is true if the objective function data has been modified.
CopositiveMatricesCone()
default constructor.
std::string * m_msObjectiveNames
m_msObjectiveNames holds an array of objective names.
int * m_miTimeDomainStageVariableNumber
m_miTimeDomainStageVariableNumber holds the number of variables in each stage.
TimeDomainStage ** stage
stage is pointer to an array of stage object pointers
bool setMatrixNumber(int number)
set the number of matrices
double * m_mdConstraintFunctionValues
m_mdConstraintFunctionValues holds a double array of constraint function values – the size of the arr...
bool IsEqual(MatrixExpressionTree *that)
A function to check for the equality of two objects.
bool IsEqual(ProductCone *that)
A function to check for the equality of two objects.
virtual std::string getConeName()
int getNumberOfNonlinearConstraints()
double normScaleFactor
rotated quadratic cones normally are of the form x0x1 >= x2^2 + x3^2 + ...
a data structure to represent a point of departure for constructing a matrix by modifying parts of a ...
The in-memory representation of the <matrixCon> element.
double * m_mdConstraintLowerBounds
m_mdConstraintLowerBounds holds an array of constraint lower bounds (default = -INF).
int m_iObjectiveNumber
m_iObjectiveNumber is the number of objective functions.
bool setInstanceCreator(std::string fileCreator)
set the instance creator.
double weight
weight is the weight applied to the given objective function, 1.0 by default
bool setConstraintNumber(int number)
set the number of constraints.
std::string name
an optional name to this matrixVar
int valueSize
valueSize is the dimension of the values array
a double vector data structure
bool m_bNonlinearExpressionTreeModIndexesProcessed
m_bNonlinearExpressionTreeModIndexesProcessed is true if getNonlinearExpressionTreeModIndexes has bee...
MatrixObj()
The MatrixVar class constructor.
The in-memory representation of the <obj> element.
bool bDeleteArrays
bDeleteArrays is true if we delete the arrays in garbage collection set to true by default ...
MatrixExpressions()
The MatrixExpressions class constructor.
int * getMatrixExpressionTreeIndexes()
Get all the matrix expression tree indexes, i.e.
A generic class from which we derive both OSnLNode and OSnLMNode.
~InstanceData()
The InstanceData class destructor.
int valueSize
valueSize is the dimension of the indexes and values arrays
Nl ** nl
nl is pointer to an array of Nl object pointers
bool IsEqual(Variables *that)
A function to check for the equality of two objects.
std::string name
an optional name to this MatrixCon
bool IsEqual(DualCone *that)
A function to check for the equality of two objects.
int * indexes
indexes holds an integer array of variable indices.
virtual std::string getConeName()
DoubleVector * value
a pointer to the array of nonzero values being stored
bool bDeleteArrays
bDeleteArrays is true if we delete the arrays in garbage collection set to true by default ...
MatrixProgramming()
The MatrixProgramming class constructor.
std::string * m_msMatrixNames
m_msMatrixNames holds the names of the matrices
double * calculateAllConstraintFunctionValues(double *x, double *objLambda, double *conLambda, bool new_x, int highestOrder)
Calculate all of the constraint function values.
The in-memory representation of the <objectives> element.
int constantMatrixIdx
constantMatrixIdx gives a constant added to the matrixObj
Nl ** getNonlinearExpressions()
Get the pointers to the roots of all expression trees.
double lb
lb corresponds to the optional attribute that holds the variable lower bound.
double horizon
horizon is the end of the planning period in the <interval> element.
std::map< int, MatrixExpressionTree * > m_mapMatrixExpressionTrees
m_mapMatrixExpressionTrees holds a hash map of matrix-valued expression tree pointers.
a sparse matrix data structure
double ** calculateAllObjectiveFunctionGradients(double *x, double *objLambda, double *conLambda, bool new_x, int highestOrder)
Calculate the gradient of all objective functions.
double constant
constant is the constant term added to the objective function, 0 by default
int lbMatrixIdx
lbMatrixIdx gives a lower bound for this matrixVar
int m_iConstraintNumberNonlinear
m_iConstraintNumberNonlinear is the number of constraints that have a nonlinear term.
PolarCone()
The PolarCone class constructor.
char * getConstraintTypes()
Get constraint types.
int numberOfRows
Every cone has (at least) two dimensions; no distinction is made between vector cones and matrix cone...
Variable ** var
Here we define a pointer to an array of var pointers.
std::vector< double > m_vdRangeUnitVec
m_vdRangeUnitVec is a unit vector in the range space
int lbConeIdx
lbConeIdx gives a cone that must contain matrixVar - lbMatrix
int numberOfColumns
numberOfColumns gives the number of columns of this matrix
virtual std::string getConeInXML()
Write a NonpositiveCone object in XML format.
bool IsEqual(Constraint *that)
A function to check for the equality of two objects.
bool IsEqual(Matrices *that)
A function to check for the equality of two objects.
~MatrixCon()
The MatrixCon class destructor.
~ProductCone()
The ProductCone class destructor.
int m_iMatrixVarNumber
-—— data items for matrix programming -——
bool m_bProcessExpressionTreesMod
m_bProcessExpressionTreesMod is true if the modified expression trees have been processed.
int hessDimension
hessDimension is the number of nonzeros in each array.
OSnLNode * createExpressionTreeFromPostfix(std::vector< ExprNode * > nlNodeVec)
Take a vector of ExprNodes (OSnLNodes and OSnLMNodes) in postfix format and create a scalar-valued OS...
bool IsEqual(QuadraticTerm *that)
A function to check for the equality of two objects.
double start
start is the start of the planning period in the <interval> element.
int * varOneIndexes
varOneIndexes holds an integer array of the first variable indexes of all the quadratic terms...
The in-memory representation of the <matrixVariables> element.
double * m_mdVariableUpperBounds
m_mdVariableUpperBounds holds a double array of variable upper bounds (default = INF).
The in-memory representation of a dual cone.
bool IsEqual(PolyhedralCone *that)
A function to check for the equality of two objects.
int m_iNumberOfIntegerVariables
m_iNumberOfIntegerVariables holds the number of integer variables.
SparseMatrix * getLinearConstraintCoefficientsInRowMajor()
Get linear constraint coefficients in row major.
double * ub
For each dimension of the cone, give the upper and lower bounds The upper bound can be only zero or +...
int getNumberOfMatrixObjectives()
Get the number of matrix objectives.
The in-memory representation of a quadratic cone.
double * m_mdObjectiveWeights
m_mdObjectiveWeights holds an array of objective weights (default = 1.0).
The OSnLNodeVariable Class.
MatrixExpressions * matrixExpressions
a pointer to the matrixExpressions object
virtual std::string getConeName()
bool IsEqual(MatrixConstraints *that)
A function to check for the equality of two objects.
Cones()
The Cones class constructor.
virtual std::string getConeInXML()
Write a CompletelyPositiveMatricesCone object in XML format.
GeneralSparseMatrix * getMatrixCoefficientsInColumnMajor()
double value
value is the value of the objective function coefficient corresponding to the variable with index idx...
The in-memory representation of the <quadraticCoefficients> element.
SparseVector * calculateConstraintFunctionGradient(double *x, double *objLambda, double *conLambda, int idx, bool new_x, int highestOrder)
Calculate the gradient of the constraint function indexed by idx.
The in-memory representation of the <stages> element.
SparseHessianMatrix * getLagrangianHessianSparsityPattern()
bool setObjectiveNumber(int number)
set the number of objectives.
bool createOSADFun(std::vector< double > vdX)
Create the a CppAD Function object: this is a function where the domain is the set of variables for t...
bool m_bAllNonlinearVariablesIndex
m_bAllNonlinearVariablesIndexMap is true if the map of the variables in the Lagrangian function has b...
bool setNonlinearExpressions(int nexpr, Nl **root)
set nonlinear expressions
int idxOne
idxOne is the index of the first variable in the quadratic term
Objective()
The Objective class constructor.
bool setTimeDomainStageObjectivesUnordered(int numberOfStages, int *numberOfObjectives, int **varIndex)
This sets the objectives associated with each time domain stage in arbitrary order.
GeneralSparseMatrix * getMatrixCoefficientsInColumnMajor(int n)
Get the (nonzero) elements of the matrix in column major form.
SparseVector ** m_mObjectiveCoefficients
m_mObjectiveCoefficients holds an array of objective coefficients, one set of objective coefficients ...
bool m_bQuadraticRowIndexesProcessed
m_bQuadraticRowIndexesProcessed is true if getQuadraticRowIndexes() has been called.
int numberOfValues
numberOfValues is the number of nonzero elements stored in the <linearConstraintCoefficients> element...
bool addConstraint(int index, std::string name, double lowerBound, double upperBound, double constant)
add a constraint.
Constraints()
The Constraints class constructor.
MatrixObj ** matrixObj
matrixObj is an array of pointers to the <matrixObj> children
TimeDomainStageCon()
The TimeDomainStageCon class constructor.
bool addObjective(int index, std::string name, std::string maxOrMin, double constant, double weight, SparseVector *objectiveCoefficients)
add an objective.
int ubMatrixIdx
ubMatrixIdx gives an upper bound for this matrixCon
bool IsEqual(ScalarExpressionTree *that)
A function to check for the equality of two objects.
int * m_miNonLinearVarsReverseMap
m_miNonLinearVarsReverseMap maps the nonlinear variable number back into the original variable space ...
int firstAxisDirection
The indices of the first two component can be changed Since there are possibly many dimensions...
int m_iNumberOfTimeStages
m_iNumberOfTimeStages holds the number of discrete stages
virtual std::string getConeInXML()
Write a QuadraticCone object in XML format.
~Matrices()
The Matrices class destructor.
bool setTimeDomain(std::string format)
This sets the format of the time domain ("stages"/"interval"/"none")
std::string * getObjectiveMaxOrMins()
Get objective maxOrMins.
bool setTimeDomainStageConstraintsOrdered(int numberOfStages, int *numberOfConstraints, int *startIdx)
This sets the constraints associated with each time domain stage in temporal order.
double value
value is the value of the number
double ub
ub corresponds to the optional attribute that holds the variable upper bound.
int * m_miNumberOfObjCoef
m_miNumberOfObjCoef holds an integer array of number of objective coefficients (default = 0)...
int idx
idx gives the index of this constraint
a sparse vector data structure
double * hessValues
hessValues is a double array of the Hessian values.
Variables * variables
variables is a pointer to a Variables object
TimeDomainStage()
The TimeDomainStage class constructor.
~NonnegativeCone()
default destructor.
virtual std::string getConeInXML()=0
Write a Cone object in XML format.
ScalarExpressionTree * m_LagrangianExpTree
m_LagrangianExpTree is an ScalarExpressionTree object that is the expression tree for the Lagrangian ...
MatrixVariables * matrixVariables
a pointer to the matrixVariables object
ScalarExpressionTree * getLagrangianExpTree()
SparseMatrix * getLinearConstraintCoefficientsInColumnMajor()
Get linear constraint coefficients in column major.
OSnLNode ** m_mChildren
m_mChildren holds all the operands, that is, nodes that the current node operates on...
MatrixExpressionTree * getMatrixExpressionTree(int rowIdx)
Get the matrix expression tree for a given row index.
int getTimeDomainStageNumber()
Get the number of stages that make up the time domain.
The in-memory representation of the <timeDomain> element.
bool IsEqual(MatrixCon *that)
A function to check for the equality of two objects.
int getMatrixNumber()
Get the number of matrices.
The in-memory representation of the <con> element.
virtual std::string getConeInXML()
Write an OrthantCone object in XML format.
void fint fint fint real fint real real real real real real real * r
int m_iLinearConstraintCoefficientNumber
m_iLinearConstraintCoefficientNumber holds the number of specified (usually nonzero) linear constrain...
bool setVariables(int number, std::string *names, double *lowerBounds, double *upperBounds, char *types)
set all the variable related elements.
~QuadraticCoefficients()
The QuadraticCoefficients class destructor.
NonpositiveCone()
default constructor.
double * values
values holds a double array of value elements in coefMatrix (AMatrix), which contains nonzero element...
int templateMatrixIdx
templateMatrixIdx refers to a matrix that describes the locations in this matrixVar that are allowed ...
~DualCone()
The DualCone class destructor.
double * getConstraintConstants()
Get constraint constants.
GeneralFileHeader * instanceHeader
the instanceHeader is implemented as a general file header object to allow sharing of classes between...
MatrixExpressionTree * matrixExpressionTree
matrixExpressionTree contains the root of the MatrixExpressionTree
The in-memory representation of the <matrixObjectives> element.
IntersectionCone()
The IntersectionCone class constructor.
double * getObjectiveConstants()
Get objective constants.
int numberOfConstraints
numberOfConstraints is the number of constraints in the instance
SemidefiniteCone()
The SemidefiniteCone class constructor.
OSnLNode * m_treeRoot
m_treeRoot holds the root node (of OSnLNode type) of the expression tree.
~TimeDomainStageObj()
The TimeDomainStageObj class destructor.
MatrixObjectives()
The MatrixObjectives class constructor.
int m_iHighestOrderEvaluated
m_iHighestOrderEvaluated is the highest order derivative of the current iterate
int varReferenceMatrixIdx
varReferenceMatrixIdx allows some or all of the components of this matrix variable to be copied from ...
int startIdx
startdIdx gives the number of the first variable contained in this stage
a sparse Jacobian matrix data structure
bool bDeleteArrays
bDeleteArrays is true if we delete the arrays in garbage collection set to true by default ...
std::string getInstanceName()
Get instance name.
bool m_bProcessVariables
-—— data items for Variables -——
int numberOfRows
numberOfRows gives the number of rows of this matrix
int getADSparsityHessian()
end revised AD code
InstanceData * instanceData
A pointer to an InstanceData object.
int m_iQuadraticTermNumber
m_iQuadraticTermNumber holds the number of specified (usually nonzero) qTerms in the quadratic coeffi...
int numberOfRows
Every cone has (at least) two dimensions; no distinction is made between vector cones and matrix cone...
Matrices()
The Matrices class constructor.
virtual std::string getConeInXML()
Write a PolyhedralCone object in XML format.
DualCone()
The DualCone class constructor.
std::vector< ExprNode * > getPrefixFromExpressionTree()
Get a vector of pointers to OSnLNodes and OSnLMNodes that correspond to the (matrix-valued) expressio...
int startIdx
startdIdx gives the number of the first constraint contained in this stage
bool addQTermsToExressionTree()
OSnLMNode * m_treeRoot
m_treeRoot holds the root node (of OSnLMNode type) of the expression tree.
The in-memory representation of the <nl> element.
int ** getTimeDomainStageConList()
Get the list of constraints in each stage.
int m_iNumberOfSemiIntegerVariables
m_iNumberOfSemiIntegerVariables holds the number of semi-integer variables.
bool matrixHasElements(int n)
virtual std::string getConeName()
int * m_miMatrixNumberOfRows
m_miMatrixNumberOfRows holds the number of rows for each matrix.
int m_iNumberOfSemiContinuousVariables
m_iNumberOfSemiContinuousVariables holds the number of semi-continuous variables. ...
an integer Vector data structure
static Bigint * mult(Bigint *a, Bigint *b)
MatrixVariables()
The MatrixVariables class constructor.
int idx
idx holds the row index of the nonlinear expression
std::vector< double > m_vdYval
m_vdYval is a vector of function values
int number
number is the number of elements in the indexes and values arrays.
bool processVariables()
process variables.
char * m_mcConstraintTypes
m_mcConstraintTypes holds a char array of constraint types (R for range; L for <=; G for >=; E for =;...
~MatrixConstraints()
The MatrixConstraints class destructor.
std::string * getObjectiveNames()
Get objective names.
int * starts
starts holds an integer array of start elements, each start element points to the start of partials f...
double ** m_mmdDenseObjectiveCoefficients
m_mmdDenseObjectiveCoefficients holds an array of pointers, each pointer points to a vector of dense ...
int m_iNonlinearExpressionNumber
m_iNonlinearExpressionNumber holds the number of nonlinear expressions.
int getConstraintNumber()
Get number of constraints.
Objective ** obj
coef is pointer to an array of ObjCoef object pointers
bool getLinearConstraintCoefficientMajor()
Get whether the constraint coefficients is in column major (true) or row major (false).
int startIdx
startdIdx gives the number of the first objective contained in this stage
int axisDirection
The index of the first component can be changed Since there are possibly many dimensions, the index is coded as i0*n1*n2*...
double getTimeDomainIntervalHorizon()
Get the horizon for the time domain interval.
bool setInstanceSource(std::string source)
set the instance source.
Matrices * matrices
matrices is a pointer to a Matrices object
bool IsEqual(Variable *that)
A function to check for the equality of two objects.
double * m_mdVariableLowerBounds
m_mdVariableLowerBounds holds a double array of variable lower bounds (default = 0.0).
~MatrixExpression()
The MatrixExpression class destructor.
int getNumberOfQuadraticRowIndexes()
Get the number of rows which have a quadratic term.
std::string * getTimeDomainStageNames()
Get the names of the stages (NULL or empty string ("") if a stage has not been given a name...
std::string semidefiniteness
we need to distinguish positive and negative semidefiniteness
bool setInstanceDescription(std::string description)
set the instance description.
bool IsEqual(IntVector *that)
A method to compare two invectors.
The CompletelyPositiveMatricesCone Class.
ENUM_MATRIX_TYPE mergeMatrixType(ENUM_MATRIX_TYPE type1, ENUM_MATRIX_TYPE type2)
A function to merge two matrix types so we can infer the type of a matrix recursively.
bool IsEqual(LinearConstraintCoefficients *that)
A function to check for the equality of two objects.
double coef
coef is the coefficient of the quadratic term
int numberOfColumns
numberOfColumns gives the number of columns of this matrix
int getNumberOfQuadraticTerms()
Get the number of specified (usually nonzero) qTerms in the quadratic coefficients.
bool OSIsEqual(double x, double y)
~TimeDomainStageVar()
The TimeDomainStageVar class destructor.
bool IsEqual(Cone *that)
A function to check for the equality of two objects.
int * m_miTimeDomainStageConstraintNumber
m_miTimeDomainStageConstraintNumber holds the number of constraints in each stage.
bool m_bDeleteExpressionTree
m_bDeleteExpressionTree is true, if in garbage collection, we should delete the osExpression tree obj...
TimeDomainStageConstraints * constraints
constraints is a pointer to a TimeDomainConstraints object
The CopositiveMatricesCone Class.
The in-memory representation of the <variables> child of the <stage> element.
int templateMatrixIdx
templateMatrixIdx refers to a matrix that describes the locations in this matrixObj that are allowed ...
QuadraticTerms * m_quadraticTerms
m_quadraticTerms holds the data structure for all the quadratic terms in the instance.
int getNumberOfMatrixExpressions()
Get the number of matrix-valued expressions.
The in-memory representation of a cone of semidefinite matrices.
NonnegativeCone()
default constructor.
int ubMatrixIdx
ubMatrixIdx gives an upper bound for this matrixVar
Objectives * objectives
objectives is a pointer to a Objectives object
TimeDomainStageVar ** var
var is a pointer to an array of TimeDomainStageVar object pointers
~CopositiveMatricesCone()
default destructor.
~QuadraticTerm()
The QuadraticTerm class destructor.
The in-memory representation of the <stage> element.
The in-memory representation of a polar cone.
The in-memory representation of the <matrixVar> element.
std::vector< ExprNode * > getNonlinearExpressionTreeInPrefix(int rowIdx)
Get the prefix tokens for a given row index.
std::string getInstanceSource()
Get instance source.
int m_iMatrixObjNumber
m_iMatrixObjNumber holds the number of matrix objectives
int getNumberOfTransformationConstructors(int n)
bool initForAlgDiff()
This should be called by nonlinear solvers using callback functions.
int ** getTimeDomainStageObjList()
Get the list of objectives in each stage.
The in-memory representation of the <cones> element.
std::map< int, ScalarExpressionTree * > getAllNonlinearExpressionTrees()
int * rowIndexes
rowIndexes holds an integer array of row indexes of all the quadratic terms.
std::string os_dtoa_format(double x)
bool IsEqual(QuadraticCone *that)
A function to check for the equality of two objects.
ScalarExpressionTree * osExpressionTree
osExpressionTree contains the root of the ScalarExpressionTree
std::vector< ExprNode * > getMatrixExpressionTreeInPrefix(int rowIdx)
Get the prefix tokens for a given row index.
MatrixProgramming * matrixProgramming
matrixProgramming is a pointer to a MatrixProgramming object
int * starts
starts holds an integer array of start elements in coefMatrix (AMatrix), which points to the start of...
TimeDomainStageVariables()
The TimeDomainStageVariables class constructor.
double * values
values holds a double array of nonzero values.
~PolarCone()
The PolarCone class destructor.
int * m_miQuadRowIndexes
m_miQuadRowIndexes is an integer pointer to the distinct row indexes with a quadratic term...
bool IsEqual(PolarCone *that)
A function to check for the equality of two objects.
double * calculateAllObjectiveFunctionValues(double *x, double *objLambda, double *conLambda, bool new_x, int highestOrder)
Calculate all of the objective function values.
int getNumberOfTransformationConstructors()
QuadraticTerms * getQuadraticTerms()
Get all the quadratic terms in the instance.
int m_iNumberOfNonlinearExpressionTreeModIndexes
m_iNumberOfNonlinearExpressionTreeModIndexes holds the number of distinct rows and objectives with no...
bool bVariablesModified
bVariablesModified is true if the variables data has been modified.
IntVector * components
the list of components contributing to the intersection each component contains a reference to a prev...
Cones * cones
cones is a pointer to a Cones object
virtual std::string getConeName()
double * getVariableUpperBounds()
Get variable upper bounds.
bool addMatrix(int index, std::string name, int numberOfRows, int numberOfColumns, ENUM_MATRIX_SYMMETRY symmetry, ENUM_MATRIX_TYPE matrixType, unsigned int inumberOfChildren, MatrixNode **m_mChildren)
add a matrix.
int ** getTimeDomainStageVarList()
Get the list of variables in each stage.
The in-memory representation of the <matrixConstraints> element.
bool m_bColumnMajor
m_bColumnMajor holds whether the linear constraint coefficients are stored in column major (if m_bCol...
The OSnLNodeProduct Class.
bool IsEqual(InstanceData *that)
A function to check for the equality of two objects.
bool matrixHasTransformations()
The in-memory representation of the <objectives> child of the <stage> element.
std::vector< double > reverseAD(int p, std::vector< double > vdlambda)
Perform an AD reverse sweep.
virtual ENUM_MATRIX_TYPE getMatrixType()
bool copyLinearConstraintCoefficients(int numberOfValues, bool isColumnMajor, double *values, int valuesBegin, int valuesEnd, int *indexes, int indexesBegin, int indexesEnd, int *starts, int startsBegin, int startsEnd)
copy linear constraint coefficients: perform a deep copy of the sparse matrix
RotatedQuadraticCone()
The RotatedQuadraticCone class constructor.
int numberOfNonlinearExpressions
numberOfNonlinearExpressions is the number of <nl> elements in the <nonlinearExpressions> element...
int numberOfObjCoef
numberOfObjCoef is the number of variables with a nonzero objective function coefficient ...
std::string m_sTimeDomainFormat
m_sTimeDomainFormat holds the format ("stages"/"interval") of the time domain.
bool setNumberOfQuadraticTerms(int nq)
set the number of quadratic terms
std::vector< bool > m_vbLagHessNonz
m_vbLagHessNonz is a boolean vector holding the nonzero pattern of the Lagrangian of the Hessian ...
int numberOfQuadraticTerms
numberOfQuadraticTerms is the number of quadratic terms in the <quadraticCoefficients> element...
int * indexes
indexes holds an integer array of indexes whose corresponding values are nonzero. ...
int m_iNumberOfQuadraticRowIndexes
-—— data items for quadratic coefficients -——
int numberOfMatrices
numberOfMatrices is the number of <nl> elements in the <matrices> element.
int idx
idx holds the row index of the nonlinear expression
TimeDomainInterval * interval
interval is a pointer to an Interval object
~Constraint()
The Constraint class destructor.
Cone ** cone
cone is pointer to an array of Cone object pointers
~TimeDomain()
The TimeDomain class destructor.
virtual std::string getConeName()
Objectives()
The Objectives class constructor.
~IntersectionCone()
The IntersectionCone class destructor.
bool bDeleteArrays
bDeleteArrays is true if we delete the arrays in garbage collection set to true by default ...
ENUM_MATRIX_CONSTRUCTOR_TYPE nType
nType is a unique integer assigned to each type of matrix node (see OSParameters.h) ...
~RotatedQuadraticCone()
The RotatedQuadraticCone class destructor.
bool getSparseJacobianFromRowMajor()
int * m_miMatrixNumberOfColumns
m_miMatrixNumberOfColumns holds the number of columns for each matrix.
bool m_bOSADFunIsCreated
m_bOSADFunIsCreated is true if we have created the OSInstanc OSAD Function
bool m_bNonLinearStructuresInitialized
m_bNonLinearStructuresInitialized is true if initializeNonLinearStructures() has been called...
int getNumberOfBlocksConstructors(int n)
std::string * m_msConstraintNames
m_msConstraintNames holds an array of constraint names.
std::string getInstanceCreator()
Get instance fileCreator.
std::string getInstanceLicence()
Get instance licence.
int conReferenceMatrixIdx
conReferenceMatrixIdx allows some or all of the components of this matrixCon to be copied from constr...
TimeDomainStages()
The Stages class constructor.
int referenceConeIdx
Dual cones use a reference to another, previously defined cone.
std::vector< ExprNode * > getNonlinearExpressionTreeModInPostfix(int rowIdx)
Get the postfix tokens for a given row index for the modified Expression Tree (quadratic terms added)...
TimeDomainStageObjectives * objectives
objectives is a pointer to a TimeDomainObjectives object
bool setVariableNumber(int number)
set the number of variables.
The in-memory representation of an OSiL instance..
std::vector< ExprNode * > getPostfixFromExpressionTree()
Get a vector of pointers to ExprNodes that correspond to the expression tree in postfix format...
int ubConeIdx
ubConeIdx gives a cone that must contain ubMatrix - matrixVar
std::string getNonlinearExpressionTreeInInfix(int rowIdx)
Get the infix representation for a given row (or objective function) index.
~TimeDomainStages()
The Stages class destructor.
SparseMatrix * m_linearConstraintCoefficientsInColumnMajor
m_linearConstraintCoefficientsInColumnMajor holds the standard three-array data structure for linear ...
The in-memory representation of the variables element.
bool m_bQTermsAdded
m_bQTermsAdded is true if we added the quadratic terms to the expression tree
The OSnLNode Class for nonlinear expressions.
int * conVals
conVals holds an integer array of integers, conVals[i] is the number of constant terms in the gradien...
bool processObjectives()
process objectives.
~OrthantCone()
default destructor.
TimeDomainStageObj()
The TimeDomainStageObj class constructor.
QuadraticCoefficients * quadraticCoefficients
quadraticCoefficients is a pointer to a QuadraticCoefficients object
~TimeDomainStage()
The TimeDomainStage class destructor.
int * m_miJacIndex
m_miJacIndex holds a int array of variable indices for the Jacobian matrix in sparse form (row major)...
virtual std::string getTokenName()=0
int idx
idx is the index of the variable corresponding to the coefficient
int getNumberOfMatrixConstraints()
Get the number of matrix constraints.
~NonlinearExpressions()
The NonlinearExpressions class destructor.
double * coefficients
coefficients holds a double array all the quadratic term coefficients.
OSMatrix ** matrix
matrix is a pointer to an array of OSMatrix object pointers
char varType
an optional variable type (C, B, I, D, J, S).
Constraint()
The Constraint class constructor.
int numberOfStages
numberOfStages is the number of stages in the <stages> element.
int idx
idx is the index of the row in which the quadratic term appears
double * m_mdObjectiveFunctionValues
m_mdObjectiveFunctionValues holds a double array of objective function values – the size of the array...
bool setConstraints(int number, std::string *names, double *lowerBounds, double *upperBounds, double *constants)
set all the constraint related elements.
bool setTimeDomainInterval(double start, double horizon)
This sets the start and end of the time interval.
std::string m_sInstanceName
-—— data items for InstanceHeader -——
int * varTwoIndexes
varTwoIndexes holds an integer array of the second variable indexes of all the quadratic terms...
std::vector< ExprNode * > getMatrixExpressionTreeModInPostfix(int rowIdx)
Get the postfix tokens for a given row index for the modified Expression Tree (quadratic terms added)...
int * getTimeDomainStageNumberOfObjectives()
Get the number of objectives contained in each time stage.
The in-memory representation of a SparseHessianMatrix..
char * m_mcVariableTypes
m_mcVariableTypes holds a char array of variable types (default = 'C').
int m_iNumberOfBinaryVariables
m_iNumberOfBinaryVariables holds the number of binary variables.
The in-memory representation of a product cone.
std::string * getConstraintNames()
Get constraint names.
bool IsEqual(MatrixObj *that)
A function to check for the equality of two objects.
std::vector< double > m_vdYjacval
m_vdYval is a vector equal to a column or row of the Jacobian
bool m_bGetDenseObjectives
m_bGetDenseObjectives holds whether the dense objective functions are processed.
bool setInstanceLicence(std::string licence)
set the instance licence.
int m_iNumberOfNonlinearExpressionTreeIndexes
-—— data items for nonlinear expressions -——
bool initializeNonLinearStructures()
Initialize the data structures for the nonlinear API.
int * getObjectiveCoefficientNumbers()
Get objective coefficient number.
std::string m_sInstanceCreator
m_sInstanceSource holds the instance source.
bool addCone(int index, int numberOfRows, int numberOfColumns, ENUM_CONE_TYPE coneType, std::string name, int numberOfOtherIndexes=0, int *otherIndexes=NULL)
add a cone.
used for throwing exceptions.
virtual std::vector< ExprNode * > getPrefixFromExpressionTree()
Get a vector of pointers to OSnLNodes and OSnLMNodes that correspond to the (scalar-valued or matrix-...
int m_iMatrixNumber
m_iMatrixNumber holds the number of matrices
~Objectives()
The Objectives class destructor.
bool matrixHasTransformations(int n)
std::map< int, int > * mapVarIdx
m_mapVarIdx is a map used to generate the infix expression for AD the key is idx, a variable number; ...
Used to hold the instance in memory.
int getNumberOfSemiIntegerVariables()
getNumberOfSemiIntegerVariables
LinearConstraintCoefficients * linearConstraintCoefficients
linearConstraintCoefficients is a pointer to a LinearConstraintCoefficients object ...
virtual std::string getConeInXML()
Write a RotatedQuadraticCone object in XML format.
bool IsEqual(MatrixObjectives *that)
A function to check for the equality of two objects.
~NonpositiveCone()
default destructor.
ENUM_MATRIX_SYMMETRY symmetry
To track the type of symmetry present in the matrix or block.
int numberOfRows
numberOfRows gives the number of rows of this matrix
int * m_miNonlinearExpressionTreeModIndexes
m_miNonlinearExpressionTreeModIndexes is an integer pointer to the distinct rows indexes in the modif...
int numberOfCones
numberOfCones is the number of <nl> elements in the <cones> element.
std::map< int, int > m_mapOSADFunRangeIndex
m_mapOSADFunRangeIndex is an inverse of the previous map.
The in-memory representation of the <qTerm> element.
The in-memory representation of the <expr> element, which is like a nonlinear expression, but since it involves matrices, the expression could be linear, so a "shape" attribute is added to distinguish linear and nonlinear expressions.
a data structure to represent a matrix object (derived from MatrixType)
MatrixConstraints()
The MatrixConstraints class constructor.
int getNumberOfBlocksConstructors()
~MatrixExpressions()
The MatrixExpressions class destructor.
int numberOfOtherIndexes
Cones can also be formed by Multidimensional tensors.
unsigned int m_iNumberOfNonlinearVariables
m_iNumberOfNonlinearVariables is the number of variables that appear in a nonlinear expression...
double constant
constant is a value that is added to the constraint
std::vector< double > forwardAD(int p, std::vector< double > vdX)
Perform an AD forward sweep.
The in-memory representation of the variable element.
SparseMatrix * m_linearConstraintCoefficientsInRowMajor
m_linearConstraintCoefficientsInRowMajor holds the standard three-array data structure for linear con...
virtual std::string getConeName()
bool m_bLagrangianExpTreeCreated
m_bLagrangianHessionCreated is true if a Lagrangian function for the Hessian has been created ...
int * getQuadraticRowIndexes()
Get the indexes of rows which have a quadratic term.
The NonnegativeCone Class.
int iNumberOfStartElements
iNumberOfStartElements counts the number of elements in the <start> section of <linearConstraintCoeff...
bool processLinearConstraintCoefficients()
process linear constraint coefficients.
int templateMatrixIdx
templateMatrixIdx refers to a matrix that describes the locations in this matrixVar that are allowed ...
SparseJacobianMatrix * m_sparseJacMatrix
m_sparseJacMatrix is the Jacobian matrix stored in sparse matrix format
~Variable()
The Variable class destructor.
int objReferenceMatrixIdx
objReferenceMatrixIdx allows some or all of the components of this matrixObj to be copied from object...
virtual std::string getConeInXML()
Write a ProductCone object in XML format.
int getNumberOfBinaryVariables()
getNumberOfBinaryVariables
std::string getInstanceDescription()
Get instance description.
double * calculateObjectiveFunctionGradient(double *x, double *objLambda, double *conLambda, int objIdx, bool new_x, int highestOrder)
Calculate the gradient of the objective function indexed by objIdx.
std::map< int, ScalarExpressionTree * > getAllNonlinearExpressionTreesMod()
MatrixExpression()
The MatrixExpression class constructor.
void fint fint fint real fint real * x
The in-memory representation of the <con> element.
int getNumberOfNonlinearExpressionTreeIndexes()
Get the number of unique nonlinear expression tree indexes.
bool m_bDeleteExpressionTree
if m_bDeleteExpressionTree is true during garbage collection, we should delete the osExpression tree ...
std::string name
name is the name of the constraint
int lbMatrixIdx
lbMatrixIdx gives a lower bound for this matrixCon
int getNumberOfNonlinearObjectives()
std::string getTimeDomainFormat()
Get the format of the time domain ("stages"/"interval")
std::map< int, MatrixExpressionTree * > getAllMatrixExpressionTreesMod()
std::vector< ExprNode * > getMatrixExpressionTreeInPostfix(int rowIdx)
Get the postfix tokens for a given row index.
bool m_binitForAlgDiff
-—— data items for automatic differentiation -——
QuadraticTerm()
The QuadraticTerm class constructor.
The in-memory representation of the <matrixExpressions> element.
~MatrixProgramming()
The MatrixProgramming class destructor.
bool processMatrices()
process matrices.
The NonpositiveCone Class.
std::vector< ExprNode * > getNonlinearExpressionTreeInPostfix(int rowIdx)
Get the postfix tokens for a given row index.