25 return so->readFile(filename);
32 return so->readBasisFile(filename);
39 return so->loadSettingsFile(filename);
66#ifndef SOPLEX_WITH_BOOST
67 throw SPxException(
"Rational functions cannot be used when built without Boost.");
71 so->setIntParam(SoPlex::READMODE, SoPlex::READMODE_RATIONAL);
72 so->setIntParam(SoPlex::SOLVEMODE, SoPlex::SOLVEMODE_RATIONAL);
73 so->setIntParam(SoPlex::CHECKMODE, SoPlex::CHECKMODE_RATIONAL);
74 so->setIntParam(SoPlex::SYNCMODE, SoPlex::SYNCMODE_AUTO);
75 so->setRealParam(SoPlex::FEASTOL, 0.0);
76 so->setRealParam(SoPlex::OPTTOL, 0.0);
109 double lb,
double ub)
115 for(
int i = 0; i < colsize; ++i)
117 if(colentries[i] != 0.0)
118 col.
add(i, colentries[i]);
121 so->addColReal(
LPCol(objval, col, ub, lb));
128 so->removeColReal(colidx);
133 long objvalnum,
long objvaldenom,
long lbnum,
long lbdenom,
long ubnum,
long ubdenom)
135#ifndef SOPLEX_WITH_BOOST
136 throw SPxException(
"Rational functions cannot be used when built without Boost.");
149 Rational objval(objvalnum, objvaldenom);
152 for(
int i = 0; i < colsize; ++i)
157 Rational colentry(colnums[i], coldenoms[i]);
158 col.
add(i, colentry);
162 so->addColRational(
LPColRational(objval, col, upper, lower));
173 for(
int i = 0; i < rowsize; ++i)
175 if(rowentries[i] != 0.0)
176 row.
add(i, rowentries[i]);
179 so->addRowReal(
LPRow(lb, row, ub));
186 so->removeRowReal(rowidx);
191 long lbnum,
long lbdenom,
long ubnum,
long ubdenom)
193#ifndef SOPLEX_WITH_BOOST
194 throw SPxException(
"Rational functions cannot be used when built without Boost.");
207 for(
int i = 0; i < rowsize; ++i)
212 Rational rowentry(rownums[i], rowdenoms[i]);
213 row.
add(i, rowentry);
224 so->getPrimalReal(primal, dim);
232#ifndef SOPLEX_WITH_BOOST
233 throw SPxException(
"Rational functions cannot be used when built without Boost.");
238 std::string primalstring;
240 long unsigned int stringlength;
242 so->getPrimalRational(primal);
244 for(
int i = 0; i < dim; ++i)
246 primalstring.append(primal[i].str());
247 primalstring.append(
" ");
250 stringlength = strlen(primalstring.c_str()) + 1;
251 rawstring =
new char[stringlength];
252 strncpy(rawstring, primalstring.c_str(), stringlength);
260 so->getDualReal(dual, dim);
267 so->getRedCostReal(rc, dim);
274 return so->optimize();
288 return so->solveTime();
295 return so->numIterations();
302 Vector objective(dim, obj);
303 so->changeObjReal(objective);
309#ifndef SOPLEX_WITH_BOOST
310 throw SPxException(
"Rational functions cannot be used when built without Boost.");
317 for(
int i = 0; i < dim; ++i)
319 Rational objentry(objnums[i], objdenoms[i]);
320 objrational[i] = objentry;
324 so->changeObjRational(objective);
332 so->changeLhsReal(lhsvec);
339 so->changeLhsReal(rowidx, lhs);
345#ifndef SOPLEX_WITH_BOOST
346 throw SPxException(
"Rational functions cannot be used when built without Boost.");
353 for(
int i = 0; i < dim; ++i)
355 Rational lhsentry(lhsnums[i], lhsdenoms[i]);
356 lhsrational[i] = lhsentry;
360 so->changeLhsRational(lhs);
368 so->changeRhsReal(rhsvec);
375 so->changeRhsReal(rowidx, rhs);
384 so->changeRangeReal(lhsvec, rhsvec);
391 so->changeRangeReal(rowidx, lhs, rhs);
397#ifndef SOPLEX_WITH_BOOST
398 throw SPxException(
"Rational functions cannot be used when built without Boost.");
405 for(
int i = 0; i < dim; ++i)
407 Rational rhsentry(rhsnums[i], rhsdenoms[i]);
408 rhsrational[i] = rhsentry;
412 so->changeRhsRational(rhs);
419 so->writeFile(filename);
426 return so->objValueReal();
434#ifndef SOPLEX_WITH_BOOST
435 throw SPxException(
"Rational functions cannot be used when built without Boost.");
438 long unsigned int stringlength;
440 std::string objstring;
443 stringlength = strlen(objstring.c_str()) + 1;
444 objstring = so->objValueRational().str();
445 value =
new char[stringlength];
446 strncpy(value, objstring.c_str(), stringlength);
456 so->changeBoundsReal(lbvec, ubvec);
463 so->changeBoundsReal(colidx, lb, ub);
470#ifndef SOPLEX_WITH_BOOST
471 throw SPxException(
"Rational functions cannot be used when built without Boost.");
482 so->changeBoundsRational(colidx, lower, upper);
490 so->changeLowerReal(lbvec);
497 so->changeLowerReal(colidx, lb);
506 so->getLowerReal(lbvec);
508 for(
int i = 0; i < dim; ++i)
518 so->getObjReal(objvec);
520 for(
int i = 0; i < dim; ++i)
529 so->changeUpperReal(ubvec);
536 so->changeUpperReal(colidx, ub);
545 so->getUpperReal(ubvec);
547 for(
int i = 0; i < dim; ++i)
562 return so->basisRowStatus(rowidx);
577 return so->basisColStatus(colidx);
586 so->getRowVectorReal(i, row);
588 *nnonzeros = row.
size();
590 for(
int j = 0; j < *nnonzeros; ++j)
592 coefs[j] = row.
value(j);
593 indices[j] = row.
index(j);
601#ifndef SOPLEX_WITH_BOOST
602 throw SPxException(
"Rational functions cannot be used when built without Boost.");
608 so->getRowRational(i, lprow);
611 *nnonzeros = row.
size();
613 for(
int j = 0; j < *nnonzeros; ++j)
615 coefsnum[j] = (
long int) numerator(row.
value(j));
616 coefsdenom[j] = (
long int) denominator(row.
value(j));
617 indices[j] = row.
index(j);
628 *lb = so->lhsReal(i);
629 *ub = so->rhsReal(i);
636#ifndef SOPLEX_WITH_BOOST
637 throw SPxException(
"Rational functions cannot be used when built without Boost.");
641 *lbnum = (
long int) numerator(so->lhsRational(i));
642 *lbdenom = (
long int) denominator(so->lhsRational(i));
643 *ubnum = (
long int) numerator(so->rhsRational(i));
644 *ubdenom = (
long int) denominator(so->rhsRational(i));
Preconfigured SoPlex LP-solver.
void add(const SVectorBase< S > &vec)
Append nonzeros of sv.
const SVectorBase< R > & rowVector() const
Constraint row vector.
int & index(int n)
Reference to index of n 'th nonzero.
R & value(int n)
Reference to value of n 'th nonzero.
int size() const
Number of used indices.
IntParam
integer parameters
BoolParam
boolean parameters
Everything should be within this namespace.
SoPlexBase< Real > SoPlex
LPColBase< Rational > LPColRational
number< gmp_rational, et_off > Rational
LPRowBase< Rational > LPRowRational
Preconfigured SoPlex LP solver.
void SoPlex_getPrimalReal(void *soplex, double *primal, int dim)
void SoPlex_changeRowRhsReal(void *soplex, int rowidx, double rhs)
int SoPlex_optimize(void *soplex)
int SoPlex_readSettingsFile(void *soplex, const char *filename)
void SoPlex_addRowRational(void *soplex, long *rownums, long *rowdenoms, int rowsize, int nnonzeros, long lbnum, long lbdenom, long ubnum, long ubdenom)
void SoPlex_addColReal(void *soplex, double *colentries, int colsize, int nnonzeros, double objval, double lb, double ub)
void SoPlex_clearLPReal(void *soplex)
void SoPlex_getRowVectorRational(void *soplex, int i, int *nnonzeros, long *indices, long *coefsnum, long *coefsdenom)
int SoPlex_getStatus(void *soplex)
void SoPlex_changeVarLowerReal(void *soplex, int colidx, double lb)
void SoPlex_changeLhsRational(void *soplex, long *lhsnums, long *lhsdenoms, int dim)
void SoPlex_getRowBoundsRational(void *soplex, int i, long *lbnum, long *lbdenom, long *ubnum, long *ubdenom)
void SoPlex_getRowVectorReal(void *soplex, int i, int *nnonzeros, long *indices, double *coefs)
char * SoPlex_getPrimalRationalString(void *soplex, int dim)
void SoPlex_changeRowLhsReal(void *soplex, int rowidx, double lhs)
void SoPlex_addRowReal(void *soplex, double *rowentries, int rowsize, int nnonzeros, double lb, double ub)
void SoPlex_changeRhsRational(void *soplex, long *rhsnums, long *rhsdenoms, int dim)
char * SoPlex_objValueRationalString(void *soplex)
void SoPlex_changeRangeReal(void *soplex, double *lhs, double *rhs, int dim)
void SoPlex_setRealParam(void *soplex, int paramcode, double paramvalue)
double SoPlex_objValueReal(void *soplex)
void SoPlex_removeColReal(void *soplex, int colidx)
int SoPlex_numRows(void *soplex)
int SoPlex_basisColStatus(void *soplex, int colidx)
void SoPlex_changeVarBoundsReal(void *soplex, int colidx, double lb, double ub)
void SoPlex_getLowerReal(void *soplex, double *lb, int dim)
void SoPlex_setIntParam(void *soplex, int paramcode, int paramvalue)
void SoPlex_removeRowReal(void *soplex, int rowidx)
int SoPlex_numCols(void *soplex)
int SoPlex_getIntParam(void *soplex, int paramcode)
void SoPlex_changeVarUpperReal(void *soplex, int colidx, double ub)
void SoPlex_addColRational(void *soplex, long *colnums, long *coldenoms, int colsize, int nnonzeros, long objvalnum, long objvaldenom, long lbnum, long lbdenom, long ubnum, long ubdenom)
void SoPlex_changeObjReal(void *soplex, double *obj, int dim)
void SoPlex_free(void *soplex)
void SoPlex_getRedCostReal(void *soplex, double *rc, int dim)
void SoPlex_getDualReal(void *soplex, double *dual, int dim)
void SoPlex_changeLhsReal(void *soplex, double *lhs, int dim)
void SoPlex_changeRhsReal(void *soplex, double *rhs, int dim)
void SoPlex_changeObjRational(void *soplex, long *objnums, long *objdenoms, int dim)
void SoPlex_changeRowRangeReal(void *soplex, int rowidx, double lhs, double rhs)
void SoPlex_changeUpperReal(void *soplex, double *ub, int dim)
void SoPlex_writeFileReal(void *soplex, char *filename)
void SoPlex_changeBoundsReal(void *soplex, double *lb, double *ub, int dim)
int SoPlex_getNumIterations(void *soplex)
void SoPlex_setRational(void *soplex)
void SoPlex_getRowBoundsReal(void *soplex, int i, double *lb, double *ub)
void SoPlex_setBoolParam(void *soplex, int paramcode, int paramvalue)
void SoPlex_getUpperReal(void *soplex, double *ub, int dim)
int SoPlex_readBasisFile(void *soplex, const char *filename)
int SoPlex_basisRowStatus(void *soplex, int rowidx)
void SoPlex_changeLowerReal(void *soplex, double *lb, int dim)
void SoPlex_getObjReal(void *soplex, double *obj, int dim)
int SoPlex_readInstanceFile(void *soplex, const char *filename)
void SoPlex_changeVarBoundsRational(void *soplex, int colidx, long lbnum, long lbdenom, long ubnum, long ubdenom)
double SoPlex_getSolvingTime(void *soplex)