22#include "OSInstance.h"
28#include "OSParameters.h"
31#include "CoinTime.hpp"
42# error "don't have header file for time"
48using std::ostringstream;
55 "inside CsdpSolver constructor\n");
87 std::ostringstream outStr;
95 int* blockOffset = NULL;
96 int* blockSize = NULL;
103 clock_t start, finish;
112 duration = (double) (finish - start) / CLOCKS_PER_SEC;
120 throw ErrorClass(
"There must be one matrixVar object");
122 throw ErrorClass(
"There must be one nonlinear expression for each constraint and objective");
124 throw ErrorClass(
"Additional linear constraint coefficients are not supported");
126 throw ErrorClass(
"Additional quadratic terms are not supported");
130 if (cType[i] !=
'E')
throw ErrorClass(
"Only equality constraints are supported");
133 if (oType[0] !=
"max")
throw ErrorClass(
"The problem must be of \"max\" type");
137 if (tempTree == NULL)
throw ErrorClass(
"Expecting matrixTrace in objective row");
140 throw ErrorClass(
"Expecting matrixTrace in objective row");
143 throw ErrorClass(
"Unsupported expression in objective row");
147 throw ErrorClass(
"Unsupported expression in objective row");
154 throw ErrorClass(
"<matrices> section was never defined");
158 if (tempMtx == NULL)
throw ErrorClass(
"A0 matrix was never defined");
160 throw ErrorClass(
"A0 matrix must be square and symmetric");
162 throw ErrorClass(
"A0 matrix must be of type \"constant\"");
171 int* tempColumnOffsets;
172 int tempNColumnBlocks;
174 int i0, itemp, imerge;
180 if (tempTree == NULL)
throw ErrorClass(
"Expecting matrixTrace in constraint row");
183 throw ErrorClass(
"Expecting matrixTrace in constraint row");
186 throw ErrorClass(
"Unsupported expression in constraint row");
190 throw ErrorClass(
"Unsupported expression in constraint row");
197 if (tempMtx == NULL)
throw ErrorClass(
"Matrix in constraint was never defined");
199 throw ErrorClass(
"Constraint matrix must be square and symmetric");
201 throw ErrorClass(
"Constraint matrix must be of type \"constant\"");
214 if (rowOffsets[i0] == tempRowOffsets[itemp])
216 if (imerge != i0) rowOffsets[imerge] = rowOffsets[i0];
223 if (rowOffsets[i0] < tempRowOffsets[itemp])
228 if (i0 >= nRowBlocks || itemp >= tempNRowBlocks)
239 if (columnOffsets[i0] == tempColumnOffsets[itemp])
241 if (imerge != i0) columnOffsets[imerge] = columnOffsets[i0];
248 if (columnOffsets[i0] < tempColumnOffsets[itemp])
253 if (i0 >= nColumnBlocks || itemp >= tempNColumnBlocks)
256 nColumnBlocks = imerge;
259 blockOffset =
new int[nRowBlocks];
268 if (rowOffsets[jrow] == columnOffsets[jcol])
270 blockOffset[nBlocks] = rowOffsets[jrow];
277 if (rowOffsets[jrow] < columnOffsets[jcol])
282 if (jrow >= nRowBlocks || jcol >= nColumnBlocks)
289 blockSize =
new int[nBlocks];
290 for (
int i=1; i < nBlocks; i++)
293 if (blockOffset[i] - blockOffset[i-1] >= USHRT_MAX)
294 throw ErrorClass(
"This problem is too large to be solved by this version of the code!\n"
295 +
"Recompile without -DUSERSHORTINDS to fix the problem.\n");
297 blockSize[i] = blockOffset[i] - blockOffset[i-1];
300 nC_rows = blockOffset[nBlocks-1];
306 if (
ncon >= USHRT_MAX)
307 throw ErrorClass(
"This problem is too large to be solved by this version of the code!\n"
308 +
"Recompile without -DUSERSHORTINDS to fix the problem.\n");
310 if (nBlocks >= USHRT_MAX)
311 throw ErrorClass(
"This problem is too large to be solved by this version of the code!\n"
312 +
"Recompile without -DUSERSHORTINDS to fix the problem.\n");
322 throw ErrorClass(
"This problem is too large to be solved in 32 bit mode!\n");
334 isdiag =
new bool[nBlocks];
335 for (
int i=1; i<nBlocks; i++)
338 for (
int j=0; j <
ncon+1; j++)
341 ->
getBlocks(blockOffset,nBlocks,blockOffset,nBlocks,
false,
true);
343 if (!mtxBlocks[j]->isBlockDiagonal())
344 throw ErrorClass(
"Constraint matrix must be block-diagonal");
346 for (
int i=0; i<nBlocks-1; i++)
348 tmpBlock = mtxBlocks[j]->
getBlock(i,i);
349 if (tmpBlock != NULL && !(tmpBlock->
isDiagonal()))
356 C_matrix.blocks =
new blockrec[nBlocks];
359 for (
int blk=1; blk < nBlocks; blk++)
361 tmpBlock = mtxBlocks[0]->
getBlock(blk-1,blk-1);
362 int blksz = blockSize[blk];
363 if (isdiag[blk] == 1)
366 C_matrix.blocks[blk].blocksize = blksz;
367 C_matrix.blocks[blk].blockcategory = DIAG;
368 C_matrix.blocks[blk].data.vec =
new double[blksz+1];
370 for (
int i=1; i<=blksz; i++)
371 C_matrix.blocks[blk].data.vec[i] = 0.0;
373 if (tmpBlock != NULL)
375 for (
int i=0; i < tmpBlock->
valueSize; i++)
383 C_matrix.blocks[blk].blocksize = blksz;
384 C_matrix.blocks[blk].blockcategory = MATRIX;
385 C_matrix.blocks[blk].data.mat =
new double[blksz*blksz];
387 for (
int i=1; i<=blksz; i++)
388 for (
int j=1; j<=blksz; j++)
389 C_matrix.blocks[blk].data.mat[ijtok(i,j,blksz)] = 0.0;
391 if (tmpBlock != NULL)
393 for (
int i=1; i < tmpBlock->
startSize; i++)
394 for (
int j=tmpBlock->
start[i-1]; j<tmpBlock->
start[i]; j++)
396 C_matrix.blocks[blk].data.mat[ijtok(i,tmpBlock->
index[j]+1,blksz)]
398 C_matrix.blocks[blk].data.mat[ijtok(tmpBlock->
index[j]+1,i,blksz)]
409 for (
int i=1; i<=
ncon; i++)
414 struct sparseblock *p;
415 struct sparseblock *q;
416 struct sparseblock *prev;
422 for (
int i=1; i<=
ncon; i++)
425 for (
int blk=1; blk < nBlocks; blk++)
427 tmpBlock = mtxBlocks[i]->
getBlock(blk-1,blk-1);
428 if (tmpBlock != NULL && tmpBlock->
valueSize > 0)
434 p =
new sparseblock();
436 p->entries =
new double[p->numentries+1];
438 p->iindices =
new int[p->numentries+1];
439 p->jindices =
new int[p->numentries+1];
441 p->iindices =
new unsigned short[p->numentries+1];
442 p->jindices =
new unsigned short[p->numentries+1];
445 p->blocksize = blockSize[blk];
446 p->constraintnum = i;
448 p->nextbyblock = NULL;
449 if (((p->numentries) > 0.25*(p->blocksize)) && ((p->numentries) > 15))
455 for (
int icol=1; icol < tmpBlock->
startSize; icol++)
456 for (
int jent=tmpBlock->
start[icol-1]; jent<tmpBlock->
start[icol]; jent++)
458 p->iindices[jent+1] = icol;
459 p->jindices[jent+1] = tmpBlock->
index[jent] + 1;
470 prev->nextbyblock = p;
478 if (blockOffset != NULL)
delete [] blockOffset;
479 if (blockSize != NULL)
delete [] blockSize;
480 if (mtxRef != NULL)
delete [] mtxRef;
481 if (isdiag != NULL)
delete [] isdiag;
482 if (mtxBlocks != NULL)
484 for (
int i=0; i <
ncon+1; i++)
486 if (mtxBlocks[i] != NULL)
delete mtxBlocks[i];
498 if (blockOffset != NULL)
delete [] blockOffset;
499 if (blockSize != NULL)
delete [] blockSize;
500 if (mtxRef != NULL)
delete [] mtxRef;
501 if (isdiag != NULL)
delete [] isdiag;
502 if (mtxBlocks != NULL)
504 for (
int i=0; i <=
ncon; i++)
506 if (mtxBlocks[i] != NULL)
delete mtxBlocks[i];
534 struct paramstruc params;
536 std::ostringstream outStr;
537 std::ostringstream optStr;
554 outStr <<
"number of solver options ";
560 std::vector<SolverOption*> optionsVector;
564 int num_ipopt_options = optionsVector.size();
565 for(i = 0; i < num_ipopt_options; i++)
570 outStr <<
"csdp solver option ";
571 outStr << optionsVector[ i]->name;
575 optStr << optionsVector[ i]->name <<
"=" << optionsVector[ i]->value << std::endl;
579 paramfile=fopen(
"param.csdp",
"w");
581 throw ErrorClass(
"File open error during option initialization");
583 fprintf(paramfile,
"%s",(optStr.str()).c_str());
592 "Error in setSolverOption\n");
602void CsdpSolver::setInitialValues()
604 std::ostringstream outStr;
608 throw ErrorClass(
"Ipopt NEEDS AN OBJECTIVE FUNCTION\n(For pure feasibility problems, use zero function.)");
612 app->Options()->SetIntegerValue(
"print_level", 0);
613 app->Options()->SetIntegerValue(
"max_iter", 20000);
614 app->Options()->SetNumericValue(
"bound_relax_factor", 0,
true,
true);
615 app->Options()->SetStringValue(
"mu_strategy",
"adaptive",
true,
true);
617 app->Options()->SetStringValue(
"check_derivatives_for_naninf",
"yes");
622 app->Options()->SetStringValue(
"hessian_constant",
"yes",
true,
true);
628 app->Options()->SetStringValue(
"nlp_scaling_method",
"user-scaling");
645 outStr <<
"number of solver options ";
650 std::vector<SolverOption*> optionsVector;
654 int num_ipopt_options = optionsVector.size();
655 for(i = 0; i < num_ipopt_options; i++)
660 outStr <<
"ipopt solver option ";
661 outStr << optionsVector[ i]->name;
665 if(optionsVector[ i]->type ==
"numeric" )
670 outStr <<
"FOUND A NUMERIC OPTION ";
671 outStr <<
os_strtod( optionsVector[ i]->value.c_str(), &pEnd );
675 app->Options()->SetNumericValue(optionsVector[ i]->name,
os_strtod( optionsVector[ i]->value.c_str(), &pEnd ) );
677 else if(optionsVector[ i]->type ==
"integer" )
682 outStr <<
"FOUND AN INTEGER OPTION ";
683 outStr << atoi( optionsVector[ i]->value.c_str() );
687 app->Options()->SetIntegerValue(optionsVector[ i]->name, atoi( optionsVector[ i]->value.c_str() ) );
689 else if(optionsVector[ i]->type ==
"string" )
694 outStr <<
"FOUND A STRING OPTION ";
695 outStr << optionsVector[ i]->value.c_str();
699 app->Options()->SetStringValue(optionsVector[ i]->name, optionsVector[ i]->value);
720 std::ostringstream outStr;
742 int returnCode = easy_sdp(
nC_rows,
ncon,
C_matrix,
rhsValues,
mconstraints,0.0,&X,&
y,&
Z,&
pobj,&
dobj);
744 double* mdObjValues = NULL;
746 int numberOfOtherVariableResults;
752 mdObjValues =
new double[1];
754 outStr << std::endl <<
"Objective value f(x*) = " <<
os_dtoa_format(mdObjValues[0]);
758 std::string message =
"Csdp solver finishes to the end.";
759 std::string solutionDescription =
"";
763 throw ErrorClass(
"OSResult error: setSolverInvoked");
765 throw ErrorClass(
"OSResult error: setServiceName");
767 throw ErrorClass(
"OSResult error: setInstanceName");
774 throw ErrorClass(
"OSResult error: setVariableNumer");
777 throw ErrorClass(
"OSResult error: setObjectiveNumber");
779 throw ErrorClass(
"OSResult error: setConstraintNumber");
781 throw ErrorClass(
"OSResult error: setSolutionNumer");
783 throw ErrorClass(
"OSResult error: setGeneralMessage");
793 solutionDescription =
"SUCCESS[Csdp]: Algorithm terminated normally at an optimal point, satisfying the convergence tolerances.";
798 solutionDescription =
"PARTIAL SUCCESS[Csdp]: A solution has been found, but full accuracy was not achieved.";
808 int* colOffset =
new int[X.nblocks+1];
810 for (
int i=1; i<=X.nblocks; i++)
811 colOffset[i] = colOffset[i-1] + X.blocks[i].blocksize;
813 int* colOffsetD =
new int[
Z.nblocks+1];
815 for (
int i=1; i<=
Z.nblocks; i++)
816 colOffsetD[i] = colOffsetD[i-1] +
Z.blocks[i].blocksize;
820 throw ErrorClass(
"OSResult error: setMatrixVariableSolution");
825 throw ErrorClass(
"OSResult error: setMatrixVarValuesAttributes");
828 "",
"",
"",
"csdp",
"", 1))
829 throw ErrorClass(
"OSResult error: setMatrixVariablesOtherResultGeneralAttributes");
832 throw ErrorClass(
"OSResult error: setMatrixVariablesOtherResultMatrixAttributes");
835 colOffset, X.nblocks + 1, X.nblocks))
836 throw ErrorClass(
"OSResult error: setMatrixVarValuesBlockStructure");
839 colOffsetD,
Z.nblocks + 1,
Z.nblocks))
840 throw ErrorClass(
"OSResult error: setMatrixVariablesOtherResultBlockStructure");
850 for (
int blk=1; blk<=X.nblocks; blk++)
852 start =
new int[colOffset[blk]-colOffset[blk-1]+1];
856 switch (X.blocks[blk].blockcategory)
859 for (
int i=1; i<=X.blocks[blk].blocksize; i++)
861 ent=X.blocks[blk].data.vec[i];
868 for (
int i=1; i<=X.blocks[blk].blocksize; i++)
870 for (
int j=i; j<=X.blocks[blk].blocksize; j++)
872 ent=X.blocks[blk].data.mat[ijtok(i,j,X.blocks[blk].blocksize)];
881 throw ErrorClass(
"Invalid Block Type in CSDP solution");
885 index =
new int[nonz];
888 value->
el =
new double[nonz];
891 switch (X.blocks[blk].blockcategory)
894 for (
int i=1; i<=X.blocks[blk].blocksize; i++)
896 ent=X.blocks[blk].data.vec[i];
900 value->
el[nonz] = ent;
906 for (
int i=1; i<=X.blocks[blk].blocksize; i++)
908 for (
int j=i; j<=X.blocks[blk].blocksize; j++)
910 ent=X.blocks[blk].data.mat[ijtok(i,j,X.blocks[blk].blocksize)];
914 value->
el[nonz] = ent;
923 throw ErrorClass(
"Invalid Block Type in CSDP solution");
931 throw ErrorClass(
"OSResult error: setMatrixVarValuesBlockElements");
935 for (
int blk=1; blk<=
Z.nblocks; blk++)
937 start =
new int[colOffsetD[blk]-colOffsetD[blk-1]+1];
941 switch (
Z.blocks[blk].blockcategory)
944 for (
int i=1; i<=
Z.blocks[blk].blocksize; i++)
946 ent=
Z.blocks[blk].data.vec[i];
954 for (
int i=1; i<=
Z.blocks[blk].blocksize; i++)
956 for (
int j=i; j<=
Z.blocks[blk].blocksize; j++)
958 ent=
Z.blocks[blk].data.mat[ijtok(i,j,
Z.blocks[blk].blocksize)];
967 throw ErrorClass(
"Invalid Block Type in CSDP solution");
971 index =
new int[nonz];
974 value->
el =
new double[nonz];
977 switch (
Z.blocks[blk].blockcategory)
980 for (
int i=1; i<=
Z.blocks[blk].blocksize; i++)
982 ent=
Z.blocks[blk].data.vec[i];
986 value->
el[nonz] = ent;
992 for (
int i=1; i<=
Z.blocks[blk].blocksize; i++)
994 for (
int j=i; j<=
Z.blocks[blk].blocksize; j++)
996 ent=
Z.blocks[blk].data.mat[ijtok(i,j,
Z.blocks[blk].blocksize)];
1000 value->
el[nonz] = ent;
1009 throw ErrorClass(
"Invalid Block Type in CSDP solution");
1013 nonz, start, index, value,
1016 throw ErrorClass(
"OSResult error: setMatrixVariablesOtherResultBlockElements");
1021 solutionDescription =
"PRIMAL_INFEASIBILITY[Csdp]: Problem is primal infeasible.";
1026 solutionDescription =
"DUAL_INFEASIBILITY[Csdp]: Problem is dual infeasible.";
1031 solutionDescription =
"MAXITER_EXCEEDED[Csdp]: Maximum number of iterations exceeded.";
1036 solutionDescription =
"STUCK AT EDGE[Csdp]: Stuck at edge of primal infeasibility.";
1041 solutionDescription =
"STUCK AT EDGE[Csdp]: Stuck at edge of dual infeasibility.";
1046 solutionDescription =
"LACK OF PROGRESS[Csdp]: Stopped due to lack of progress.";
1051 solutionDescription =
"SINGULARITY DETECTED[Csdp]: X, Z or O was singular.";
1056 solutionDescription =
"NaN or INF[Csdp]: Detected NaN or Infinity during computations.";
1061 if (returnCode != 0)
1062 throw ErrorClass(
"Csdp FAILED TO SOLVE THE PROBLEM");
1071 outStr <<
"error in OSCsdpSolver routine solve():\n" << eclass.
errormsg << endl;
1084 struct sparseblock *pp;
1085 std::ostringstream outStr;
1087 outStr << std::endl <<
"Check problem data:" << std::endl << std::endl;
1089 outStr <<
"Dimension of matrices (number of rows): n=" <<
nC_rows << std::endl;
1090 outStr <<
"Number of constraints (and matrices A_i): k=" <<
ncon << std::endl;
1091 for (i0=1; i0 <=
ncon; i0++)
1093 outStr << std::endl <<
"Right-hand side of constraint " << i0 <<
": "
1095 outStr << std::endl <<
"Data for matrix A_" << i0 <<
":" << std::endl;
1099 outStr << std::endl <<
"Block " << pp->blocknum <<
":" << std::endl;;
1100 outStr <<
"Block size: " << pp->blocksize << std::endl;
1101 outStr <<
"Number of entries: " << pp->numentries << std::endl;
1102 for (j0=1; j0 <= pp->numentries; j0++)
1103 outStr <<
"Entry in row " << pp->iindices[j0] <<
", col " << pp->jindices[j0]
1104 <<
" has value " << pp->entries[j0] << std::endl;
1109 outStr << std::endl <<
"Data for matrix C:" << std::endl;
1110 outStr <<
"Number of blocks: " <<
C_matrix.nblocks << std::endl;
1111 for (blk0=1; blk0 <=
C_matrix.nblocks; blk0++)
1113 outStr << std::endl <<
"Data for block " << blk0 <<
":" << std::endl;
1114 outStr <<
"Size: " <<
C_matrix.blocks[blk0].blocksize << std::endl;
1115 if (
C_matrix.blocks[blk0].blockcategory == DIAG)
1117 outStr <<
"Type: diagonal" << std::endl;
1118 for (i0=1; i0 <=
C_matrix.blocks[blk0].blocksize; i0++)
1119 outStr <<
"Entry in row " << i0 <<
", col " << i0 <<
" has value "
1120 <<
C_matrix.blocks[blk0].data.vec[i0] << std::endl;
1124 outStr <<
"Type: dense" << std::endl;
1125 for (i0=1; i0 <=
C_matrix.blocks[blk0].blocksize; i0++)
1126 for (j0=1; j0 <=
C_matrix.blocks[blk0].blocksize; j0++)
1127 outStr <<
"Entry in row " << i0 <<
", col " << j0 <<
" has value "
1128 <<
C_matrix.blocks[blk0].data.mat[ijtok(i0,j0,
C_matrix.blocks[blk0].blocksize)]
const OSSmartPtr< OSOutput > osoutput
std::string os_dtoa_format(double x)
std::string OSgetVersionInfo()
double os_strtod(const char *s00, char **se)
to represent the nonzeros in a constantMatrix element
OSiLReader * m_osilreader
m_osilreader is an OSiLReader object used to create an osinstance from an osil string if needed
virtual void setSolverOptions()
The implementation of the virtual functions.
struct blockmatrix C_matrix
virtual void solve()
solve results in an instance being read into the Csdp data structures and optimized
virtual ~CsdpSolver()
the CsdpSolver class destructor
virtual void buildSolverInstance()
The implementation of the virtual functions.
CsdpSolver()
the CsdpSolver class constructor
void dataEchoCheck()
use this for debugging, print out the instance that the solver thinks it has and compare this with th...
OSoLReader * m_osolreader
m_osolreader is an OSoLReader object used to create an osoption from an osol string if needed
struct constraintmatrix * mconstraints
std::string * csdpErrorMsg
std::string osol
osol holds the options for the solver
bool bSetSolverOptions
bSetSolverOptions is set to true if setSolverOptions has been called, false otherwise
std::string osrl
osrl holds the solution or result of the model
OSInstance * osinstance
osinstance holds the problem instance in-memory as an OSInstance object
bool bCallbuildSolverInstance
bCallbuildSolverInstance is set to true if buildSolverService has been called
std::string osil
osil holds the problem instance as a std::string
OSOption * osoption
osoption holds the solver options in-memory as an OSOption object
OSResult * osresult
osresult holds the solution or result of the model in-memory as an OSResult object
used for throwing exceptions.
std::string errormsg
errormsg is the error that is causing the exception to be thrown
a sparse matrix data structure for matrices that can hold nonconstant values and have block structure...
GeneralSparseMatrix * getBlock(int rowIdx, int colIdx)
a method to retrieve a particular block from a collection
int inodeInt
inodeInt is the unique integer assigned to the OSnLNode or OSnLMNode in OSParameters....
OSnLMNode ** m_mMatrixChildren
m_mMatrixChildren holds all the matrix-valued operands, if any.
a sparse matrix data structure for matrices that can hold nonconstant values
bool isDiagonal()
a method to determine whether the matrix is diagonal
MatrixElementValues * value
value holds a general array of value elements in the matrix, which could be constants,...
int * index
index holds an integer array of rowIdx (or colIdx) elements in coefMatrix (AMatrix).
int * start
start holds an integer array of start elements in the matrix, which points to the start of a column (...
int valueSize
valueSize is the dimension of the index and value arrays
int startSize
startSize is the dimension of the starts array
Matrices * matrices
matrices is a pointer to a Matrices object
Objectives * objectives
objectives is a pointer to a Objectives object
OSMatrix ** matrix
matrix is a pointer to an array of OSMatrix object pointers
int numberOfEl
each type of value is stored as an array named "el".
int * getColumnPartition()
get the column partition of the matrix
int * getRowPartition()
get the row partition of the matrix
int getColumnPartitionSize()
get the size of the column partition of a matrix
ExpandedMatrixBlocks * getBlocks(int *rowPartition, int rowPartitionSize, int *colPartition, int colPartitionSize, bool rowMajor, bool appendToBlockArray)
A method to extract a block from a larger matrix The result is a sparse matrix object,...
int getRowPartitionSize()
get the size of the row partition of a matrix
double * getConstraintLowerBounds()
Get constraint lower bounds.
int getNumberOfQuadraticTerms()
Get the number of specified (usually nonzero) qTerms in the quadratic coefficients.
int getNumberOfMatrixVariables()
Get the number of matrix variables.
int getConstraintNumber()
Get number of constraints.
int getLinearConstraintCoefficientNumber()
Get number of specified (usually nonzero) linear constraint coefficient values.
int getMatrixNumber()
Get the number of matrices.
InstanceData * instanceData
A pointer to an InstanceData object.
int getNumberOfNonlinearExpressions()
Get number of nonlinear expressions.
int getVariableNumber()
Get number of variables.
std::string getInstanceName()
Get instance name.
ScalarExpressionTree * getNonlinearExpressionTree(int rowIdx)
Get the expression tree for a given row index.
char * getConstraintTypes()
Get constraint types.
std::string * getObjectiveMaxOrMins()
Get objective maxOrMins.
int getObjectiveNumber()
Get number of objectives.
a data structure to represent a matrix object (derived from MatrixType)
virtual ENUM_MATRIX_TYPE getMatrixType()
std::vector< SolverOption * > getSolverOptions(std::string solver_name)
Get the options associated with a given solver.
int getNumberOfSolverOptions()
Get the number of solver options.
bool setGeneralMessage(std::string message)
Set the general message.
bool setSolutionNumber(int number)
set the number of solutions.
bool setMatrixVariablesOtherResultBlockElements(int solIdx, int otherIdx, int matrixVarIdx, int blkno, int blkRowIdx, int blkColIdx, int nz, int *start, int *index, MatrixElementValues *value, ENUM_MATRIX_TYPE valueType, ENUM_MATRIX_SYMMETRY symmetry=ENUM_MATRIX_SYMMETRY_none, bool rowMajor=false)
A method to set the elements within a block of a matrixVar associated with the [j]th "other" result i...
bool setInstanceName(std::string instanceName)
Set instance name.
bool setMatrixVariableSolution(int solIdx, int numberOfMatrixVar_, int numberOfOtherMatrixVariableResults_)
Set the [i]th optimization solution's MatrixVariableSolution, where i equals the given solution index...
bool setObjectiveValuesDense(int solIdx, double *objectiveValues)
Set the [i]th optimization solution's objective values, where i equals the given solution index.
bool setMatrixVarValuesAttributes(int solIdx, int idx, int matrixVarIdx, int numberOfRows, int numberOfColumns, ENUM_MATRIX_SYMMETRY symmetry=ENUM_MATRIX_SYMMETRY_none, ENUM_MATRIX_TYPE type=ENUM_MATRIX_TYPE_unknown, std::string name="")
A method to set general attributes for a matrixVar in the [i]th optimization solution,...
bool setMatrixVariablesOtherResultGeneralAttributes(int solIdx, int idx, std::string name, std::string description, std::string value, std::string type, std::string solver, std::string category, int numberOfMatrixVar=0, std::string matrixType="", int numberOfEnumerations=0, std::string enumType="")
A method to set general attributes for another (non-standard/solver specific) result associated with ...
bool setGeneralStatusType(std::string type)
Set the general status type, which can be: success, error, warning.
bool setObjectiveNumber(int objectiveNumber)
Set the objective number.
bool setMatrixVariablesOtherResultMatrixAttributes(int solIdx, int otherIdx, int matrixVarIdx, int numberOfRows, int numberOfColumns, ENUM_MATRIX_SYMMETRY symmetry=ENUM_MATRIX_SYMMETRY_none, ENUM_MATRIX_TYPE type=ENUM_MATRIX_TYPE_unknown, std::string name="")
A method to set attributes for a matrixVar in the [j]th other result associated with matrix variables...
bool setMatrixVariablesOtherResultBlockStructure(int solIdx, int otherIdx, int matrixVarIdx, int *colOffset, int colOffsetSize, int *rowOffset, int rowOffsetSize, int numberOfBlocks, int blocksConstructorIdx=0)
A method to set the block structure for the values of a matrixVar associated with the [j]th "other" r...
bool setServiceName(std::string serviceName)
Set service name.
bool setSolverInvoked(std::string solverInvoked)
Set solver invoked.
bool setVariableNumber(int variableNumber)
Set the variable number.
bool setDualVariableValuesDense(int solIdx, double *y)
Set the [i]th optimization solution's dual variable values, where i equals the given solution index.
bool setSolutionStatus(int solIdx, std::string type, std::string description)
Set the [i]th optimization solution status, where i equals the given solution index.
bool setConstraintNumber(int constraintNumber)
Set the constraint number.
bool setMatrixVarValuesBlockStructure(int solIdx, int idx, int *colOffset, int colOffsetSize, int *rowOffset, int rowOffsetSize, int numberOfBlocks, int blocksConstructorIdx=0)
A method to set the block structure for the values of a matrixVar in the [i]th optimization solution,...
bool setMatrixVarValuesBlockElements(int solIdx, int idx, int blkno, int blkRowIdx, int blkColIdx, int nz, int *start, int *index, MatrixElementValues *value, ENUM_MATRIX_TYPE valueType, ENUM_MATRIX_SYMMETRY symmetry=ENUM_MATRIX_SYMMETRY_none, bool rowMajor=false)
A method to set the elements within a block of a matrixVar in the [i]th optimization solution,...
Used to read an OSiL string.
OSInstance * readOSiL(const std::string &osil)
parse the OSiL model instance.
The OSnLMNode Class for nonlinear expressions involving matrices.
The OSnLNode Class for nonlinear expressions.
Used to read an OSoL string.
OSOption * readOSoL(const std::string &osol)
parse the OSoL solver options.
Take an OSResult object and write a string that validates against OSrL.
std::string writeOSrL(OSResult *theosresult)
create an osrl string from an OSResult object
std::string maxOrMin
declare the objective function to be a max or a min
Objective ** obj
coef is pointer to an array of ObjCoef object pointers
Used to hold part of the instance in memory.
OSnLNode * m_treeRoot
m_treeRoot holds the root node (of OSnLNode type) of the expression tree.
#define OS_MATRIX_REFERENCE
@ ENUM_OUTPUT_LEVEL_debug
@ ENUM_OUTPUT_LEVEL_trace
@ ENUM_OUTPUT_LEVEL_error
@ ENUM_OUTPUT_LEVEL_summary
@ ENUM_MATRIX_TYPE_constant
@ ENUM_MATRIX_SYMMETRY_lower
@ ENUM_OUTPUT_AREA_OSSolverInterfaces