00001
00002
00003 #ifndef OsiSolverInterface_H
00004 #define OsiSolverInterface_H
00005
00006 #include <string>
00007 #include <vector>
00008
00009 #include "CoinMessageHandler.hpp"
00010 #include "CoinPackedVectorBase.hpp"
00011
00012 #include "OsiCollections.hpp"
00013 #include "OsiSolverParameters.hpp"
00014
00015 class CoinPackedMatrix;
00016 class CoinWarmStart;
00017 class CoinSnapshot;
00018 class CoinLpIO;
00019 class CoinMpsIO;
00020
00021 class OsiCuts;
00022 class OsiAuxInfo;
00023 class OsiRowCut;
00024 class OsiRowCutDebugger;
00025 class CoinSet;
00026 class CoinBuild;
00027 class CoinModel;
00028 class OsiSolverBranch;
00029 class OsiSolverResult;
00030 class OsiObject;
00031 #include "CoinFinite.hpp"
00032
00033
00034
00035
00059 class OsiSolverInterface {
00060 friend int OsiSolverInterfaceCommonUnitTest(
00061 const OsiSolverInterface* emptySi,
00062 const std::string & mpsDir,
00063 const std::string & netlibDir);
00064 friend int OsiSolverInterfaceMpsUnitTest(
00065 const std::vector<OsiSolverInterface*> & vecSiP,
00066 const std::string & mpsDir);
00067
00068 public:
00069
00071 class ApplyCutsReturnCode {
00072 friend class OsiSolverInterface;
00073 friend class OsiOslSolverInterface;
00074
00075 public:
00077
00078
00079 ApplyCutsReturnCode():
00080 intInconsistent_(0),
00081 extInconsistent_(0),
00082 infeasible_(0),
00083 ineffective_(0),
00084 applied_(0) {}
00086 ApplyCutsReturnCode(const ApplyCutsReturnCode & rhs):
00087 intInconsistent_(rhs.intInconsistent_),
00088 extInconsistent_(rhs.extInconsistent_),
00089 infeasible_(rhs.infeasible_),
00090 ineffective_(rhs.ineffective_),
00091 applied_(rhs.applied_) {}
00093 ApplyCutsReturnCode & operator=(const ApplyCutsReturnCode& rhs)
00094 {
00095 if (this != &rhs) {
00096 intInconsistent_ = rhs.intInconsistent_;
00097 extInconsistent_ = rhs.extInconsistent_;
00098 infeasible_ = rhs.infeasible_;
00099 ineffective_ = rhs.ineffective_;
00100 applied_ = rhs.applied_;
00101 }
00102 return *this;
00103 }
00105 ~ApplyCutsReturnCode(){}
00107
00110
00111 inline int getNumInconsistent(){return intInconsistent_;}
00113 inline int getNumInconsistentWrtIntegerModel(){return extInconsistent_;}
00115 inline int getNumInfeasible(){return infeasible_;}
00117 inline int getNumIneffective(){return ineffective_;}
00119 inline int getNumApplied(){return applied_;}
00121
00122 private:
00125
00126 inline void incrementInternallyInconsistent(){intInconsistent_++;}
00128 inline void incrementExternallyInconsistent(){extInconsistent_++;}
00130 inline void incrementInfeasible(){infeasible_++;}
00132 inline void incrementIneffective(){ineffective_++;}
00134 inline void incrementApplied(){applied_++;}
00136
00138
00139
00140 int intInconsistent_;
00142 int extInconsistent_;
00144 int infeasible_;
00146 int ineffective_;
00148 int applied_;
00150 };
00151
00152
00153
00155
00156
00157 virtual void initialSolve() = 0;
00158
00160 virtual void resolve() = 0;
00161
00163 virtual void branchAndBound() = 0;
00164
00165 #ifdef CBC_NEXT_VERSION
00166
00183 virtual int solveBranches(int depth,const OsiSolverBranch * branch,
00184 OsiSolverResult * result,
00185 int & numberSolves, int & numberIterations,
00186 bool forceBranch=false);
00187 #endif
00188
00189
00190
00248
00249 virtual bool setIntParam(OsiIntParam key, int value) {
00250 if (key == OsiLastIntParam) return (false) ;
00251 intParam_[key] = value;
00252 return true;
00253 }
00254
00255 virtual bool setDblParam(OsiDblParam key, double value) {
00256 if (key == OsiLastDblParam) return (false) ;
00257 dblParam_[key] = value;
00258 return true;
00259 }
00260
00261 virtual bool setStrParam(OsiStrParam key, const std::string & value) {
00262 if (key == OsiLastStrParam) return (false) ;
00263 strParam_[key] = value;
00264 return true;
00265 }
00266
00267 virtual bool setHintParam(OsiHintParam key, bool yesNo=true,
00268 OsiHintStrength strength=OsiHintTry,
00269 void * otherInformation=NULL) {
00270 if (key==OsiLastHintParam)
00271 return false;
00272 hintParam_[key] = yesNo;
00273 hintStrength_[key] = strength;
00274 if (strength == OsiForceDo)
00275 throw CoinError("OsiForceDo illegal",
00276 "setHintParam", "OsiSolverInterface");
00277 return true;
00278 }
00279
00280 virtual bool getIntParam(OsiIntParam key, int& value) const {
00281 if (key == OsiLastIntParam) return (false) ;
00282 value = intParam_[key];
00283 return true;
00284 }
00285
00286 virtual bool getDblParam(OsiDblParam key, double& value) const {
00287 if (key == OsiLastDblParam) return (false) ;
00288 value = dblParam_[key];
00289 return true;
00290 }
00294 inline double getIntegerTolerance() const
00295 { return dblParam_[OsiPrimalTolerance];}
00296
00297 virtual bool getStrParam(OsiStrParam key, std::string& value) const {
00298 if (key == OsiLastStrParam) return (false) ;
00299 value = strParam_[key];
00300 return true;
00301 }
00302
00303 virtual bool getHintParam(OsiHintParam key, bool& yesNo,
00304 OsiHintStrength& strength,
00305 void *& otherInformation) const {
00306 if (key==OsiLastHintParam)
00307 return false;
00308 yesNo = hintParam_[key];
00309 strength = hintStrength_[key];
00310 otherInformation=NULL;
00311 return true;
00312 }
00313
00314 virtual bool getHintParam(OsiHintParam key, bool& yesNo,
00315 OsiHintStrength& strength) const {
00316 if (key==OsiLastHintParam)
00317 return false;
00318 yesNo = hintParam_[key];
00319 strength = hintStrength_[key];
00320 return true;
00321 }
00322
00323 virtual bool getHintParam(OsiHintParam key, bool& yesNo) const {
00324 if (key==OsiLastHintParam)
00325 return false;
00326 yesNo = hintParam_[key];
00327 return true;
00328 }
00329
00330 void copyParameters(OsiSolverInterface & rhs);
00332
00333
00335
00336
00337 virtual bool isAbandoned() const = 0;
00339 virtual bool isProvenOptimal() const = 0;
00341 virtual bool isProvenPrimalInfeasible() const = 0;
00343 virtual bool isProvenDualInfeasible() const = 0;
00345 virtual bool isPrimalObjectiveLimitReached() const = 0;
00347 virtual bool isDualObjectiveLimitReached() const = 0;
00349 virtual bool isIterationLimitReached() const = 0;
00351
00352
00370 virtual CoinWarmStart *getEmptyWarmStart () const = 0 ;
00371
00378 virtual CoinWarmStart* getWarmStart() const = 0;
00387 virtual CoinWarmStart* getPointerToWarmStart(bool & mustDelete) ;
00388
00397 virtual bool setWarmStart(const CoinWarmStart* warmstart) = 0;
00399
00400
00421
00422 virtual void markHotStart();
00424 virtual void solveFromHotStart();
00426 virtual void unmarkHotStart();
00428
00429
00440
00441 virtual int getNumCols() const = 0;
00442
00444 virtual int getNumRows() const = 0;
00445
00447 virtual int getNumElements() const = 0;
00448
00450 virtual int getNumIntegers() const ;
00451
00453 virtual const double * getColLower() const = 0;
00454
00456 virtual const double * getColUpper() const = 0;
00457
00467 virtual const char * getRowSense() const = 0;
00468
00481 virtual const double * getRightHandSide() const = 0;
00482
00491 virtual const double * getRowRange() const = 0;
00492
00494 virtual const double * getRowLower() const = 0;
00495
00497 virtual const double * getRowUpper() const = 0;
00498
00500 virtual const double * getObjCoefficients() const = 0;
00501
00503 virtual double getObjSense() const = 0;
00504
00506 virtual bool isContinuous(int colIndex) const = 0;
00507
00509 virtual bool isBinary(int colIndex) const;
00510
00515 virtual bool isInteger(int colIndex) const;
00516
00518 virtual bool isIntegerNonBinary(int colIndex) const;
00519
00521 virtual bool isFreeBinary(int colIndex) const;
00527 virtual const char * columnType(bool refresh=false) const;
00528
00530 virtual const CoinPackedMatrix * getMatrixByRow() const = 0;
00531
00533 virtual const CoinPackedMatrix * getMatrixByCol() const = 0;
00534
00536 virtual CoinPackedMatrix * getMutableMatrixByRow() const {return NULL;}
00537
00539 virtual CoinPackedMatrix * getMutableMatrixByCol() const {return NULL;}
00540
00542 virtual double getInfinity() const = 0;
00544
00547
00548 virtual const double * getColSolution() const = 0;
00549
00551 virtual const double * getRowPrice() const = 0;
00552
00554 virtual const double * getReducedCost() const = 0;
00555
00558 virtual const double * getRowActivity() const = 0;
00559
00561 virtual double getObjValue() const = 0;
00562
00565 virtual int getIterationCount() const = 0;
00566
00580 virtual std::vector<double*> getDualRays(int maxNumRays) const = 0;
00592 virtual std::vector<double*> getPrimalRays(int maxNumRays) const = 0;
00593
00596 virtual OsiVectorInt getFractionalIndices(const double etol=1.e-05)
00597 const;
00599
00600
00613 virtual void setObjCoeff( int elementIndex, double elementValue ) = 0;
00614
00616 virtual void setObjCoeffSet(const int* indexFirst,
00617 const int* indexLast,
00618 const double* coeffList);
00619
00625 virtual void setObjective(const double * array);
00626
00637 virtual void setObjSense(double s) = 0;
00638
00639
00642 virtual void setColLower( int elementIndex, double elementValue ) = 0;
00643
00649 virtual void setColLower(const double * array);
00650
00653 virtual void setColUpper( int elementIndex, double elementValue ) = 0;
00654
00660 virtual void setColUpper(const double * array);
00661
00662
00666 virtual void setColBounds( int elementIndex,
00667 double lower, double upper ) {
00668 setColLower(elementIndex, lower);
00669 setColUpper(elementIndex, upper);
00670 }
00671
00678 virtual void setColSetBounds(const int* indexFirst,
00679 const int* indexLast,
00680 const double* boundList);
00681
00684 virtual void setRowLower( int elementIndex, double elementValue ) = 0;
00685
00688 virtual void setRowUpper( int elementIndex, double elementValue ) = 0;
00689
00693 virtual void setRowBounds( int elementIndex,
00694 double lower, double upper ) {
00695 setRowLower(elementIndex, lower);
00696 setRowUpper(elementIndex, upper);
00697 }
00698
00705 virtual void setRowSetBounds(const int* indexFirst,
00706 const int* indexLast,
00707 const double* boundList);
00708
00709
00711 virtual void setRowType(int index, char sense, double rightHandSide,
00712 double range) = 0;
00713
00718 virtual void setRowSetTypes(const int* indexFirst,
00719 const int* indexLast,
00720 const char* senseList,
00721 const double* rhsList,
00722 const double* rangeList);
00723
00733 virtual void setColSolution(const double *colsol) = 0;
00734
00744 virtual void setRowPrice(const double * rowprice) = 0;
00745
00754 virtual int reducedCostFix(double gap, bool justInteger=true);
00756
00757
00761 virtual void setContinuous(int index) = 0;
00763 virtual void setInteger(int index) = 0;
00766 virtual void setContinuous(const int* indices, int len);
00769 virtual void setInteger(const int* indices, int len);
00771
00772
00773
00774
00776 typedef std::vector<std::string> OsiNameVec ;
00777
00798
00808 virtual std::string dfltRowColName(char rc,
00809 int ndx, unsigned digits = 7) const ;
00810
00813 virtual std::string getObjName (unsigned maxLen = (unsigned)std::string::npos) const ;
00814
00817 virtual inline void setObjName (std::string name)
00818 { objName_ = name ; }
00819
00826 virtual std::string getRowName(int rowIndex,
00827 unsigned maxLen = (unsigned)std::string::npos) const ;
00828
00840 virtual const OsiNameVec &getRowNames() ;
00841
00847 virtual void setRowName(int ndx, std::string name) ;
00848
00855 virtual void setRowNames(OsiNameVec &srcNames,
00856 int srcStart, int len, int tgtStart) ;
00857
00863 virtual void deleteRowNames(int tgtStart, int len) ;
00864
00871 virtual std::string getColName(int colIndex,
00872 unsigned maxLen = (unsigned)std::string::npos) const ;
00873
00883 virtual const OsiNameVec &getColNames() ;
00884
00890 virtual void setColName(int ndx, std::string name) ;
00891
00898 virtual void setColNames(OsiNameVec &srcNames,
00899 int srcStart, int len, int tgtStart) ;
00900
00906 virtual void deleteColNames(int tgtStart, int len) ;
00907
00908
00915 void setRowColNames(const CoinMpsIO &mps) ;
00916
00922 void setRowColNames(CoinModel &mod) ;
00923
00930 void setRowColNames(CoinLpIO &mod) ;
00931
00933
00934
00935
00941
00943 virtual void addCol(const CoinPackedVectorBase& vec,
00944 const double collb, const double colub,
00945 const double obj) = 0;
00946
00952 virtual void addCol(const CoinPackedVectorBase& vec,
00953 const double collb, const double colub,
00954 const double obj, std::string name) ;
00955
00957 virtual void addCol(int numberElements,
00958 const int* rows, const double* elements,
00959 const double collb, const double colub,
00960 const double obj) ;
00961
00967 virtual void addCol(int numberElements,
00968 const int* rows, const double* elements,
00969 const double collb, const double colub,
00970 const double obj, std::string name) ;
00971
00977 virtual void addCols(const int numcols,
00978 const CoinPackedVectorBase * const * cols,
00979 const double* collb, const double* colub,
00980 const double* obj);
00981
00987 virtual void addCols(const int numcols, const int* columnStarts,
00988 const int* rows, const double* elements,
00989 const double* collb, const double* colub,
00990 const double* obj);
00991
00993 void addCols(const CoinBuild & buildObject);
00994
01000 int addCols(CoinModel & modelObject);
01001
01002 #if 0
01003
01004 virtual void addCols(const CoinPackedMatrix& matrix,
01005 const double* collb, const double* colub,
01006 const double* obj);
01007 #endif
01008
01015 virtual void deleteCols(const int num, const int * colIndices) = 0;
01016
01018 virtual void addRow(const CoinPackedVectorBase& vec,
01019 const double rowlb, const double rowub) = 0;
01020
01026 virtual void addRow(const CoinPackedVectorBase& vec,
01027 const double rowlb, const double rowub,
01028 std::string name) ;
01029
01031 virtual void addRow(const CoinPackedVectorBase& vec,
01032 const char rowsen, const double rowrhs,
01033 const double rowrng) = 0;
01034
01040 virtual void addRow(const CoinPackedVectorBase& vec,
01041 const char rowsen, const double rowrhs,
01042 const double rowrng, std::string name) ;
01043
01048 virtual void addRow(int numberElements,
01049 const int *columns, const double *element,
01050 const double rowlb, const double rowub) ;
01051
01057 virtual void addRows(const int numrows,
01058 const CoinPackedVectorBase * const * rows,
01059 const double* rowlb, const double* rowub);
01060
01066 virtual void addRows(const int numrows,
01067 const CoinPackedVectorBase * const * rows,
01068 const char* rowsen, const double* rowrhs,
01069 const double* rowrng);
01070
01076 virtual void addRows(const int numrows, const int *rowStarts,
01077 const int *columns, const double *element,
01078 const double *rowlb, const double *rowub);
01079
01081 void addRows(const CoinBuild &buildObject);
01082
01091 int addRows(CoinModel &modelObject);
01092
01093 #if 0
01094
01095 virtual void addRows(const CoinPackedMatrix& matrix,
01096 const double* rowlb, const double* rowub);
01098 virtual void addRows(const CoinPackedMatrix& matrix,
01099 const char* rowsen, const double* rowrhs,
01100 const double* rowrng);
01101 #endif
01102
01108 virtual void deleteRows(const int num, const int * rowIndices) = 0;
01109
01112 virtual void saveBaseModel() {}
01116 virtual void restoreBaseModel(int numberRows);
01117
01140 virtual ApplyCutsReturnCode applyCuts(const OsiCuts & cs,
01141 double effectivenessLb = 0.0);
01142
01147 virtual void applyRowCuts(int numberCuts, const OsiRowCut * cuts);
01148
01152 virtual void applyRowCuts(int numberCuts, const OsiRowCut ** cuts);
01153
01155 void deleteBranchingInfo(int numberDeleted, const int * which);
01156
01158
01159
01160
01178 virtual void loadProblem (const CoinPackedMatrix& matrix,
01179 const double* collb, const double* colub,
01180 const double* obj,
01181 const double* rowlb, const double* rowub) = 0;
01182
01192 virtual void assignProblem (CoinPackedMatrix*& matrix,
01193 double*& collb, double*& colub, double*& obj,
01194 double*& rowlb, double*& rowub) = 0;
01195
01212 virtual void loadProblem (const CoinPackedMatrix& matrix,
01213 const double* collb, const double* colub,
01214 const double* obj,
01215 const char* rowsen, const double* rowrhs,
01216 const double* rowrng) = 0;
01217
01227 virtual void assignProblem (CoinPackedMatrix*& matrix,
01228 double*& collb, double*& colub, double*& obj,
01229 char*& rowsen, double*& rowrhs,
01230 double*& rowrng) = 0;
01231
01244 virtual void loadProblem (const int numcols, const int numrows,
01245 const CoinBigIndex * start, const int* index,
01246 const double* value,
01247 const double* collb, const double* colub,
01248 const double* obj,
01249 const double* rowlb, const double* rowub) = 0;
01250
01263 virtual void loadProblem (const int numcols, const int numrows,
01264 const CoinBigIndex * start, const int* index,
01265 const double* value,
01266 const double* collb, const double* colub,
01267 const double* obj,
01268 const char* rowsen, const double* rowrhs,
01269 const double* rowrng) = 0;
01270
01277 virtual int loadFromCoinModel (CoinModel & modelObject,
01278 bool keepSolution=false);
01279
01285 virtual int readMps (const char *filename,
01286 const char *extension = "mps") ;
01287
01294 virtual int readMps (const char *filename, const char*extension,
01295 int & numberSets, CoinSet ** & sets);
01296
01302 virtual int readGMPL (const char *filename, const char *dataname=NULL);
01303
01310 virtual void writeMps (const char *filename,
01311 const char *extension = "mps",
01312 double objSense=0.0) const = 0;
01313
01327 int writeMpsNative (const char *filename,
01328 const char ** rowNames, const char ** columnNames,
01329 int formatType=0,int numberAcross=2,
01330 double objSense=0.0, int numberSOS=0,
01331 const CoinSet * setInfo=NULL) const ;
01332
01333
01334
01335
01355 virtual void writeLp(const char *filename,
01356 const char *extension = "lp",
01357 double epsilon = 1e-5,
01358 int numberAcross = 10,
01359 int decimals = 5,
01360 double objSense = 0.0,
01361 bool useRowNames = true) const;
01362
01367 virtual void writeLp(FILE *fp,
01368 double epsilon = 1e-5,
01369 int numberAcross = 10,
01370 int decimals = 5,
01371 double objSense = 0.0,
01372 bool useRowNames = true) const;
01373
01392 int writeLpNative(const char *filename,
01393 char const * const * const rowNames,
01394 char const * const * const columnNames,
01395 const double epsilon = 1.0e-5,
01396 const int numberAcross = 10,
01397 const int decimals = 5,
01398 const double objSense = 0.0,
01399 const bool useRowNames = true) const;
01400
01405 int writeLpNative(FILE *fp,
01406 char const * const * const rowNames,
01407 char const * const * const columnNames,
01408 const double epsilon = 1.0e-5,
01409 const int numberAcross = 10,
01410 const int decimals = 5,
01411 const double objSense = 0.0,
01412 const bool useRowNames = true) const;
01413
01416 virtual int readLp(const char *filename, const double epsilon = 1e-5);
01417
01420 int readLp(FILE *fp, const double epsilon = 1e-5);
01421
01427 virtual void replaceMatrixOptional(const CoinPackedMatrix & matrix) {}
01429 virtual void replaceMatrix(const CoinPackedMatrix & matrix) {abort();}
01431
01432
01433
01436 #ifdef COIN_SNAPSHOT
01438 virtual CoinSnapshot * snapshot(bool createArrays=true) const;
01439 #endif
01440
01441
01442
01443
01453 void setApplicationData (void * appData);
01460 void setAuxiliaryInfo(OsiAuxInfo * auxiliaryInfo);
01461
01463 void * getApplicationData() const;
01465 OsiAuxInfo * getAuxiliaryInfo() const;
01467
01468
01482 void passInMessageHandler(CoinMessageHandler * handler);
01484 void newLanguage(CoinMessages::Language language);
01485 inline void setLanguage(CoinMessages::Language language)
01486 {newLanguage(language);}
01488 inline CoinMessageHandler * messageHandler() const
01489 {return handler_;}
01491 inline CoinMessages messages()
01492 {return messages_;}
01494 inline CoinMessages * messagesPointer()
01495 {return &messages_;}
01497 inline bool defaultHandler() const
01498 { return defaultHandler_;}
01500
01515 void findIntegers(bool justCount);
01526 virtual int findIntegersAndSOS(bool justCount);
01528 inline int numberObjects() const { return numberObjects_;}
01530 inline void setNumberObjects(int number)
01531 { numberObjects_=number;}
01532
01534 inline OsiObject ** objects() const { return object_;}
01535
01537 const inline OsiObject * object(int which) const { return object_[which];}
01539 inline OsiObject * modifiableObject(int which) const { return object_[which];}
01540
01542 void deleteObjects();
01543
01548 void addObjects(int numberObjects, OsiObject ** objects);
01553 double forceFeasible();
01555
01556
01565 virtual void activateRowCutDebugger (const char * modelName);
01566
01572 virtual void activateRowCutDebugger( const double * solution);
01582 const OsiRowCutDebugger * getRowCutDebugger() const;
01584 const OsiRowCutDebugger * getRowCutDebuggerAlways() const;
01585
01587
01588
01596 public:
01598
01599
01602 virtual int canDoSimplexInterface() const;
01609 virtual void enableSimplexInterface(bool doingPrimal) ;
01610
01612 virtual void disableSimplexInterface() ;
01613
01620 virtual void enableFactorization() const;
01622 virtual void disableFactorization() const;
01623
01628 virtual bool basisIsAvailable() const ;
01630 inline bool optimalBasisIsAvailable() const
01631 { return basisIsAvailable();}
01632
01645 virtual void getBasisStatus(int* cstat, int* rstat) const ;
01646
01653 virtual int setBasisStatus(const int* cstat, const int* rstat) ;
01654
01662 virtual int pivot(int colIn, int colOut, int outStatus) ;
01663
01675 virtual int primalPivotResult(int colIn, int sign,
01676 int& colOut, int& outStatus,
01677 double& t, CoinPackedVector* dx);
01678
01685 virtual int dualPivotResult(int& colIn, int& sign,
01686 int colOut, int outStatus,
01687 double& t, CoinPackedVector* dx) ;
01688
01690 virtual void getReducedGradient(double* columnReducedCosts,
01691 double * duals,
01692 const double * c) ;
01693
01696 virtual void setObjectiveAndRefresh(double* c) ;
01697
01699 virtual void getBInvARow(int row, double* z, double * slack=NULL) const ;
01700
01702 virtual void getBInvRow(int row, double* z) const ;
01703
01705 virtual void getBInvACol(int col, double* vec) const ;
01706
01708 virtual void getBInvCol(int col, double* vec) const ;
01709
01714 virtual void getBasics(int* index) const ;
01716
01717
01718
01720
01721
01722 OsiSolverInterface();
01723
01729 virtual OsiSolverInterface * clone(bool copyData = true) const = 0;
01730
01732 OsiSolverInterface(const OsiSolverInterface &);
01733
01735 OsiSolverInterface & operator=(const OsiSolverInterface& rhs);
01736
01738 virtual ~OsiSolverInterface ();
01739
01746 virtual void reset();
01748
01749
01750
01751 protected:
01753
01754
01755 virtual void applyRowCut( const OsiRowCut & rc ) = 0;
01756
01758 virtual void applyColCut( const OsiColCut & cc ) = 0;
01759
01762 inline void
01763 convertBoundToSense(const double lower, const double upper,
01764 char& sense, double& right, double& range) const;
01767 inline void
01768 convertSenseToBound(const char sense, const double right,
01769 const double range,
01770 double& lower, double& upper) const;
01773 template <class T> inline T
01774 forceIntoRange(const T value, const T lower, const T upper) const {
01775 return value < lower ? lower : (value > upper ? upper : value);
01776 }
01783 void setInitialData();
01785
01787
01788
01789 OsiRowCutDebugger * rowCutDebugger_;
01790
01792 CoinMessageHandler * handler_;
01798 bool defaultHandler_;
01800 CoinMessages messages_;
01802 int numberIntegers_;
01804 int numberObjects_;
01805
01807 OsiObject ** object_;
01813 mutable char * columnType_;
01814
01816
01817
01818
01819 private:
01821
01822
01823 OsiAuxInfo * appDataEtc_;
01825 int intParam_[OsiLastIntParam];
01827 double dblParam_[OsiLastDblParam];
01829 std::string strParam_[OsiLastStrParam];
01831 bool hintParam_[OsiLastHintParam];
01833 OsiHintStrength hintStrength_[OsiLastHintParam];
01836 CoinWarmStart* ws_;
01837
01839 OsiNameVec rowNames_ ;
01841 OsiNameVec colNames_ ;
01843 std::string objName_ ;
01844
01846 };
01847
01848
01856 int
01857 OsiSolverInterfaceCommonUnitTest(
01858 const OsiSolverInterface* emptySi,
01859 const std::string & mpsDir,
01860 const std::string & netlibDir);
01861
01862
01865 int
01866 OsiSolverInterfaceMpsUnitTest(
01867 const std::vector<OsiSolverInterface*> & vecSiP,
01868 const std::string & mpsDir);
01869
01870
01873 inline void
01874 OsiSolverInterface::convertBoundToSense(const double lower, const double upper,
01875 char& sense, double& right,
01876 double& range) const
01877 {
01878 double inf = getInfinity();
01879 range = 0.0;
01880 if (lower > -inf) {
01881 if (upper < inf) {
01882 right = upper;
01883 if (upper==lower) {
01884 sense = 'E';
01885 } else {
01886 sense = 'R';
01887 range = upper - lower;
01888 }
01889 } else {
01890 sense = 'G';
01891 right = lower;
01892 }
01893 } else {
01894 if (upper < inf) {
01895 sense = 'L';
01896 right = upper;
01897 } else {
01898 sense = 'N';
01899 right = 0.0;
01900 }
01901 }
01902 }
01903
01904
01907 inline void
01908 OsiSolverInterface::convertSenseToBound(const char sense, const double right,
01909 const double range,
01910 double& lower, double& upper) const
01911 {
01912 double inf=getInfinity();
01913 switch (sense) {
01914 case 'E':
01915 lower = upper = right;
01916 break;
01917 case 'L':
01918 lower = -inf;
01919 upper = right;
01920 break;
01921 case 'G':
01922 lower = right;
01923 upper = inf;
01924 break;
01925 case 'R':
01926 lower = right - range;
01927 upper = right;
01928 break;
01929 case 'N':
01930 lower = -inf;
01931 upper = inf;
01932 break;
01933 }
01934 }
01935
01936 #endif