1 #ifndef OsiDylpSolverInterface_H 2 #define OsiDylpSolverInterface_H 110 const std::string &netLibDir) ;
156 int readMps(
const char *filename,
const char *extension =
"mps") ;
162 int readMps(
const char *filename,
const char *extension,
163 int &numberSets,
CoinSet **&sets) ;
173 const char *extension =
"mps",
174 double objsense = 0.0)
const ;
180 const double *collb,
const double *colub,
const double *obj,
181 const char *rowsen,
const double *rowrhs,
182 const double *rowrng) ;
188 const double *collb,
const double *colub,
const double *obj,
189 const double *rowlb,
const double *rowub) ;
194 void loadProblem(
const int colcnt,
const int rowcnt,
195 const int *start,
const int *index,
const double *value,
196 const double *collb,
const double *colub,
const double *obj,
197 const char *sense,
const double *rhsin,
const double *range) ;
202 void loadProblem(
const int colcnt,
const int rowcnt,
203 const int *start,
const int *index,
const double *value,
204 const double *collb,
const double *colub,
const double *obj,
205 const double *row_lower,
const double *row_upper) ;
211 double *&collb,
double *&colub,
double *&obj,
212 char *&rowsen,
double *&rowrhs,
double *&rowrng) ;
218 double *&collb,
double *&colub,
double *&obj,
219 double *&rowlb,
double *&rowub) ;
370 void setRowType(
int index,
char rowsen,
double rowrhs,
double rowrng) ;
403 const double collb,
const double colub,
const double obj) ;
407 void deleteCols(
const int num,
const int *colIndices) ;
416 const double rowlb,
const double rowub) ;
421 const char rowsen,
const double rowrhs,
const double rowrng) ;
425 void deleteRows(
const int num,
const int *rowIndices) ;
610 std::vector<double *>
getDualRays(
int maxNumRays,
bool fullRay)
const ;
663 int setBasisStatus (
const int *archStatus,
const int *logStatus) ;
672 double *duals,
const double *c)
const ;
675 virtual void getBasics(
int *index)
const ;
678 virtual void getBInvCol(
int col,
double *betak)
const ;
681 virtual void getBInvACol(
int col,
double *abarj)
const ;
684 virtual void getBInvRow(
int row,
double *betai)
const ;
687 virtual void getBInvARow(
int row,
double *abari,
double *betai = 0)
const ;
714 bool keepContinuous =
false) ;
716 # if ODSI_PARANOIA >= 1 726 void indexCheck (
int k,
bool isCol, std::string rtnnme) ;
737 const bool mustexist =
true) ;
741 void dylp_logfile(
const char* name,
bool echo =
false) ;
815 static int reference_count ;
817 static bool basis_ready ;
847 bool initial_gtxecho ;
853 bool resolve_gtxecho ;
875 double odsiInfinity ;
879 const std::string solvername ;
919 { basisNone = 0, basisFresh, basisModified, basisDamaged } ;
971 mutable double _objval ;
972 mutable double* _col_obj ;
973 mutable double* _col_x ;
974 mutable double* _col_cbar ;
976 mutable double* _row_rhs ;
977 mutable double* _row_lower ;
978 mutable double* _row_upper ;
979 mutable char* _row_sense ;
980 mutable double* _row_range ;
981 mutable double* _row_lhs ;
982 mutable double* _row_price ;
1024 bool keepIntegers_ ;
1030 mutable double* saved_col_obj ;
1031 mutable double* saved_row_rhs ;
1032 mutable double* saved_row_lower ;
1033 mutable double* saved_row_upper ;
1034 mutable char* saved_row_sense ;
1035 mutable double* saved_row_range ;
1057 bool evalPresolve() ;
1060 void saveOriginalSys() ;
1063 void installPresolve() ;
1069 void doPostsolve() ;
1072 void installPostsolve() ;
1075 void destruct_presolve() ;
1084 bool ensureOwnership ()
const ;
1091 void construct_lpprob() ;
1092 void construct_options() ;
1093 void construct_consys(
int cols,
int rows) ;
1094 void dylp_ioinit() ;
1095 void gen_rowparms(
int rowcnt,
1097 const double *rowlb,
const double *rowub) ;
1098 void gen_rowparms(
int rowcnt,
1100 const char *sense,
const double *rhsin,
const double *range) ;
1101 void load_problem(
const CoinMpsIO &mps) ;
1103 const double* col_lower,
const double* col_upper,
const double* obj,
1104 const contyp_enum *ctyp,
const double* rhs,
const double* rhslow) ;
1105 void load_problem (
const int colcnt,
const int rowcnt,
1106 const int *start,
const int *lens,
1107 const int *index,
const double *value,
1108 const double* col_lower,
const double* col_upper,
const double* obj,
1109 const contyp_enum *ctyp,
const double* rhs,
const double* rhslow) ;
1124 void destruct_primal_cache() ;
1125 void destruct_dual_cache() ;
1126 void destruct_col_cache(
bool structure) ;
1127 void destruct_row_cache(
bool structure) ;
1128 void destruct_cache(
bool rowStructure,
bool colStructure) ;
1129 void destruct_problem(
bool preserve_interface) ;
1130 void detach_dylp()
const ;
1143 double vubi,
double obji,
const std::string *nme) ;
1146 double rhsi,
double rhslowi,
const std::string *nme) ;
1147 void calc_objval() ;
1148 contyp_enum bound_to_type(
double lower,
double upper) ;
1149 void gen_rowiparms(
contyp_enum* ctypi,
double* rhsi,
double* rhslowi,
1150 char sensei,
double rhsini,
double rangei) ;
1151 void gen_rowiparms(
contyp_enum* ctypi,
double* rhsi,
double* rhslowi,
1152 double rowlbi,
double rowubi) ;
1153 void unimp_hint(
bool dylpSense,
bool hintSense,
1155 void pessimal_primal() ;
1156 void reduceActiveBasis() ;
1172 template<
class T>
static void copy(
const T* src, T* dst,
int n) ;
1173 template<
class T>
static T* copy(
const T* src,
int n) ;
1174 template<
class T>
static T* copy(
const T* src) ;
1189 template<
class T>
static void assert_same(
const T& t1,
const T& t2,
1191 template<
class T>
static void assert_same(
const T* t1,
const T* t2,
1192 int n,
bool exact) ;
1194 static void assert_same(
double d1,
double d2,
bool exact) ;
1221 template<
class T>
inline static T* idx_vec (T* vec) {
return (vec-1) ; }
1224 inline static int idx (
int i) {
return (i+1) ; }
1231 template<
class T>
inline static T* inv_vec (T* vec) {
return (vec+1) ; }
1234 inline static int inv (
int i) {
return (i-1) ; }
1238 static void packed_vector(
1244 static std::string make_filename(
const char *filename,
1245 const char *ext1,
const char *ext2) ;
1262 void OsiDylpSolverInterfaceUnitTest(
const std::string & mpsDir,
1263 const std::string &netLibDir) ;
1265 #endif // OsiDylpSolverInterface_H const double * getRowRange() const
Get the row (constraint) range vector.
void setRowPrice(const double *)
Set the value of the dual variables in the problem solution.
const double * getRowUpper() const
Get the row (constraint) upper bound vector.
void setObjSense(double sense)
Set the sense (min/max) of the objective.
int getNumIntegers() const
Get the number of integer variables.
lpopts_struct * resolveOptions
Solver options for a resolve.
const double * getObjCoefficients() const
Get the objective function coefficient vector.
virtual void getReducedGradient(double *columnReducedCosts, double *duals, const double *c) const
Calculate duals and reduced costs for the given objective coefficients.
void setColSolution(const double *colsol)
Set the value of the primal variables in the problem solution.
void enableFactorization() const
Prepare the solver for the use of tableau access methods.
void setLanguage(CoinMessages::Language language)
An alias for OsiDylpSolverInterface::newLanguage.
virtual void setColLower(int elementIndex, double elementValue)=0
double getObjValue() const
Get the objective function value for the solution.
ODSI_start_enum
Enum to specify cold/warm/hot start.
void branchAndBound()
Invoke the solver's built-in branch-and-bound algorithm.
int readMps(const char *filename, const char *extension="mps")
Read a problem description in MPS format from a file.
virtual bool getHintParam(OsiHintParam key, bool &yesNo, OsiHintStrength &strength, void *&otherInformation) const
void markHotStart()
Create a hot start snapshot.
void disableFactorization() const
Undo the effects of enableFactorization.
double getObjSense() const
Get the objective function sense (min/max)
void resolve()
Call dylp to reoptimize (warm start).
std::vector< double * > getPrimalRays(int maxNumRays) const
Get as many primal rays as the solver can provide.
lptols_struct * tolerances
Solver numeric tolerances.
void activateRowCutDebugger(const char *modelName)
Activate the row cut debugger.
void dylp_outfile(const char *name)
Establish an output (solution and/or statistics) file.
void writeMps(const char *basename, const char *extension="mps", double objsense=0.0) const
Write the problem into the specified file in MPS format.
int getNumRows() const
Get the number of rows (constraints)
void assignProblem(CoinPackedMatrix *&matrix, double *&collb, double *&colub, double *&obj, char *&rowsen, double *&rowrhs, double *&rowrng)
Load a problem description (OSI packed matrix, row sense, parameters destroyed).
friend void OsiDylpSolverInterfaceUnitTest(const std::string &mpsDir, const std::string &netLibDir)
Unit test for OsiDylpSolverInterface.
void deleteRows(const int num, const int *rowIndices)
Delete row(s) (constraint(s)) from the problem.
const char * getRowSense() const
Get the row sense (constraint type) vector.
const double * getColUpper() const
Get the column (variable) upper bound vector.
virtual void setColUpper(int elementIndex, double elementValue)=0
void setObjCoeff(int index, double value)
Set an objective function coefficient.
void dylp_logfile(const char *name, bool echo=false)
Establish a log file.
void setInteger(int index)
Set a single variable to be integer.
const double * getRightHandSide() const
Get the row (constraint) right-hand-side vector.
~OsiDylpSolverInterface()
Destructor.
bool setDblParam(OsiDblParam key, double value)
Set an OSI double parameter.
int canDoSimplexInterface() const
Return the simplex implementation level.
virtual void addCol(const CoinPackedVectorBase &vec, const double collb, const double colub, const double obj)=0
void setColName(int ndx, std::string name)
Set a column name.
lpopts_struct * initialSolveOptions
Solver options for an initial solve.
void loadProblem(const CoinPackedMatrix &matrix, const double *collb, const double *colub, const double *obj, const char *rowsen, const double *rowrhs, const double *rowrng)
Load a problem description (OSI packed matrix, row sense, parameters unaffected). ...
void dylp_printsoln(bool wantSoln, bool wantStats)
Print the solution and/or statistics to the output file.
bool setIntParam(OsiIntParam key, int value)
Set an OSI integer parameter.
void setOsiDylpMessages(CoinMessages::Language local_language)
Set the language for messages.
OsiDylpSolverInterface & operator=(const OsiDylpSolverInterface &rhs)
Assignment.
virtual void getBInvARow(int row, double *abari, double *betai=0) const
Get a row of the tableau.
OsiDylpSolverInterface()
Default constructor.
bool getStrParam(OsiStrParam key, std::string &value) const
Get an OSI string parameter.
void setRowName(int ndx, std::string name)
Set a row name.
void setContinuous(int index)
Set a single variable to be continuous.
const CoinPackedMatrix * getMatrixByRow() const
Get a pointer to a row-major copy of the constraint matrix.
int getNumCols() const
Get the number of columns (variables)
bool setStrParam(OsiStrParam key, const std::string &value)
Set an OSI string parameter.
const double * getRowLower() const
Get the row (constraint) lower bound vector.
int getIterationCount() const
Get the number of iterations for the last lp.
const double * getRowActivity() const
Return the vector of row activity for the solution.
const double * getColSolution() const
Return the vector of primal variables for the solution.
bool isAbandoned() const
True if dylp abandoned the problem.
void setRowLower(int index, double value)
Set the lower bound on a row (constraint)
virtual void getBInvACol(int col, double *abarj) const
Get a column of the tableau.
void setColLower(int index, double value)
Set the lower bound on a column (variable)
void deleteCols(const int num, const int *colIndices)
Remove column(s) (variable(s)) from the problem.
void setRowUpper(int index, double value)
Set the upper bound on a row (constraint)
void addRow(const CoinPackedVectorBase &row, const double rowlb, const double rowub)
Add a row (constraint) to the problem.
const double * getReducedCost() const
Return the vector of reduced costs for the solution.
virtual void getBInvRow(int row, double *betai) const
Get a row of the basis inverse.
bool isInteger(int colIndex) const
Return true if the variable is integer (general or binary)
void applyColCut(const OsiColCut &cut)
Apply a column (variable) cut (adjust one or more bounds)
CoinWarmStart * getWarmStart() const
Build a warm start object for the current lp solution.
void solveFromHotStart()
Call dylp to reoptimize (hot start).
void unmarkHotStart()
Delete the hot start snapshot.
virtual void getBInvCol(int col, double *betak) const
Get a column of the basis inverse.
bool isProvenPrimalInfeasible() const
True if dylp reported the problem to be primal infeasible.
The dylp warm start class.
const CoinPackedMatrix * getMatrixByCol() const
Get a pointer to a column-major copy of the constraint matrix.
std::vector< double * > getDualRays(int maxNumRays, bool fullRay) const
Get as many dual rays as the solver can provide.
void initialSolve()
Solve an lp from scratch.
bool isDualObjectiveLimitReached() const
Is the dual objective limit reached?
void addCol(const CoinPackedVectorBase &vec, const double collb, const double colub, const double obj)
Add a column (variable) to the problem.
bool isIterationLimitReached() const
True if dylp reached the iteration limit.
bool setWarmStart(const CoinWarmStart *warmStart)
Apply a warm start object.
virtual void setInteger(int index)=0
bool getHintParam(OsiHintParam key, bool &sense, OsiHintStrength &strength, void *&info) const
Get an OSI hint.
virtual void setContinuous(int index)=0
int getNumElements() const
Get the number of non-zero coefficients.
bool getIntParam(OsiIntParam key, int &value) const
Get an OSI integer parameter.
void getBasisStatus(int *archStatus, int *logStatus) const
Retrieve status information for architectural and logical variables.
void newLanguage(CoinMessages::Language language)
Change the language for OsiDylp messages.
bool basisIsAvailable() const
Check if an optimal basis is available.
OsiSolverInterface * clone(bool copyData=true) const
Clone the solver object.
void setObjName(std::string name)
Set the objective function name.
double getInfinity() const
Get dylp's value for infinity.
bool isIntegerNonBinary(int colIndex) const
Return true if the variable is general integer.
bool isBinary(int colIndex) const
Return true if the variable is binary.
bool isContinuous(int colIndex) const
Return true if the variable is continuous.
virtual void addRow(const CoinPackedVectorBase &vec, const double rowlb, const double rowub)=0
bool isPrimalObjectiveLimitReached() const
Is the primal objective limit reached?
const double * getColLower() const
Get the column (variable) lower bound vector.
const double * getRowPrice() const
Return the vector of dual variables for the solution.
bool setHintParam(OsiHintParam key, bool sense=true, OsiHintStrength strength=OsiHintTry, void *info=0)
Set an OSI hint.
bool isProvenDualInfeasible() const
True if dylp reported the problem to be dual infeasible (primal unbounded)
bool isProvenOptimal() const
True if dylp reported an optimal solution.
bool getDblParam(OsiDblParam key, double &value) const
Get an OSI double parameter.
int setBasisStatus(const int *archStatus, const int *logStatus)
Set a basis and update the factorization and solution.
void applyRowCut(const OsiRowCut &cut)
Apply a row (constraint) cut (add one constraint)
void setObjective(const double *array)
Set the objective coefficients for all columns.
virtual void getBasics(int *index) const
Get indices of basic variables.
void setColUpper(int index, double value)
Set the upper bound on a column (variable)
CoinWarmStart * getEmptyWarmStart() const
Get an empty OsiDylpWarmStartBasis object.
void setRowType(int index, char rowsen, double rowrhs, double rowrng)
Set the type of a row (constraint)
void reset()
Reset the solver object to the state produced by the default constructor.
void dylp_controlfile(const char *name, const bool silent, const bool mustexist=true)
Process an options (.spc) file.