DyLP  1.10.4
OsiDylpSolverInterface.hpp
Go to the documentation of this file.
1 #ifndef OsiDylpSolverInterface_H
2 #define OsiDylpSolverInterface_H
3 
4 /*
5  Copyright (C) 2002, 2003, 2004.
6  Lou Hafer, Stephen Tse, International Business Machines Corporation and
7  others. All Rights Reserved.
8  Copyright (C) 2005 -- 2010 Lou Hafer
9 
10  This file is a portion of the COIN/OSI interface for dylp and is licensed
11  under the terms of the Eclipse Public License (EPL)
12 */
13 
23 /*
24  sccs: @(#)OsiDylpSolverInterface.hpp 1.12 09/16/04
25  cvs: $Id: OsiDylpSolverInterface.hpp 1312 2008-10-10 00:26:32Z lou $
26 */
27 
28 #include "OsiConfig.h"
29 #include <CoinPackedMatrix.hpp>
30 #include <OsiSolverInterface.hpp>
31 #include <CoinWarmStart.hpp>
32 #include <CoinMessageHandler.hpp>
33 #include <CoinMpsIO.hpp>
34 #include <CoinPresolveMatrix.hpp>
35 
36 #define DYLP_INTERNAL
37 extern "C" {
38 #include "dylp.h"
39 }
40 
42 
45 typedef enum { startInvalid = 0,
47 
48 
107 class OsiDylpSolverInterface: virtual public OsiSolverInterface
108 
109 { friend void OsiDylpSolverInterfaceUnitTest(const std::string &mpsDir,
110  const std::string &netLibDir) ;
111 
112 /*
113  Consult the COIN OSI documentation or relevant source code for details
114  not covered here. Supported functions are listed first, followed by
115  unsupported functions.
116 */
117 
118 public:
119 
122 
126 
130 
133  OsiSolverInterface* clone(bool copyData = true) const ;
134 
138 
142 
147  void reset() ;
148 
150 
153 
156  int readMps(const char *filename, const char *extension = "mps") ;
157 
162  int readMps(const char *filename, const char *extension,
163  int &numberSets, CoinSet **&sets) ;
164 
172  void writeMps(const char *basename,
173  const char *extension = "mps",
174  double objsense = 0.0) const ;
175 
179  void loadProblem(const CoinPackedMatrix &matrix,
180  const double *collb, const double *colub, const double *obj,
181  const char *rowsen, const double *rowrhs,
182  const double *rowrng) ;
183 
187  void loadProblem(const CoinPackedMatrix &matrix,
188  const double *collb, const double *colub, const double *obj,
189  const double *rowlb, const double *rowub) ;
190 
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) ;
198 
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) ;
206 
210  void assignProblem(CoinPackedMatrix *&matrix,
211  double *&collb, double *&colub, double *&obj,
212  char *&rowsen, double *&rowrhs, double *&rowrng) ;
213 
217  void assignProblem(CoinPackedMatrix *&matrix,
218  double *&collb, double *&colub, double *&obj,
219  double *&rowlb, double *&rowub) ;
220 
222 
226 
229  int getNumCols() const ;
230 
233  int getNumRows() const ;
234 
237  int getNumElements() const ;
238 
244  int getNumIntegers() const ;
245 
248  const double* getColLower() const ;
249 
252  const double* getColUpper() const ;
253 
256  bool isContinuous(int colIndex) const ;
257 
260  bool isBinary(int colIndex) const ;
261 
264  bool isIntegerNonBinary (int colIndex) const ;
265 
268  bool isInteger (int colIndex) const ;
269 
272  const char* getRowSense() const ;
273 
276  const double* getRightHandSide() const ;
277 
280  const double* getRowRange() const ;
281 
284  const double* getRowLower() const ;
285 
288  const double* getRowUpper() const ;
289 
292  const double* getObjCoefficients() const ;
293 
299  double getObjSense() const ;
300 
303  const CoinPackedMatrix *getMatrixByRow() const ;
304 
307  const CoinPackedMatrix *getMatrixByCol() const ;
309 
316 
319  void setObjName (std::string name) ;
320 
326  void setRowName(int ndx, std::string name) ;
327 
333  void setColName(int ndx, std::string name) ;
334 
336 
339 
342  void setContinuous(int index) ;
343  using OsiSolverInterface::setContinuous ;
344 
347  void setInteger(int index) ;
348  using OsiSolverInterface::setInteger ;
349 
352  void setColLower(int index, double value) ;
353  using OsiSolverInterface::setColLower ;
354 
357  void setColUpper(int index, double value) ;
358  using OsiSolverInterface::setColUpper ;
359 
362  void setRowLower(int index, double value) ;
363 
366  void setRowUpper(int index, double value) ;
367 
370  void setRowType(int index, char rowsen, double rowrhs, double rowrng) ;
371 
374  void setObjCoeff (int index, double value) ;
375 
378  void setObjective(const double * array);
379 
386  void setObjSense(double sense) ;
387 
390  void setColSolution(const double *colsol) ;
391 
394  void setRowPrice(const double*) ;
395 
396  /* For overload resolution with OSI::addCol functions. */
397 
398  using OsiSolverInterface::addCol ;
399 
402  void addCol(const CoinPackedVectorBase &vec,
403  const double collb, const double colub, const double obj) ;
404 
407  void deleteCols(const int num, const int *colIndices) ;
408 
409  /* For overload resolution with OSI::addRow functions. */
410 
411  using OsiSolverInterface::addRow ;
412 
415  void addRow(const CoinPackedVectorBase &row,
416  const double rowlb, const double rowub) ;
417 
420  void addRow(const CoinPackedVectorBase &row,
421  const char rowsen, const double rowrhs, const double rowrng) ;
422 
425  void deleteRows(const int num, const int *rowIndices) ;
426 
429  void applyRowCut(const OsiRowCut &cut) ;
430 
433  void applyColCut(const OsiColCut &cut) ;
435 
438 
441  void initialSolve() ;
442 
445  CoinWarmStart *getEmptyWarmStart () const ;
446 
449  CoinWarmStart *getWarmStart() const ;
450 
458  bool setWarmStart(const CoinWarmStart *warmStart) ;
459 
462  void resolve() ;
463 
466  void markHotStart() ;
467 
470  void solveFromHotStart() ;
471 
474  void unmarkHotStart() ;
475 
477 
480 
483  bool isAbandoned() const ;
484 
487  bool isProvenOptimal() const ;
488 
491  bool isProvenPrimalInfeasible() const ;
492 
496  bool isProvenDualInfeasible() const ;
497 
500  bool isIterationLimitReached() const ;
501 
504  int getIterationCount() const ;
505 
511  bool isPrimalObjectiveLimitReached() const ;
512 
518  bool isDualObjectiveLimitReached() const ;
520 
521 
524 
527  double getInfinity() const ;
528 
531  bool setIntParam(OsiIntParam key, int value) ;
532 
535  bool setDblParam(OsiDblParam key, double value) ;
536 
539  bool setStrParam(OsiStrParam key, const std::string& value) ;
540 
543  bool setHintParam(OsiHintParam key, bool sense = true,
544  OsiHintStrength strength = OsiHintTry, void *info = 0) ;
545 
548  bool getIntParam(OsiIntParam key, int &value) const ;
549 
552  bool getDblParam(OsiDblParam key, double &value) const ;
553 
556  bool getStrParam(OsiStrParam key, std::string &value) const ;
557 
558  /* For overload resolution with OSI::getHintParam functions. */
559 
560  using OsiSolverInterface::getHintParam ;
561 
564  bool getHintParam(OsiHintParam key, bool &sense,
565  OsiHintStrength &strength, void *&info) const ;
566 
569  inline void newLanguage(CoinMessages::Language language)
570  { setOsiDylpMessages(language) ; }
571 
574  inline void setLanguage(CoinMessages::Language language)
575  { setOsiDylpMessages(language) ; }
576 
578 
581 
584  double getObjValue() const ;
585 
588  const double* getColSolution() const ;
589 
592  const double* getRowPrice() const ;
593 
596  const double* getReducedCost() const ;
597 
600  const double* getRowActivity() const ;
601 
610  std::vector<double *> getDualRays(int maxNumRays, bool fullRay) const ;
611 
614  std::vector<double *> getPrimalRays(int maxNumRays) const ;
615 
617 
620 
622  int canDoSimplexInterface() const ;
623 
635  void enableFactorization() const ;
636 
643  void disableFactorization() const ;
644 
646  bool basisIsAvailable () const ;
647 
655  void getBasisStatus (int *archStatus, int *logStatus) const ;
656 
663  int setBasisStatus (const int *archStatus, const int *logStatus) ;
664 
671  virtual void getReducedGradient(double *columnReducedCosts,
672  double *duals, const double *c) const ;
673 
675  virtual void getBasics(int *index) const ;
676 
678  virtual void getBInvCol(int col, double *betak) const ;
679 
681  virtual void getBInvACol(int col, double *abarj) const ;
682 
684  virtual void getBInvRow(int row, double *betai) const ;
685 
687  virtual void getBInvARow(int row, double *abari, double *betai = 0) const ;
688 
690 
691 
694 
701  void activateRowCutDebugger (const char * modelName) ;
702 
713  void activateRowCutDebugger (const double *solution,
714  bool keepContinuous = false) ;
715 
716 # if ODSI_PARANOIA >= 1
717 
726  void indexCheck (int k, bool isCol, std::string rtnnme) ;
727 # endif
728 
730 
733 
736  void dylp_controlfile(const char* name, const bool silent,
737  const bool mustexist = true) ;
738 
741  void dylp_logfile(const char* name, bool echo = false) ;
742 
745  void dylp_outfile(const char* name) ;
746 
749  void dylp_printsoln(bool wantSoln, bool wantStats) ;
750 
753  void setOsiDylpMessages(CoinMessages::Language local_language) ;
754 
756 
759 
760 
763  void branchAndBound() ;
764 
766 
776 
779 
782 
785 
787 
788 private:
789 
790 /*
791  Private implementation state and helper functions. If you're contemplating
792  using any of these, you should have a look at the code.
793  See OsiDylpSolverInterface.cpp for descriptions.
794 */
801 
808 
810 
813 
815  static int reference_count ;
817  static bool basis_ready ;
818 
820 
821 
827 
835 
842 
848 
854 
865 
871  double obj_sense ;
872 
875  double odsiInfinity ;
876 
879  const std::string solvername ;
880 
883  mutable void *info_[OsiLastHintParam] ;
884 
887  bool mps_debug ;
888 
896  CoinWarmStart *hotstart_fallback ;
897 
920 
938  struct
939  { CoinWarmStart *basis ;
942 
948  bool solnIsFresh ;
949 
956  mutable struct
957  { int simplex ;
959 
961 
962 
963 
970 
971  mutable double _objval ;
972  mutable double* _col_obj ;
973  mutable double* _col_x ;
974  mutable double* _col_cbar ;
975 
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 ;
983 
984  mutable CoinPackedMatrix* _matrix_by_col ;
985  mutable CoinPackedMatrix* _matrix_by_row ;
986 
988 
995 
1001  CoinPresolveMatrix *preObj_ ;
1002 
1009  const CoinPresolveAction *postActions_ ;
1010 
1018  CoinPostsolveMatrix *postObj_ ;
1019 
1022 
1025 
1028 
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 ;
1036  mutable CoinPackedMatrix* saved_matrix_by_col ;
1037  mutable CoinPackedMatrix* saved_matrix_by_row ;
1038 
1040 
1050  CoinPresolveMatrix *initialisePresolve(bool keepIntegers) ;
1052 
1054  void doPresolve() ;
1055 
1057  bool evalPresolve() ;
1058 
1060  void saveOriginalSys() ;
1061 
1063  void installPresolve() ;
1064 
1066  CoinPostsolveMatrix *initialisePostsolve(CoinPresolveMatrix *&preObj) ;
1067 
1069  void doPostsolve() ;
1070 
1072  void installPostsolve() ;
1073 
1075  void destruct_presolve() ;
1076 
1078 
1082 
1084  bool ensureOwnership () const ;
1085 
1086 //}@
1087 
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,
1096  double *rhs, double *rhslow, contyp_enum *ctyp,
1097  const double *rowlb, const double *rowub) ;
1098  void gen_rowparms(int rowcnt,
1099  double *rhs, double *rhslow, contyp_enum *ctyp,
1100  const char *sense, const double *rhsin, const double *range) ;
1101  void load_problem(const CoinMpsIO &mps) ;
1102  void load_problem(const CoinPackedMatrix &matrix,
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) ;
1111 
1115  lpret_enum do_lp (ODSI_start_enum start, bool echo) ;
1116 
1118  void setBasisInLpprob (const OsiDylpWarmStartBasis *wsb,
1119  lpprob_struct *lpprob) const ;
1121 
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 ;
1132 
1133 
1135 /*
1136  There are separate groups for member and static methods so that doxygen
1137  won't promote the group to the top level.
1138 */
1140 
1141  void add_col(const CoinPackedVectorBase& coin_coli,
1142  vartyp_enum vtypi, double vlbi,
1143  double vubi, double obji, const std::string *nme) ;
1144  void add_row(const CoinPackedVectorBase& coin_rowi,
1145  char clazzi, contyp_enum ctypi,
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,
1154  OsiHintStrength hintStrength, const char *msgString) ;
1155  void pessimal_primal() ;
1156  void reduceActiveBasis() ;
1157 
1159 
1162  static contyp_enum sense_to_type(char type) ;
1163  static char type_to_sense(contyp_enum type) ;
1165 
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) ;
1175 /*
1176  Specializations for more complicated structures.
1177 */
1178  static basis_struct* copy_basis(const basis_struct* src, int dstsze) ;
1179  static void copy_basis(const basis_struct* src, basis_struct* dst) ;
1180  static lpprob_struct* copy_lpprob(const lpprob_struct* src) ;
1182 
1183 #ifndef _MSC_VER
1184 
1189  template<class T> static void assert_same(const T& t1, const T& t2,
1190  bool exact) ;
1191  template<class T> static void assert_same(const T* t1, const T* t2,
1192  int n, bool exact) ;
1193 
1194  static void assert_same(double d1, double d2, bool exact) ;
1195 
1196  static void assert_same(const basis_struct& b1,
1197  const basis_struct& b2, bool exact) ;
1198  static void assert_same(const consys_struct& c1, const
1199  consys_struct& c2, bool exact) ;
1200  static void assert_same(const conbnd_struct& c1, const
1201  conbnd_struct& c2, bool exact) ;
1202  static void assert_same(const lpprob_struct& l1,
1203  const lpprob_struct& l2, bool exact) ;
1204  static void assert_same(const OsiDylpSolverInterface& o1,
1205  const OsiDylpSolverInterface& o2, bool exact) ;
1207 #endif /* ! _MSC_VER */
1208 
1215 
1221  template<class T> inline static T* idx_vec (T* vec) { return (vec-1) ; }
1222 
1224  inline static int idx (int i) { return (i+1) ; }
1225 
1231  template<class T> inline static T* inv_vec (T* vec) { return (vec+1) ; }
1232 
1234  inline static int inv (int i) { return (i-1) ; }
1235 
1236  static pkvec_struct* packed_vector(
1237  const CoinShallowPackedVector vector, int dimension) ;
1238  static void packed_vector(
1239  const CoinShallowPackedVector vector, int dimension, pkvec_struct *dst) ;
1241 
1244  static std::string make_filename(const char *filename,
1245  const char *ext1, const char *ext2) ;
1247 
1248 } ;
1249 
1250 
1251 /*
1252  OsiDylpSolverInterfaceTest.cpp
1253 */
1254 
1262 void OsiDylpSolverInterfaceUnitTest(const std::string & mpsDir,
1263  const std::string &netLibDir) ;
1264 
1265 #endif // OsiDylpSolverInterface_H
OsiDylpSolverInterface::detach_dylp
void detach_dylp() const
startWarm
@ startWarm
Definition: OsiDylpSolverInterface.hpp:46
OsiDylpSolverInterface::unmarkHotStart
void unmarkHotStart()
Delete the hot start snapshot.
OsiDylpSolverInterface::setOsiDylpMessages
void setOsiDylpMessages(CoinMessages::Language local_language)
Set the language for messages.
OsiDylpSolverInterface::getBInvARow
virtual void getBInvARow(int row, double *abari, double *betai=0) const
Get a row of the tableau.
OsiDylpSolverInterface::activeBasis
struct OsiDylpSolverInterface::@23 activeBasis
Active basis.
OsiDylpSolverInterface::setBasisInLpprob
void setBasisInLpprob(const OsiDylpWarmStartBasis *wsb, lpprob_struct *lpprob) const
Install a basis in the lp problem structure.
OsiDylpSolverInterface::getIterationCount
int getIterationCount() const
Get the number of iterations for the last lp.
OsiDylpSolverInterface::getBInvRow
virtual void getBInvRow(int row, double *betai) const
Get a row of the basis inverse.
OsiDylpSolverInterface::initialSolve
void initialSolve()
Solve an lp from scratch.
lpret_enum
lpret_enum
Definition: dylp.h:170
OsiDylpSolverInterface::getStrParam
bool getStrParam(OsiStrParam key, std::string &value) const
Get an OSI string parameter.
OsiDylpSolverInterface::_row_sense
char * _row_sense
Definition: OsiDylpSolverInterface.hpp:979
OsiDylpSolverInterface::isDualObjectiveLimitReached
bool isDualObjectiveLimitReached() const
Is the dual objective limit reached?
OsiDylpSolverInterface::getMatrixByRow
const CoinPackedMatrix * getMatrixByRow() const
Get a pointer to a row-major copy of the constraint matrix.
OsiDylpSolverInterface::local_outchn
ioid local_outchn
Output stream for this ODSI instance.
Definition: OsiDylpSolverInterface.hpp:834
OsiDylpSolverInterface::getNumCols
int getNumCols() const
Get the number of columns (variables)
OsiDylpSolverInterface::initial_gtxecho
bool initial_gtxecho
Controls output of log information to stdout during initialSolve()
Definition: OsiDylpSolverInterface.hpp:847
OsiDylpSolverInterface::applyColCut
void applyColCut(const OsiColCut &cut)
Apply a column (variable) cut (adjust one or more bounds)
OsiDylpSolverInterface::_matrix_by_row
CoinPackedMatrix * _matrix_by_row
Definition: OsiDylpSolverInterface.hpp:985
OsiDylpSolverInterface::getMatrixByCol
const CoinPackedMatrix * getMatrixByCol() const
Get a pointer to a column-major copy of the constraint matrix.
OsiDylpSolverInterface::_col_cbar
double * _col_cbar
Definition: OsiDylpSolverInterface.hpp:974
OsiDylpSolverInterface::saved_row_range
double * saved_row_range
Definition: OsiDylpSolverInterface.hpp:1035
OsiDylpSolverInterface::solvername
const std::string solvername
Solver name (dylp).
Definition: OsiDylpSolverInterface.hpp:879
OsiDylpSolverInterface::obj_sense
double obj_sense
Objective function sense for this ODSI instance.
Definition: OsiDylpSolverInterface.hpp:871
OsiDylpSolverInterface::getHintParam
bool getHintParam(OsiHintParam key, bool &sense, OsiHintStrength &strength, void *&info) const
Get an OSI hint.
OsiDylpSolverInterface::ensureOwnership
bool ensureOwnership() const
Ensure that the solver is ready for simplex operations.
OsiDylpSolverInterface::solnIsFresh
bool solnIsFresh
The most recent solution from dylp is valid.
Definition: OsiDylpSolverInterface.hpp:948
lpopts_struct
Definition: dylp.h:1114
OsiDylpSolverInterface::balance
int balance
Definition: OsiDylpSolverInterface.hpp:941
OsiDylpSolverInterface::lp_retval
lpret_enum lp_retval
Result of last call to solver for this ODSI instance.
Definition: OsiDylpSolverInterface.hpp:864
OsiDylpSolverInterface::solveFromHotStart
void solveFromHotStart()
Call dylp to reoptimize (hot start).
lpprob_struct
Definition: dylp.h:586
OsiDylpSolverInterface::basisIsAvailable
bool basisIsAvailable() const
Check if an optimal basis is available.
OsiDylpSolverInterface::setRowLower
void setRowLower(int index, double value)
Set the lower bound on a row (constraint)
OsiDylpSolverInterface::_row_lhs
double * _row_lhs
Definition: OsiDylpSolverInterface.hpp:981
OsiDylpSolverInterface::isProvenPrimalInfeasible
bool isProvenPrimalInfeasible() const
True if dylp reported the problem to be primal infeasible.
OsiDylpSolverInterface::getColLower
const double * getColLower() const
Get the column (variable) lower bound vector.
OsiDylpSolverInterface::saved_row_lower
double * saved_row_lower
Definition: OsiDylpSolverInterface.hpp:1032
OsiDylpSolverInterface::isContinuous
bool isContinuous(int colIndex) const
Return true if the variable is continuous.
OsiDylpSolverInterface::getBInvACol
virtual void getBInvACol(int col, double *abarj) const
Get a column of the tableau.
OsiDylpSolverInterface::saved_row_upper
double * saved_row_upper
Definition: OsiDylpSolverInterface.hpp:1033
lptols_struct
Definition: dylp.h:666
OsiDylpSolverInterface::consys
consys_struct * consys
The constraint system.
Definition: OsiDylpSolverInterface.hpp:803
OsiDylpSolverInterface::isIterationLimitReached
bool isIterationLimitReached() const
True if dylp reached the iteration limit.
OsiDylpSolverInterface::odsiInfinity
double odsiInfinity
The value of infinity.
Definition: OsiDylpSolverInterface.hpp:875
OsiDylpSolverInterface::addRow
void addRow(const CoinPackedVectorBase &row, const double rowlb, const double rowub)
Add a row (constraint) to the problem.
conbnd_struct
Definition: dy_consys.h:308
OsiDylpSolverInterface::inv_vec
static T * inv_vec(T *vec)
Convert 1-based vector pointer to 0-based vector pointer.
Definition: OsiDylpSolverInterface.hpp:1231
OsiDylpSolverInterface::getReducedCost
const double * getReducedCost() const
Return the vector of reduced costs for the solution.
OsiDylpSolverInterface::getDualRays
std::vector< double * > getDualRays(int maxNumRays, bool fullRay) const
Get as many dual rays as the solver can provide.
OsiDylpSolverInterface::saved_fullsys
bool saved_fullsys
Definition: OsiDylpSolverInterface.hpp:958
OsiDylpSolverInterface::_objval
double _objval
Definition: OsiDylpSolverInterface.hpp:971
OsiDylpSolverInterface::setObjName
void setObjName(std::string name)
Set the objective function name.
OsiDylpSolverInterface::getWarmStart
CoinWarmStart * getWarmStart() const
Build a warm start object for the current lp solution.
OsiDylpSolverInterface::newLanguage
void newLanguage(CoinMessages::Language language)
Change the language for OsiDylp messages.
Definition: OsiDylpSolverInterface.hpp:569
pkvec_struct
Definition: dy_vector.h:241
OsiDylpSolverInterface::clone
OsiSolverInterface * clone(bool copyData=true) const
Clone the solver object.
OsiDylpSolverInterface::getBInvCol
virtual void getBInvCol(int col, double *betak) const
Get a column of the basis inverse.
OsiDylpSolverInterface::setObjective
void setObjective(const double *array)
Set the objective coefficients for all columns.
OsiDylpSolverInterface::make_filename
static std::string make_filename(const char *filename, const char *ext1, const char *ext2)
OsiDylpSolverInterface::isIntegerNonBinary
bool isIntegerNonBinary(int colIndex) const
Return true if the variable is general integer.
OsiDylpSolverInterface::_row_range
double * _row_range
Definition: OsiDylpSolverInterface.hpp:980
OsiDylpSolverInterface::gen_rowparms
void gen_rowparms(int rowcnt, double *rhs, double *rhslow, contyp_enum *ctyp, const double *rowlb, const double *rowub)
OsiDylpSolverInterface::setWarmStart
bool setWarmStart(const CoinWarmStart *warmStart)
Apply a warm start object.
OsiDylpSolverInterface::resolve_gtxecho
bool resolve_gtxecho
Controls output of log information to stdout during resolve() and solveFromHotStart()
Definition: OsiDylpSolverInterface.hpp:853
OsiDylpSolverInterface::installPresolve
void installPresolve()
Load the presolved problem into the ODSI object.
OsiDylpSolverInterface::_row_rhs
double * _row_rhs
Definition: OsiDylpSolverInterface.hpp:976
OsiDylpSolverInterface::applyRowCut
void applyRowCut(const OsiRowCut &cut)
Apply a row (constraint) cut (add one constraint)
OsiDylpSolverInterface::bound_to_type
contyp_enum bound_to_type(double lower, double upper)
OsiDylpSolverInterface::initialisePostsolve
CoinPostsolveMatrix * initialisePostsolve(CoinPresolveMatrix *&preObj)
Create and load a postsolve object.
OsiDylpSolverInterface::assert_same
static void assert_same(const T &t1, const T &t2, bool exact)
consys_struct
Definition: dy_consys.h:460
OsiDylpSolverInterface::getIntParam
bool getIntParam(OsiIntParam key, int &value) const
Get an OSI integer parameter.
OsiDylpSolverInterface::getBasisStatus
void getBasisStatus(int *archStatus, int *logStatus) const
Retrieve status information for architectural and logical variables.
OsiDylpSolverInterface::reset
void reset()
Reset the solver object to the state produced by the default constructor.
OsiDylpSolverInterface::destruct_col_cache
void destruct_col_cache(bool structure)
OsiDylpSolverInterface::saved_row_rhs
double * saved_row_rhs
Definition: OsiDylpSolverInterface.hpp:1031
OsiDylpSolverInterface::getInfinity
double getInfinity() const
Get dylp's value for infinity.
OsiDylpSolverInterface::evalPresolve
bool evalPresolve()
Decide whether presolve was effective enough to use.
OsiDylpSolverInterface::setHintParam
bool setHintParam(OsiHintParam key, bool sense=true, OsiHintStrength strength=OsiHintTry, void *info=0)
Set an OSI hint.
OsiDylpSolverInterface::construct_options
void construct_options()
OsiDylpSolverInterface::addCol
void addCol(const CoinPackedVectorBase &vec, const double collb, const double colub, const double obj)
Add a column (variable) to the problem.
OsiDylpSolverInterface::postObj_
CoinPostsolveMatrix * postObj_
The postsolve object.
Definition: OsiDylpSolverInterface.hpp:1018
OsiDylpSolverInterface::destruct_row_cache
void destruct_row_cache(bool structure)
OsiDylpSolverInterface::isBinary
bool isBinary(int colIndex) const
Return true if the variable is binary.
OsiDylpSolverInterface::setColUpper
void setColUpper(int index, double value)
Set the upper bound on a column (variable)
OsiDylpSolverInterface::setRowType
void setRowType(int index, char rowsen, double rowrhs, double rowrng)
Set the type of a row (constraint)
OsiDylpSolverInterface::getObjCoefficients
const double * getObjCoefficients() const
Get the objective function coefficient vector.
OsiDylpSolverInterface::getNumElements
int getNumElements() const
Get the number of non-zero coefficients.
OsiDylpSolverInterface::calc_objval
void calc_objval()
startCold
@ startCold
Definition: OsiDylpSolverInterface.hpp:46
OsiDylpSolverInterface::isProvenOptimal
bool isProvenOptimal() const
True if dylp reported an optimal solution.
OsiDylpSolverInterface::isProvenDualInfeasible
bool isProvenDualInfeasible() const
True if dylp reported the problem to be dual infeasible (primal unbounded)
OsiDylpSolverInterface::saveOriginalSys
void saveOriginalSys()
Save the original problem.
OsiDylpSolverInterface::_matrix_by_col
CoinPackedMatrix * _matrix_by_col
Definition: OsiDylpSolverInterface.hpp:984
OsiDylpSolverInterface::condition
basisCondition condition
Definition: OsiDylpSolverInterface.hpp:940
OsiDylpSolverInterface::_row_lower
double * _row_lower
Definition: OsiDylpSolverInterface.hpp:977
OsiDylpSolverInterface::lpprob
lpprob_struct * lpprob
The lp problem.
Definition: OsiDylpSolverInterface.hpp:805
OsiDylpSolverInterface::getDblParam
bool getDblParam(OsiDblParam key, double &value) const
Get an OSI double parameter.
OsiDylpSolverInterface::enableFactorization
void enableFactorization() const
Prepare the solver for the use of tableau access methods.
OsiDylpSolverInterface::statistics
lpstats_struct * statistics
The statistics structure.
Definition: OsiDylpSolverInterface.hpp:807
OsiDylpSolverInterface::_col_obj
double * _col_obj
Definition: OsiDylpSolverInterface.hpp:972
OsiDylpSolverInterface::getRowUpper
const double * getRowUpper() const
Get the row (constraint) upper bound vector.
OsiDylpSolverInterface::isPrimalObjectiveLimitReached
bool isPrimalObjectiveLimitReached() const
Is the primal objective limit reached?
OsiDylpSolverInterface
COIN OSI API for dylp.
Definition: OsiDylpSolverInterface.hpp:107
OsiDylpSolverInterface::getBasics
virtual void getBasics(int *index) const
Get indices of basic variables.
OsiDylpSolverInterface::construct_consys
void construct_consys(int cols, int rows)
dylp.h
OsiDylpSolverInterface::destruct_presolve
void destruct_presolve()
Delete presolve information.
OsiDylpSolverInterface::basisNone
@ basisNone
Definition: OsiDylpSolverInterface.hpp:919
OsiDylpSolverInterface::getRowPrice
const double * getRowPrice() const
Return the vector of dual variables for the solution.
OsiDylpSolverInterface::getObjSense
double getObjSense() const
Get the objective function sense (min/max)
OsiDylpSolverInterface::saved_row_sense
char * saved_row_sense
Definition: OsiDylpSolverInterface.hpp:1034
OsiDylpSolverInterface::getEmptyWarmStart
CoinWarmStart * getEmptyWarmStart() const
Get an empty OsiDylpWarmStartBasis object.
OsiDylpSolverInterface::construct_lpprob
void construct_lpprob()
OsiDylpSolverInterface::doPostsolve
void doPostsolve()
Apply the postsolve transforms from postActions_.
OsiDylpSolverInterface::_col_x
double * _col_x
Definition: OsiDylpSolverInterface.hpp:973
OsiDylpSolverInterface::getPrimalRays
std::vector< double * > getPrimalRays(int maxNumRays) const
Get as many primal rays as the solver can provide.
OsiDylpSolverInterface::setRowPrice
void setRowPrice(const double *)
Set the value of the dual variables in the problem solution.
OsiDylpSolverInterface::idx
static int idx(int i)
Convert 0-based index to 1-based index.
Definition: OsiDylpSolverInterface.hpp:1224
OsiDylpSolverInterface::destruct_primal_cache
void destruct_primal_cache()
OsiDylpSolverInterface::getRowRange
const double * getRowRange() const
Get the row (constraint) range vector.
contyp_enum
contyp_enum
Definition: dy_consys.h:338
OsiDylpSolverInterface::preObj_
CoinPresolveMatrix * preObj_
The presolve object.
Definition: OsiDylpSolverInterface.hpp:1001
OsiDylpSolverInterface::hotstart_fallback
CoinWarmStart * hotstart_fallback
Warm start object used as a fallback for hot start.
Definition: OsiDylpSolverInterface.hpp:896
OsiDylpSolverInterface::resolveOptions
lpopts_struct * resolveOptions
Solver options for a resolve.
Definition: OsiDylpSolverInterface.hpp:781
OsiDylpSolverInterface::setBasisStatus
int setBasisStatus(const int *archStatus, const int *logStatus)
Set a basis and update the factorization and solution.
OsiDylpSolverInterface::setObjSense
void setObjSense(double sense)
Set the sense (min/max) of the objective.
OsiDylpSolverInterface::writeMps
void writeMps(const char *basename, const char *extension="mps", double objsense=0.0) const
Write the problem into the specified file in MPS format.
OsiDylpSolverInterface::basis_ready
static bool basis_ready
Basis maintenance package is initialised.
Definition: OsiDylpSolverInterface.hpp:817
OsiDylpSolverInterface::unimp_hint
void unimp_hint(bool dylpSense, bool hintSense, OsiHintStrength hintStrength, const char *msgString)
OsiDylpSolverInterface::keepIntegers_
bool keepIntegers_
true if presolve should consider integrality
Definition: OsiDylpSolverInterface.hpp:1024
OsiDylpSolverInterface::getColUpper
const double * getColUpper() const
Get the column (variable) upper bound vector.
OsiDylpSolverInterface::add_row
void add_row(const CoinPackedVectorBase &coin_rowi, char clazzi, contyp_enum ctypi, double rhsi, double rhslowi, const std::string *nme)
OsiDylpSolverInterface::packed_vector
static pkvec_struct * packed_vector(const CoinShallowPackedVector vector, int dimension)
OsiDylpSolverInterface::destruct_problem
void destruct_problem(bool preserve_interface)
OsiDylpSolverInterface::tolerances
lptols_struct * tolerances
Solver numeric tolerances.
Definition: OsiDylpSolverInterface.hpp:784
OsiDylpSolverInterface::inv
static int inv(int i)
Convert 1-based index to 0-based index.
Definition: OsiDylpSolverInterface.hpp:1234
OsiDylpSolverInterface::setObjCoeff
void setObjCoeff(int index, double value)
Set an objective function coefficient.
ioid
int ioid
Definition: dylib_io.h:39
OsiDylpSolverInterface::postActions_
const CoinPresolveAction * postActions_
List of postsolve actions.
Definition: OsiDylpSolverInterface.hpp:1009
OsiDylpSolverInterface::activateRowCutDebugger
void activateRowCutDebugger(const char *modelName)
Activate the row cut debugger.
OsiDylpSolverInterface::dylp_controlfile
void dylp_controlfile(const char *name, const bool silent, const bool mustexist=true)
Process an options (.spc) file.
OsiDylpSolverInterface::getNumIntegers
int getNumIntegers() const
Get the number of integer variables.
OsiDylpSolverInterface::doPresolve
void doPresolve()
Perform presolve transformations.
OsiDylpSolverInterface::branchAndBound
void branchAndBound()
Invoke the solver's built-in branch-and-bound algorithm.
OsiDylpSolverInterface::basisCondition
basisCondition
Codes for basis condition.
Definition: OsiDylpSolverInterface.hpp:918
OsiDylpSolverInterface::_row_upper
double * _row_upper
Definition: OsiDylpSolverInterface.hpp:978
OsiDylpSolverInterface::assignProblem
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).
OsiDylpSolverInterface::setInteger
void setInteger(int index)
Set a single variable to be integer.
OsiDylpSolverInterface::initialSolveOptions
lpopts_struct * initialSolveOptions
Solver options for an initial solve.
Definition: OsiDylpSolverInterface.hpp:778
OsiDylpSolverInterface::load_problem
void load_problem(const CoinMpsIO &mps)
OsiDylpSolverInterface::readMps
int readMps(const char *filename, const char *extension="mps")
Read a problem description in MPS format from a file.
OsiDylpSolverInterface::disableFactorization
void disableFactorization() const
Undo the effects of enableFactorization.
OsiDylpSolverInterface::getReducedGradient
virtual void getReducedGradient(double *columnReducedCosts, double *duals, const double *c) const
Calculate duals and reduced costs for the given objective coefficients.
OsiDylpSolverInterface::basisFresh
@ basisFresh
Definition: OsiDylpSolverInterface.hpp:919
OsiDylpSolverInterface::resolve
void resolve()
Call dylp to reoptimize (warm start).
OsiDylpSolverInterface::copy
static void copy(const T *src, T *dst, int n)
OsiDylpSolverInterface::_row_price
double * _row_price
Definition: OsiDylpSolverInterface.hpp:982
OsiDylpSolverInterface::add_col
void add_col(const CoinPackedVectorBase &coin_coli, vartyp_enum vtypi, double vlbi, double vubi, double obji, const std::string *nme)
OsiDylpSolverInterface::OsiDylpSolverInterface
OsiDylpSolverInterface()
Default constructor.
OsiDylpSolverInterface::dylp_ioinit
void dylp_ioinit()
OsiDylpSolverInterface::dylp_outfile
void dylp_outfile(const char *name)
Establish an output (solution and/or statistics) file.
OsiDylpSolverInterface::setColSolution
void setColSolution(const double *colsol)
Set the value of the primal variables in the problem solution.
OsiDylpSolverInterface::idx_vec
static T * idx_vec(T *vec)
Convert 0-based vector pointer to 1-based vector pointer.
Definition: OsiDylpSolverInterface.hpp:1221
OsiDylpSolverInterface::savedConsys_
consys_struct * savedConsys_
Saved copy of original problem.
Definition: OsiDylpSolverInterface.hpp:1027
OsiDylpSolverInterface::getRightHandSide
const double * getRightHandSide() const
Get the row (constraint) right-hand-side vector.
OsiDylpSolverInterface::setDblParam
bool setDblParam(OsiDblParam key, double value)
Set an OSI double parameter.
OsiDylpSolverInterface::copy_basis
static basis_struct * copy_basis(const basis_struct *src, int dstsze)
OsiDylpSolverInterface::setLanguage
void setLanguage(CoinMessages::Language language)
An alias for OsiDylpSolverInterface::newLanguage.
Definition: OsiDylpSolverInterface.hpp:574
OsiDylpSolverInterface::do_lp
lpret_enum do_lp(ODSI_start_enum start, bool echo)
Common core method to invoke dylp.
OsiDylpSolverInterface::deleteRows
void deleteRows(const int num, const int *rowIndices)
Delete row(s) (constraint(s)) from the problem.
OsiDylpSolverInterface::getNumRows
int getNumRows() const
Get the number of rows (constraints)
OsiDylpSolverInterface::simplex
int simplex
Definition: OsiDylpSolverInterface.hpp:957
OsiDylpSolverInterface::saved_matrix_by_col
CoinPackedMatrix * saved_matrix_by_col
Definition: OsiDylpSolverInterface.hpp:1036
OsiDylpSolverInterface::pessimal_primal
void pessimal_primal()
startInvalid
@ startInvalid
Definition: OsiDylpSolverInterface.hpp:45
OsiDylpSolverInterface::destruct_cache
void destruct_cache(bool rowStructure, bool colStructure)
OsiDylpSolverInterface::saved_matrix_by_row
CoinPackedMatrix * saved_matrix_by_row
Definition: OsiDylpSolverInterface.hpp:1037
OsiDylpSolverInterface::getObjValue
double getObjValue() const
Get the objective function value for the solution.
OsiDylpSolverInterface::gen_rowiparms
void gen_rowiparms(contyp_enum *ctypi, double *rhsi, double *rhslowi, char sensei, double rhsini, double rangei)
OsiDylpSolverInterface::dylp_printsoln
void dylp_printsoln(bool wantSoln, bool wantStats)
Print the solution and/or statistics to the output file.
OsiDylpSolverInterface::copy_lpprob
static lpprob_struct * copy_lpprob(const lpprob_struct *src)
ODSI_start_enum
ODSI_start_enum
Enum to specify cold/warm/hot start.
Definition: OsiDylpSolverInterface.hpp:45
OsiDylpSolverInterface::canDoSimplexInterface
int canDoSimplexInterface() const
Return the simplex implementation level.
vartyp_enum
vartyp_enum
Definition: dy_consys.h:354
OsiDylpSolverInterface::reduceActiveBasis
void reduceActiveBasis()
OsiDylpWarmStartBasis
The dylp warm start class.
Definition: OsiDylpWarmStartBasis.hpp:44
OsiDylpSolverInterface::markHotStart
void markHotStart()
Create a hot start snapshot.
OsiDylpSolverInterface::simplex_state
struct OsiDylpSolverInterface::@24 simplex_state
State related to the OsiSimplex interface.
OsiDylpSolverInterface::destruct_dual_cache
void destruct_dual_cache()
OsiDylpSolverInterface::dylp_logfile
void dylp_logfile(const char *name, bool echo=false)
Establish a log file.
OsiDylpSolverInterface::local_logchn
ioid local_logchn
Log stream for this ODSI instance.
Definition: OsiDylpSolverInterface.hpp:841
lpstats_struct
Definition: dylp.h:1303
OsiDylpSolverInterface::passLimit_
int passLimit_
Limit for iterations of the major presolve loop.
Definition: OsiDylpSolverInterface.hpp:1021
OsiDylpSolverInterface::~OsiDylpSolverInterface
~OsiDylpSolverInterface()
Destructor.
startHot
@ startHot
Definition: OsiDylpSolverInterface.hpp:46
OsiDylpSolverInterface::getRowActivity
const double * getRowActivity() const
Return the vector of row activity for the solution.
OsiDylpSolverInterface::saved_col_obj
double * saved_col_obj
Saved pointers to cached structural vectors.
Definition: OsiDylpSolverInterface.hpp:1030
OsiDylpSolverInterface::OsiDylpSolverInterfaceUnitTest
friend void OsiDylpSolverInterfaceUnitTest(const std::string &mpsDir, const std::string &netLibDir)
Unit test for OsiDylpSolverInterface.
OsiDylpSolverInterface::basisModified
@ basisModified
Definition: OsiDylpSolverInterface.hpp:919
OsiDylpSolverInterface::setContinuous
void setContinuous(int index)
Set a single variable to be continuous.
OsiDylpSolverInterface::getRowSense
const char * getRowSense() const
Get the row sense (constraint type) vector.
OsiDylpSolverInterface::setColLower
void setColLower(int index, double value)
Set the lower bound on a column (variable)
OsiDylpSolverInterface::getColSolution
const double * getColSolution() const
Return the vector of primal variables for the solution.
OsiDylpSolverInterface::isAbandoned
bool isAbandoned() const
True if dylp abandoned the problem.
OsiDylpSolverInterface::basis
CoinWarmStart * basis
Definition: OsiDylpSolverInterface.hpp:939
OsiDylpSolverInterface::info_
void * info_[OsiLastHintParam]
Array for info blocks associated with hints.
Definition: OsiDylpSolverInterface.hpp:883
OsiDylpSolverInterface::mps_debug
bool mps_debug
Allow messages from CoinMpsIO package.
Definition: OsiDylpSolverInterface.hpp:887
OsiDylpSolverInterface::loadProblem
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).
OsiDylpSolverInterface::setRowUpper
void setRowUpper(int index, double value)
Set the upper bound on a row (constraint)
OsiDylpSolverInterface::setStrParam
bool setStrParam(OsiStrParam key, const std::string &value)
Set an OSI string parameter.
OsiDylpSolverInterface::setIntParam
bool setIntParam(OsiIntParam key, int value)
Set an OSI integer parameter.
OsiDylpSolverInterface::getRowLower
const double * getRowLower() const
Get the row (constraint) lower bound vector.
OsiDylpSolverInterface::operator=
OsiDylpSolverInterface & operator=(const OsiDylpSolverInterface &rhs)
Assignment.
OsiDylpSolverInterface::reference_count
static int reference_count
Number of outstanding ODSI objects.
Definition: OsiDylpSolverInterface.hpp:815
OsiDylpSolverInterface::type_to_sense
static char type_to_sense(contyp_enum type)
OsiDylpSolverInterface::basisDamaged
@ basisDamaged
Definition: OsiDylpSolverInterface.hpp:919
OsiDylpSolverInterface::setColName
void setColName(int ndx, std::string name)
Set a column name.
OsiDylpSolverInterface::setRowName
void setRowName(int ndx, std::string name)
Set a row name.
OsiDylpSolverInterface::isInteger
bool isInteger(int colIndex) const
Return true if the variable is integer (general or binary)
basis_struct
Definition: dylp.h:453
OsiDylpSolverInterface::sense_to_type
static contyp_enum sense_to_type(char type)
OsiDylpSolverInterface::installPostsolve
void installPostsolve()
Reload the original constraint system with the postsolved basis.
OsiDylpSolverInterface::initialisePresolve
CoinPresolveMatrix * initialisePresolve(bool keepIntegers)
Create and load a presolve object.
OsiDylpSolverInterface::deleteCols
void deleteCols(const int num, const int *colIndices)
Remove column(s) (variable(s)) from the problem.