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;
119 if (
osinstance->getNumberOfMatrixVariables() != 1)
120 throw ErrorClass(
"There must be one matrixVar object");
122 throw ErrorClass(
"There must be one nonlinear expression for each constraint and objective");
123 if (
osinstance->getLinearConstraintCoefficientNumber() > 0)
124 throw ErrorClass(
"Additional linear constraint coefficients are not supported");
125 if (
osinstance->getNumberOfQuadraticTerms() > 0)
126 throw ErrorClass(
"Additional quadratic terms are not supported");
128 char* cType =
osinstance->getConstraintTypes();
129 for (
int i=0; i <
osinstance->getConstraintNumber(); i++)
130 if (cType[i] !=
'E')
throw ErrorClass(
"Only equality constraints are supported");
132 std::string* oType =
osinstance->getObjectiveMaxOrMins();
133 if (oType[0] !=
"max")
throw ErrorClass(
"The problem must be of \"max\" type");
136 tempTree =
osinstance->getNonlinearExpressionTree(-1);
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");
149 mtxRef =
new int[
osinstance->getConstraintNumber()+1];
153 if (
osinstance->instanceData->matrices == NULL)
154 throw ErrorClass(
"<matrices> section was never defined");
155 if (mtxRef[0] < 0 || mtxRef[0] >=
osinstance->getMatrixNumber())
157 tempMtx =
osinstance->instanceData->matrices->matrix[mtxRef[0]];
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;
177 for (
int i=0; i <
osinstance->getConstraintNumber(); i++)
179 tempTree =
osinstance->getNonlinearExpressionTree(i);
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");
194 if (mtxRef[i+1] < 0 || mtxRef[i+1] >=
osinstance->getMatrixNumber())
196 tempMtx =
osinstance->instanceData->matrices->matrix[mtxRef[i+1]];
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++)
340 mtxBlocks[j] =
osinstance->instanceData->matrices->matrix[mtxRef[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];
514 osresult->setGeneralStatusType(
"error");
534 struct paramstruc params;
536 std::ostringstream outStr;
537 std::ostringstream optStr;
554 outStr <<
"number of solver options ";
555 outStr <<
osoption->getNumberOfSolverOptions();
560 std::vector<SolverOption*> optionsVector;
561 optionsVector =
osoption->getSolverOptions(
"csdp",
true);
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");
594 osresult->setGeneralStatusType(
"error");
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);
626 if(
osinstance->instanceData->objectives->obj[ 0]->maxOrMin.compare(
"min") != 0)
628 app->Options()->SetStringValue(
"nlp_scaling_method",
"user-scaling");
645 outStr <<
"number of solver options ";
646 outStr <<
osoption->getNumberOfSolverOptions();
650 std::vector<SolverOption*> optionsVector;
651 optionsVector =
osoption->getSolverOptions(
"ipopt",
true);
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);
705 catch(
const ErrorClass& eclass)
709 osresult->setGeneralStatusType(
"error");
711 throw ErrorClass(
osrl) ;
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;
748 int numCon =
osinstance->getConstraintNumber();
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 =
"";
762 if(
osresult->setSolverInvoked(
"COIN-OR Csdp") !=
true)
763 throw ErrorClass(
"OSResult error: setSolverInvoked");
765 throw ErrorClass(
"OSResult error: setServiceName");
767 throw ErrorClass(
"OSResult error: setInstanceName");
774 throw ErrorClass(
"OSResult error: setVariableNumer");
776 if(
osresult->setObjectiveNumber( 1) !=
true)
777 throw ErrorClass(
"OSResult error: setObjectiveNumber");
779 throw ErrorClass(
"OSResult error: setConstraintNumber");
780 if(
osresult->setSolutionNumber( 1) !=
true)
781 throw ErrorClass(
"OSResult error: setSolutionNumer");
782 if(
osresult->setGeneralMessage( message) !=
true)
783 throw ErrorClass(
"OSResult error: setGeneralMessage");
793 solutionDescription =
"SUCCESS[Csdp]: Algorithm terminated normally at an optimal point, satisfying the convergence tolerances.";
794 osresult->setSolutionStatus(solIdx,
"optimal", solutionDescription);
798 solutionDescription =
"PARTIAL SUCCESS[Csdp]: A solution has been found, but full accuracy was not achieved.";
799 osresult->setSolutionStatus(solIdx,
"unsure", solutionDescription);
803 osresult->setObjectiveValuesDense(solIdx, mdObjValues);
806 osresult->setDualVariableValuesDense(solIdx,
y+1);
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;
819 if (!
osresult->setMatrixVariableSolution(0,1,1))
820 throw ErrorClass(
"OSResult error: setMatrixVariableSolution");
823 if (!
osresult->setMatrixVarValuesAttributes(0,0,0,colOffset[X.nblocks],
825 throw ErrorClass(
"OSResult error: setMatrixVarValuesAttributes");
827 if (!
osresult->setMatrixVariablesOtherResultGeneralAttributes(0, 0,
"dual matrix",
828 "",
"",
"",
"csdp",
"", 1))
829 throw ErrorClass(
"OSResult error: setMatrixVariablesOtherResultGeneralAttributes");
830 if (!
osresult->setMatrixVariablesOtherResultMatrixAttributes(0, 0, 0,
832 throw ErrorClass(
"OSResult error: setMatrixVariablesOtherResultMatrixAttributes");
834 if (!
osresult->setMatrixVarValuesBlockStructure(0, 0, colOffset, X.nblocks + 1,
835 colOffset, X.nblocks + 1, X.nblocks))
836 throw ErrorClass(
"OSResult error: setMatrixVarValuesBlockStructure");
838 if (!
osresult->setMatrixVariablesOtherResultBlockStructure(0, 0, 0, colOffsetD,
Z.nblocks + 1,
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");
927 if (!
osresult->setMatrixVarValuesBlockElements(0, 0, blk-1, blk-1, blk-1, nonz,
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");
1012 if (!
osresult->setMatrixVariablesOtherResultBlockElements(0, 0, 0, blk-1, blk-1, blk-1,
1013 nonz, start, index, value,
1016 throw ErrorClass(
"OSResult error: setMatrixVariablesOtherResultBlockElements");
1021 solutionDescription =
"PRIMAL_INFEASIBILITY[Csdp]: Problem is primal infeasible.";
1022 osresult->setSolutionStatus(solIdx,
"infeasible", solutionDescription);
1026 solutionDescription =
"DUAL_INFEASIBILITY[Csdp]: Problem is dual infeasible.";
1027 osresult->setSolutionStatus(solIdx,
"infeasible", solutionDescription);
1031 solutionDescription =
"MAXITER_EXCEEDED[Csdp]: Maximum number of iterations exceeded.";
1032 osresult->setSolutionStatus(solIdx,
"stoppedByLimit", solutionDescription);
1036 solutionDescription =
"STUCK AT EDGE[Csdp]: Stuck at edge of primal infeasibility.";
1037 osresult->setSolutionStatus(solIdx,
"error", solutionDescription);
1041 solutionDescription =
"STUCK AT EDGE[Csdp]: Stuck at edge of dual infeasibility.";
1042 osresult->setSolutionStatus(solIdx,
"error", solutionDescription);
1046 solutionDescription =
"LACK OF PROGRESS[Csdp]: Stopped due to lack of progress.";
1047 osresult->setSolutionStatus(solIdx,
"error", solutionDescription);
1051 solutionDescription =
"SINGULARITY DETECTED[Csdp]: X, Z or O was singular.";
1052 osresult->setSolutionStatus(solIdx,
"error", solutionDescription);
1056 solutionDescription =
"NaN or INF[Csdp]: Detected NaN or Infinity during computations.";
1057 osresult->setSolutionStatus(solIdx,
"error", solutionDescription);
1061 if (returnCode != 0)
1062 throw ErrorClass(
"Csdp FAILED TO SOLVE THE PROBLEM");
1071 outStr <<
"error in OSCsdpSolver routine solve():\n" << eclass.
errormsg << endl;
1075 osresult->setGeneralStatusType(
"error");
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
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
int getRowPartitionSize()
get the size of the row partition of a matrix
int getNumberOfQuadraticTerms()
Get the number of specified (usually nonzero) qTerms in the quadratic coefficients.
int getNumberOfNonlinearExpressions()
Get number of nonlinear expressions.
int getObjectiveNumber()
Get number of objectives.
a data structure to represent a matrix object (derived from MatrixType)
virtual ENUM_MATRIX_TYPE getMatrixType()
Used to read an OSiL string.
The OSnLMNode Class for nonlinear expressions involving matrices.
The OSnLNode Class for nonlinear expressions.
Used to read an OSoL string.
Take an OSResult object and write a string that validates against OSrL.
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