- Main Page
- Modules
- Namespaces
- Classes
- Files
- Related Pages

- File List
- File Members

# /home/coin/SVN-release/Alps-1.3.0/Osi/src/Osi/OsiSolverInterface.hpp

Go to the documentation of this file.

    00001 // Copyright (C) 2000, International Business Machines
    00002 // Corporation and others.  All Rights Reserved.
    00003 // This code is licensed under the terms of the Eclipse Public License (EPL).
    00004
    00005 #ifndef OsiSolverInterface_H
    00006 #define OsiSolverInterface_H
    00007
    00008 #include <cstdlib>
    00009 #include <string>
    00010 #include <vector>
    00011
    00012 #include "CoinMessageHandler.hpp"
    00013 #include "CoinPackedVectorBase.hpp"
    00014 #include "CoinTypes.hpp"
    00015
    00016 #include "OsiCollections.hpp"
    00017 #include "OsiSolverParameters.hpp"
    00018
    00019 class CoinPackedMatrix;
    00020 class CoinWarmStart;
    00021 class CoinSnapshot;
    00022 class CoinLpIO;
    00023 class CoinMpsIO;
    00024
    00025 class OsiCuts;
    00026 class OsiAuxInfo;
    00027 class OsiRowCut;
    00028 class OsiRowCutDebugger;
    00029 class CoinSet;
    00030 class CoinBuild;
    00031 class CoinModel;
    00032 class OsiSolverBranch;
    00033 class OsiSolverResult;
    00034 class OsiObject;
    00035
    00036
    00037 //#############################################################################
    00038
    00060 class OsiSolverInterface  {
    00061    friend void OsiSolverInterfaceCommonUnitTest(
    00062       const OsiSolverInterface* emptySi,
    00063       const std::string & mpsDir,
    00064       const std::string & netlibDir);
    00065    friend void OsiSolverInterfaceMpsUnitTest(
    00066       const std::vector<OsiSolverInterface*> & vecSiP,
    00067       const std::string & mpsDir);
    00068
    00069 public:
    00070
    00072   class ApplyCutsReturnCode {
    00073     friend class OsiSolverInterface;
    00074     friend class OsiOslSolverInterface;
    00075     friend class OsiClpSolverInterface;
    00076
    00077   public:
    00079
    00080
    00081       ApplyCutsReturnCode():
    00082          intInconsistent_(0),
    00083          extInconsistent_(0),
    00084          infeasible_(0),
    00085          ineffective_(0),
    00086          applied_(0) {}
    00088       ApplyCutsReturnCode(const ApplyCutsReturnCode & rhs):
    00089          intInconsistent_(rhs.intInconsistent_),
    00090          extInconsistent_(rhs.extInconsistent_),
    00091          infeasible_(rhs.infeasible_),
    00092          ineffective_(rhs.ineffective_),
    00093          applied_(rhs.applied_) {}
    00095       ApplyCutsReturnCode & operator=(const ApplyCutsReturnCode& rhs)
    00096       {
    00097         if (this != &rhs) {
    00098           intInconsistent_ = rhs.intInconsistent_;
    00099           extInconsistent_ = rhs.extInconsistent_;
    00100           infeasible_      = rhs.infeasible_;
    00101           ineffective_     = rhs.ineffective_;
    00102           applied_         = rhs.applied_;
    00103         }
    00104         return *this;
    00105       }
    00107       ~ApplyCutsReturnCode(){}
    00109
    00112
    00113       inline int getNumInconsistent(){return intInconsistent_;}
    00115       inline int getNumInconsistentWrtIntegerModel(){return extInconsistent_;}
    00117       inline int getNumInfeasible(){return infeasible_;}
    00119       inline int getNumIneffective(){return ineffective_;}
    00121       inline int getNumApplied(){return applied_;}
    00123
    00124   private:
    00127
    00128       inline void incrementInternallyInconsistent(){intInconsistent_++;}
    00130       inline void incrementExternallyInconsistent(){extInconsistent_++;}
    00132       inline void incrementInfeasible(){infeasible_++;}
    00134       inline void incrementIneffective(){ineffective_++;}
    00136       inline void incrementApplied(){applied_++;}
    00138
    00140
    00141
    00142       int intInconsistent_;
    00144       int extInconsistent_;
    00146       int infeasible_;
    00148       int ineffective_;
    00150       int applied_;
    00152   };
    00153
    00154   //---------------------------------------------------------------------------
    00155
    00157
    00158
    00159     virtual void initialSolve() = 0;
    00160
    00166     virtual void resolve() = 0;
    00167
    00169     virtual void branchAndBound() = 0;
    00170
    00171 #ifdef CBC_NEXT_VERSION
    00172     /*
    00173       Would it make sense to collect all of these routines in a `MIP Helper'
    00174       section? It'd make it easier for users and implementors to find them.
    00175     */
    00193     virtual int solveBranches(int depth,const OsiSolverBranch * branch,
    00194                               OsiSolverResult * result,
    00195                               int & numberSolves, int & numberIterations,
    00196                               bool forceBranch=false);
    00197 #endif
    00198
    00199
    00200   //---------------------------------------------------------------------------
    00258
    00259     virtual bool setIntParam(OsiIntParam key, int value) {
    00260       if (key == OsiLastIntParam) return (false) ;
    00261       intParam_[key] = value;
    00262       return true;
    00263     }
    00265     virtual bool setDblParam(OsiDblParam key, double value) {
    00266       if (key == OsiLastDblParam) return (false) ;
    00267       dblParam_[key] = value;
    00268       return true;
    00269     }
    00271     virtual bool setStrParam(OsiStrParam key, const std::string & value) {
    00272       if (key == OsiLastStrParam) return (false) ;
    00273       strParam_[key] = value;
    00274       return true;
    00275     }
    00287     virtual bool setHintParam(OsiHintParam key, bool yesNo=true,
    00288                               OsiHintStrength strength=OsiHintTry,
    00289                               void * /*otherInformation*/ = NULL) {
    00290       if (key==OsiLastHintParam)
    00291         return false;
    00292       hintParam_[key] = yesNo;
    00293       hintStrength_[key] = strength;
    00294       if (strength == OsiForceDo)
    00295         throw CoinError("OsiForceDo illegal",
    00296                         "setHintParam", "OsiSolverInterface");
    00297       return true;
    00298     }
    00300     virtual bool getIntParam(OsiIntParam key, int& value) const {
    00301       if (key == OsiLastIntParam) return (false) ;
    00302       value = intParam_[key];
    00303       return true;
    00304     }
    00306     virtual bool getDblParam(OsiDblParam key, double& value) const {
    00307       if (key == OsiLastDblParam) return (false) ;
    00308       value = dblParam_[key];
    00309       return true;
    00310     }
    00312     virtual bool getStrParam(OsiStrParam key, std::string& value) const {
    00313       if (key == OsiLastStrParam) return (false) ;
    00314       value = strParam_[key];
    00315       return true;
    00316     }
    00326     virtual bool getHintParam(OsiHintParam key, bool& yesNo,
    00327                               OsiHintStrength& strength,
    00328                               void *& otherInformation) const {
    00329       if (key==OsiLastHintParam)
    00330         return false;
    00331       yesNo = hintParam_[key];
    00332       strength = hintStrength_[key];
    00333       otherInformation=NULL;
    00334       return true;
    00335     }
    00340     virtual bool getHintParam(OsiHintParam key, bool& yesNo,
    00341                               OsiHintStrength& strength) const {
    00342       if (key==OsiLastHintParam)
    00343         return false;
    00344       yesNo = hintParam_[key];
    00345       strength = hintStrength_[key];
    00346       return true;
    00347     }
    00352     virtual bool getHintParam(OsiHintParam key, bool& yesNo) const {
    00353       if (key==OsiLastHintParam)
    00354         return false;
    00355       yesNo = hintParam_[key];
    00356       return true;
    00357     }
    00364     void copyParameters(OsiSolverInterface & rhs);
    00365
    00379     inline double getIntegerTolerance() const
    00380     { return dblParam_[OsiPrimalTolerance];}
    00382
    00383   //---------------------------------------------------------------------------
    00385
    00386
    00387     virtual bool isAbandoned() const = 0;
    00389     virtual bool isProvenOptimal() const = 0;
    00391     virtual bool isProvenPrimalInfeasible() const = 0;
    00393     virtual bool isProvenDualInfeasible() const = 0;
    00395     virtual bool isPrimalObjectiveLimitReached() const;
    00397     virtual bool isDualObjectiveLimitReached() const;
    00399     virtual bool isIterationLimitReached() const = 0;
    00401
    00402   //---------------------------------------------------------------------------
    00420     virtual CoinWarmStart *getEmptyWarmStart () const = 0 ;
    00421
    00428     virtual CoinWarmStart* getWarmStart() const = 0;
    00437     virtual CoinWarmStart* getPointerToWarmStart(bool & mustDelete) ;
    00438
    00447     virtual bool setWarmStart(const CoinWarmStart* warmstart) = 0;
    00449
    00450   //---------------------------------------------------------------------------
    00471
    00472     virtual void markHotStart();
    00474     virtual void solveFromHotStart();
    00476     virtual void unmarkHotStart();
    00478
    00479   //---------------------------------------------------------------------------
    00490
    00491     virtual int getNumCols() const = 0;
    00492
    00494     virtual int getNumRows() const = 0;
    00495
    00497     virtual int getNumElements() const = 0;
    00498
    00500     virtual int getNumIntegers() const ;
    00501
    00503     virtual const double * getColLower() const = 0;
    00504
    00506     virtual const double * getColUpper() const = 0;
    00507
    00518     virtual const char * getRowSense() const = 0;
    00519
    00533     virtual const double * getRightHandSide() const = 0;
    00534
    00544     virtual const double * getRowRange() const = 0;
    00545
    00547     virtual const double * getRowLower() const = 0;
    00548
    00550     virtual const double * getRowUpper() const = 0;
    00551
    00555     virtual const double * getObjCoefficients() const = 0;
    00556
    00562     virtual double getObjSense() const = 0;
    00563
    00565     virtual bool isContinuous(int colIndex) const = 0;
    00566
    00568     virtual bool isBinary(int colIndex) const;
    00569
    00574     virtual bool isInteger(int colIndex) const;
    00575
    00577     virtual bool isIntegerNonBinary(int colIndex) const;
    00578
    00580     virtual bool isFreeBinary(int colIndex) const;
    00581
    00586     inline const char *columnType(bool refresh=false) const
    00587     { return getColType(refresh); }
    00588
    00600     virtual const char * getColType(bool refresh=false) const;
    00601
    00603     virtual const CoinPackedMatrix * getMatrixByRow() const = 0;
    00604
    00606     virtual const CoinPackedMatrix * getMatrixByCol() const = 0;
    00607
    00613     virtual CoinPackedMatrix * getMutableMatrixByRow() const {return NULL;}
    00614
    00620     virtual CoinPackedMatrix * getMutableMatrixByCol() const {return NULL;}
    00621
    00623     virtual double getInfinity() const = 0;
    00625
    00628
    00629     virtual const double * getColSolution() const = 0;
    00630
    00634     virtual const double * getStrictColSolution();
    00635
    00637     virtual const double * getRowPrice() const = 0;
    00638
    00640     virtual const double * getReducedCost() const = 0;
    00641
    00647     virtual const double * getRowActivity() const = 0;
    00648
    00650     virtual double getObjValue() const = 0;
    00651
    00655     virtual int getIterationCount() const = 0;
    00656
    00679     virtual std::vector<double*> getDualRays(int maxNumRays,
    00680                                              bool fullRay = false) const = 0;
    00681
    00697     virtual std::vector<double*> getPrimalRays(int maxNumRays) const = 0;
    00698
    00701     virtual OsiVectorInt getFractionalIndices(const double etol=1.e-05)
    00702       const;
    00704
    00705   //-------------------------------------------------------------------------
    00718     virtual void setObjCoeff( int elementIndex, double elementValue ) = 0;
    00719
    00721     virtual void setObjCoeffSet(const int* indexFirst,
    00722                                 const int* indexLast,
    00723                                 const double* coeffList);
    00724
    00730     virtual void setObjective(const double * array);
    00731
    00742     virtual void setObjSense(double s) = 0;
    00743
    00744
    00747     virtual void setColLower( int elementIndex, double elementValue ) = 0;
    00748
    00754     virtual void setColLower(const double * array);
    00755
    00758     virtual void setColUpper( int elementIndex, double elementValue ) = 0;
    00759
    00765     virtual void setColUpper(const double * array);
    00766
    00767
    00771     virtual void setColBounds( int elementIndex,
    00772                                double lower, double upper ) {
    00773        setColLower(elementIndex, lower);
    00774        setColUpper(elementIndex, upper);
    00775     }
    00776
    00783     virtual void setColSetBounds(const int* indexFirst,
    00784                                  const int* indexLast,
    00785                                  const double* boundList);
    00786
    00789     virtual void setRowLower( int elementIndex, double elementValue ) = 0;
    00790
    00793     virtual void setRowUpper( int elementIndex, double elementValue ) = 0;
    00794
    00798     virtual void setRowBounds( int elementIndex,
    00799                                double lower, double upper ) {
    00800        setRowLower(elementIndex, lower);
    00801        setRowUpper(elementIndex, upper);
    00802     }
    00803
    00810     virtual void setRowSetBounds(const int* indexFirst,
    00811                                  const int* indexLast,
    00812                                  const double* boundList);
    00813
    00814
    00816     virtual void setRowType(int index, char sense, double rightHandSide,
    00817                             double range) = 0;
    00818
    00823     virtual void setRowSetTypes(const int* indexFirst,
    00824                                 const int* indexLast,
    00825                                 const char* senseList,
    00826                                 const double* rhsList,
    00827                                 const double* rangeList);
    00828
    00838     virtual void setColSolution(const double *colsol) = 0;
    00839
    00849     virtual void setRowPrice(const double * rowprice) = 0;
    00850
    00859     virtual int reducedCostFix(double gap, bool justInteger=true);
    00861
    00862   //-------------------------------------------------------------------------
    00866     virtual void setContinuous(int index) = 0;
    00868     virtual void setInteger(int index) = 0;
    00871     virtual void setContinuous(const int* indices, int len);
    00874     virtual void setInteger(const int* indices, int len);
    00876   //-------------------------------------------------------------------------
    00877
    00878   //-------------------------------------------------------------------------
    00879
    00881     typedef std::vector<std::string> OsiNameVec ;
    00882
    00903
    00913     virtual std::string dfltRowColName(char rc,
    00914                                  int ndx, unsigned digits = 7) const ;
    00915
    00918   virtual std::string getObjName (unsigned maxLen = static_cast<unsigned>(std::string::npos)) const ;
    00919
    00922     virtual inline void setObjName (std::string name)
    00923     { objName_ = name ; }
    00924
    00931     virtual std::string getRowName(int rowIndex,
    00932                                    unsigned maxLen = static_cast<unsigned>(std::string::npos)) const ;
    00933
    00945     virtual const OsiNameVec &getRowNames() ;
    00946
    00952     virtual void setRowName(int ndx, std::string name) ;
    00953
    00960     virtual void setRowNames(OsiNameVec &srcNames,
    00961                      int srcStart, int len, int tgtStart) ;
    00962
    00968     virtual void deleteRowNames(int tgtStart, int len) ;
    00969
    00976     virtual std::string getColName(int colIndex,
    00977                                    unsigned maxLen = static_cast<unsigned>(std::string::npos)) const ;
    00978
    00988     virtual const OsiNameVec &getColNames() ;
    00989
    00995     virtual void setColName(int ndx, std::string name) ;
    00996
    01003     virtual void setColNames(OsiNameVec &srcNames,
    01004                      int srcStart, int len, int tgtStart) ;
    01005
    01011     virtual void deleteColNames(int tgtStart, int len) ;
    01012
    01013
    01020     void setRowColNames(const CoinMpsIO &mps) ;
    01021
    01027     void setRowColNames(CoinModel &mod) ;
    01028
    01035     void setRowColNames(CoinLpIO &mod) ;
    01036
    01038   //-------------------------------------------------------------------------
    01039
    01040   //-------------------------------------------------------------------------
    01046
    01048     virtual void addCol(const CoinPackedVectorBase& vec,
    01049                         const double collb, const double colub,
    01050                         const double obj) = 0;
    01051
    01057     virtual void addCol(const CoinPackedVectorBase& vec,
    01058                         const double collb, const double colub,
    01059                         const double obj, std::string name) ;
    01060
    01062     virtual void addCol(int numberElements,
    01063                         const int* rows, const double* elements,
    01064                         const double collb, const double colub,
    01065                         const double obj) ;
    01066
    01072     virtual void addCol(int numberElements,
    01073                         const int* rows, const double* elements,
    01074                         const double collb, const double colub,
    01075                         const double obj, std::string name) ;
    01076
    01082     virtual void addCols(const int numcols,
    01083                          const CoinPackedVectorBase * const * cols,
    01084                          const double* collb, const double* colub,
    01085                          const double* obj);
    01086
    01092     virtual void addCols(const int numcols, const int* columnStarts,
    01093                          const int* rows, const double* elements,
    01094                          const double* collb, const double* colub,
    01095                          const double* obj);
    01096
    01098     void addCols(const CoinBuild & buildObject);
    01099
    01105     int addCols(CoinModel & modelObject);
    01106
    01107 #if 0
    01108
    01109     virtual void addCols(const CoinPackedMatrix& matrix,
    01110                          const double* collb, const double* colub,
    01111                          const double* obj);
    01112 #endif
    01113
    01120     virtual void deleteCols(const int num, const int * colIndices) = 0;
    01121
    01123     virtual void addRow(const CoinPackedVectorBase& vec,
    01124                         const double rowlb, const double rowub) = 0;
    01125
    01131     virtual void addRow(const CoinPackedVectorBase& vec,
    01132                         const double rowlb, const double rowub,
    01133                         std::string name) ;
    01134
    01136     virtual void addRow(const CoinPackedVectorBase& vec,
    01137                         const char rowsen, const double rowrhs,
    01138                         const double rowrng) = 0;
    01139
    01145     virtual void addRow(const CoinPackedVectorBase& vec,
    01146                         const char rowsen, const double rowrhs,
    01147                         const double rowrng, std::string name) ;
    01148
    01153     virtual void addRow(int numberElements,
    01154                         const int *columns, const double *element,
    01155                         const double rowlb, const double rowub) ;
    01156
    01162     virtual void addRows(const int numrows,
    01163                          const CoinPackedVectorBase * const * rows,
    01164                          const double* rowlb, const double* rowub);
    01165
    01171     virtual void addRows(const int numrows,
    01172                          const CoinPackedVectorBase * const * rows,
    01173                          const char* rowsen, const double* rowrhs,
    01174                          const double* rowrng);
    01175
    01181     virtual void addRows(const int numrows, const int *rowStarts,
    01182                          const int *columns, const double *element,
    01183                          const double *rowlb, const double *rowub);
    01184
    01186     void addRows(const CoinBuild &buildObject);
    01187
    01196     int addRows(CoinModel &modelObject);
    01197
    01198 #if 0
    01199
    01200     virtual void addRows(const CoinPackedMatrix& matrix,
    01201                          const double* rowlb, const double* rowub);
    01203     virtual void addRows(const CoinPackedMatrix& matrix,
    01204                          const char* rowsen, const double* rowrhs,
    01205                          const double* rowrng);
    01206 #endif
    01207
    01213     virtual void deleteRows(const int num, const int * rowIndices) = 0;
    01214
    01221     virtual void replaceMatrixOptional(const CoinPackedMatrix & ) {}
    01222
    01227     virtual void replaceMatrix(const CoinPackedMatrix & ) {abort();}
    01228
    01233     virtual void saveBaseModel() {}
    01234
    01248     virtual void restoreBaseModel(int numberRows);
    01249     //-----------------------------------------------------------------------
    01272     virtual ApplyCutsReturnCode applyCuts(const OsiCuts & cs,
    01273                                           double effectivenessLb = 0.0);
    01274
    01279     virtual void applyRowCuts(int numberCuts, const OsiRowCut * cuts);
    01280
    01284     virtual void applyRowCuts(int numberCuts, const OsiRowCut ** cuts);
    01285
    01287     void deleteBranchingInfo(int numberDeleted, const int * which);
    01288
    01290
    01291   //---------------------------------------------------------------------------
    01292
    01310     virtual void loadProblem (const CoinPackedMatrix& matrix,
    01311                               const double* collb, const double* colub,
    01312                               const double* obj,
    01313                               const double* rowlb, const double* rowub) = 0;
    01314
    01324     virtual void assignProblem (CoinPackedMatrix*& matrix,
    01325                                 double*& collb, double*& colub, double*& obj,
    01326                                 double*& rowlb, double*& rowub) = 0;
    01327
    01344     virtual void loadProblem (const CoinPackedMatrix& matrix,
    01345                               const double* collb, const double* colub,
    01346                               const double* obj,
    01347                               const char* rowsen, const double* rowrhs,
    01348                               const double* rowrng) = 0;
    01349
    01359     virtual void assignProblem (CoinPackedMatrix*& matrix,
    01360                                 double*& collb, double*& colub, double*& obj,
    01361                                 char*& rowsen, double*& rowrhs,
    01362                                 double*& rowrng) = 0;
    01363
    01376     virtual void loadProblem (const int numcols, const int numrows,
    01377                               const CoinBigIndex * start, const int* index,
    01378                               const double* value,
    01379                               const double* collb, const double* colub,
    01380                               const double* obj,
    01381                               const double* rowlb, const double* rowub) = 0;
    01382
    01395     virtual void loadProblem (const int numcols, const int numrows,
    01396                               const CoinBigIndex * start, const int* index,
    01397                               const double* value,
    01398                               const double* collb, const double* colub,
    01399                               const double* obj,
    01400                               const char* rowsen, const double* rowrhs,
    01401                               const double* rowrng) = 0;
    01402
    01409     virtual int loadFromCoinModel (CoinModel & modelObject,
    01410                                    bool keepSolution=false);
    01411
    01417     virtual int readMps (const char *filename,
    01418                          const char *extension = "mps") ;
    01419
    01426     virtual int readMps (const char *filename, const char*extension,
    01427                         int & numberSets, CoinSet ** & sets);
    01428
    01434     virtual int readGMPL (const char *filename, const char *dataname=NULL);
    01435
    01442     virtual void writeMps (const char *filename,
    01443                            const char *extension = "mps",
    01444                            double objSense=0.0) const = 0;
    01445
    01459     int writeMpsNative (const char *filename,
    01460                         const char ** rowNames, const char ** columnNames,
    01461                         int formatType=0,int numberAcross=2,
    01462                         double objSense=0.0, int numberSOS=0,
    01463                         const CoinSet * setInfo=NULL) const ;
    01464
    01465 /***********************************************************************/
    01466 // Lp files
    01467
    01487   virtual void writeLp(const char *filename,
    01488                const char *extension = "lp",
    01489                 double epsilon = 1e-5,
    01490                 int numberAcross = 10,
    01491                 int decimals = 5,
    01492                 double objSense = 0.0,
    01493                 bool useRowNames = true) const;
    01494
    01499   virtual void writeLp(FILE *fp,
    01500                 double epsilon = 1e-5,
    01501                 int numberAcross = 10,
    01502                 int decimals = 5,
    01503                 double objSense = 0.0,
    01504                 bool useRowNames = true) const;
    01505
    01524   int writeLpNative(const char *filename,
    01525                     char const * const * const rowNames,
    01526                     char const * const * const columnNames,
    01527                     const double epsilon = 1.0e-5,
    01528                     const int numberAcross = 10,
    01529                     const int decimals = 5,
    01530                     const double objSense = 0.0,
    01531                     const bool useRowNames = true) const;
    01532
    01537   int writeLpNative(FILE *fp,
    01538                     char const * const * const rowNames,
    01539                     char const * const * const columnNames,
    01540                     const double epsilon = 1.0e-5,
    01541                     const int numberAcross = 10,
    01542                     const int decimals = 5,
    01543                     const double objSense = 0.0,
    01544                     const bool useRowNames = true) const;
    01545
    01548   virtual int readLp(const char *filename, const double epsilon = 1e-5);
    01549
    01552   int readLp(FILE *fp, const double epsilon = 1e-5);
    01553
    01555
    01556   //---------------------------------------------------------------------------
    01557
    01560 #ifdef COIN_SNAPSHOT
    01562   virtual CoinSnapshot * snapshot(bool createArrays=true) const;
    01563 #endif
    01564 #ifdef COIN_FACTORIZATION_INFO
    01566   virtual CoinBigIndex getSizeL() const;
    01568   virtual CoinBigIndex getSizeU() const;
    01569 #endif
    01570
    01571
    01572   //---------------------------------------------------------------------------
    01573
    01583     void setApplicationData (void * appData);
    01590     void setAuxiliaryInfo(OsiAuxInfo * auxiliaryInfo);
    01591
    01593     void * getApplicationData() const;
    01595     OsiAuxInfo * getAuxiliaryInfo() const;
    01597   //---------------------------------------------------------------------------
    01598
    01612   virtual void passInMessageHandler(CoinMessageHandler * handler);
    01614   void newLanguage(CoinMessages::Language language);
    01615   inline void setLanguage(CoinMessages::Language language)
    01616   {newLanguage(language);}
    01618   inline CoinMessageHandler * messageHandler() const
    01619   {return handler_;}
    01621   inline CoinMessages messages()
    01622   {return messages_;}
    01624   inline CoinMessages * messagesPointer()
    01625   {return &messages_;}
    01627   inline bool defaultHandler() const
    01628   { return defaultHandler_;}
    01630   //---------------------------------------------------------------------------
    01645     void findIntegers(bool justCount);
    01656     virtual int findIntegersAndSOS(bool justCount);
    01658     inline int numberObjects() const { return numberObjects_;}
    01660     inline void setNumberObjects(int number)
    01661     {  numberObjects_=number;}
    01662
    01664     inline OsiObject ** objects() const { return object_;}
    01665
    01667     const inline OsiObject * object(int which) const { return object_[which];}
    01669     inline OsiObject * modifiableObject(int which) const { return object_[which];}
    01670
    01672     void deleteObjects();
    01673
    01678     void addObjects(int numberObjects, OsiObject ** objects);
    01683     double forceFeasible();
    01685   //---------------------------------------------------------------------------
    01686
    01698     virtual void activateRowCutDebugger (const char *modelName);
    01699
    01713     virtual void activateRowCutDebugger(const double *solution,
    01714                                         bool enforceOptimality = true);
    01715
    01727     const OsiRowCutDebugger *getRowCutDebugger() const;
    01728
    01736     OsiRowCutDebugger * getRowCutDebuggerAlways() const;
    01738
    01747
    01758   virtual int canDoSimplexInterface() const ;
    01760
    01768
    01777   virtual void enableFactorization() const ;
    01778
    01780   virtual void disableFactorization() const ;
    01781
    01792   virtual bool basisIsAvailable() const ;
    01793
    01795   inline bool optimalBasisIsAvailable() const { return basisIsAvailable() ; }
    01796
    01820   virtual void getBasisStatus(int* cstat, int* rstat) const ;
    01821
    01836   virtual int setBasisStatus(const int* cstat, const int* rstat) ;
    01837
    01843   virtual void getReducedGradient(double* columnReducedCosts,
    01844                                   double* duals, const double* c) const ;
    01845
    01851   virtual void getBInvARow(int row, double* z, double* slack = NULL) const ;
    01852
    01854   virtual void getBInvRow(int row, double* z) const ;
    01855
    01857   virtual void getBInvACol(int col, double* vec) const ;
    01858
    01860   virtual void getBInvCol(int col, double* vec) const ;
    01861
    01869   virtual void getBasics(int* index) const ;
    01870
    01872
    01880
    01887   virtual void enableSimplexInterface(bool doingPrimal) ;
    01888
    01890   virtual void disableSimplexInterface() ;
    01898   virtual int pivot(int colIn, int colOut, int outStatus) ;
    01899
    01911   virtual int primalPivotResult(int colIn, int sign,
    01912                                 int& colOut, int& outStatus,
    01913                                 double& t, CoinPackedVector* dx);
    01914
    01921   virtual int dualPivotResult(int& colIn, int& sign,
    01922                               int colOut, int outStatus,
    01923                               double& t, CoinPackedVector* dx) ;
    01925
    01926   //---------------------------------------------------------------------------
    01927
    01929
    01930
    01931     OsiSolverInterface();
    01932
    01938     virtual OsiSolverInterface * clone(bool copyData = true) const = 0;
    01939
    01941     OsiSolverInterface(const OsiSolverInterface &);
    01942
    01944     OsiSolverInterface & operator=(const OsiSolverInterface& rhs);
    01945
    01947     virtual ~OsiSolverInterface ();
    01948
    01955     virtual void reset();
    01957
    01958   //---------------------------------------------------------------------------
    01959
    01960 protected:
    01962
    01963
    01964     virtual void applyRowCut( const OsiRowCut & rc ) = 0;
    01965
    01967     virtual void applyColCut( const OsiColCut & cc ) = 0;
    01968
    01971     inline void
    01972     convertBoundToSense(const double lower, const double upper,
    01973                         char& sense, double& right, double& range) const;
    01976     inline void
    01977     convertSenseToBound(const char sense, const double right,
    01978                         const double range,
    01979                         double& lower, double& upper) const;
    01982     template <class T> inline T
    01983     forceIntoRange(const T value, const T lower, const T upper) const {
    01984       return value < lower ? lower : (value > upper ? upper : value);
    01985     }
    01992     void setInitialData();
    01994
    01996
    01997
    02002     mutable OsiRowCutDebugger * rowCutDebugger_;
    02003    // Why not just make useful stuff protected?
    02005   CoinMessageHandler * handler_;
    02011   bool defaultHandler_;
    02013   CoinMessages messages_;
    02015   int numberIntegers_;
    02017   int numberObjects_;
    02018
    02020   OsiObject ** object_;
    02026   mutable char * columnType_;
    02027
    02029
    02030   //---------------------------------------------------------------------------
    02031
    02032 private:
    02034
    02035
    02036     OsiAuxInfo * appDataEtc_;
    02038     int intParam_[OsiLastIntParam];
    02040     double dblParam_[OsiLastDblParam];
    02042     std::string strParam_[OsiLastStrParam];
    02044     bool hintParam_[OsiLastHintParam];
    02046     OsiHintStrength hintStrength_[OsiLastHintParam];
    02049     CoinWarmStart* ws_;
    02051     std::vector<double> strictColSolution_;
    02052
    02054     OsiNameVec rowNames_ ;
    02056     OsiNameVec colNames_ ;
    02058     std::string objName_ ;
    02059
    02061 };
    02062
    02063 //#############################################################################
    02066 inline void
    02067 OsiSolverInterface::convertBoundToSense(const double lower, const double upper,
    02068                                         char& sense, double& right,
    02069                                         double& range) const
    02070 {
    02071   double inf = getInfinity();
    02072   range = 0.0;
    02073   if (lower > -inf) {
    02074     if (upper < inf) {
    02075       right = upper;
    02076       if (upper==lower) {
    02077         sense = 'E';
    02078       } else {
    02079         sense = 'R';
    02080         range = upper - lower;
    02081       }
    02082     } else {
    02083       sense = 'G';
    02084       right = lower;
    02085     }
    02086   } else {
    02087     if (upper < inf) {
    02088       sense = 'L';
    02089       right = upper;
    02090     } else {
    02091       sense = 'N';
    02092       right = 0.0;
    02093     }
    02094   }
    02095 }
    02096
    02097 //-----------------------------------------------------------------------------
    02100 inline void
    02101 OsiSolverInterface::convertSenseToBound(const char sense, const double right,
    02102                                         const double range,
    02103                                         double& lower, double& upper) const
    02104 {
    02105   double inf=getInfinity();
    02106   switch (sense) {
    02107   case 'E':
    02108     lower = upper = right;
    02109     break;
    02110   case 'L':
    02111     lower = -inf;
    02112     upper = right;
    02113     break;
    02114   case 'G':
    02115     lower = right;
    02116     upper = inf;
    02117     break;
    02118   case 'R':
    02119     lower = right - range;
    02120     upper = right;
    02121     break;
    02122   case 'N':
    02123     lower = -inf;
    02124     upper = inf;
    02125     break;
    02126   }
    02127 }
    02128
    02129 #endif