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

- File List
- File Members

# /home/coin/SVN-release/Cgl-0.55.0/Osi/src/OsiSolverInterface.hpp

Go to the documentation of this file.

    00001 // Copyright (C) 2000, International Business Machines
    00002 // Corporation and others.  All Rights Reserved.
    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     friend class OsiClpSolverInterface;
    00075
    00076   public:
    00078
    00079
    00080       ApplyCutsReturnCode():
    00081          intInconsistent_(0),
    00082          extInconsistent_(0),
    00083          infeasible_(0),
    00084          ineffective_(0),
    00085          applied_(0) {}
    00087       ApplyCutsReturnCode(const ApplyCutsReturnCode & rhs):
    00088          intInconsistent_(rhs.intInconsistent_),
    00089          extInconsistent_(rhs.extInconsistent_),
    00090          infeasible_(rhs.infeasible_),
    00091          ineffective_(rhs.ineffective_),
    00092          applied_(rhs.applied_) {}
    00094       ApplyCutsReturnCode & operator=(const ApplyCutsReturnCode& rhs)
    00095       {
    00096         if (this != &rhs) {
    00097           intInconsistent_ = rhs.intInconsistent_;
    00098           extInconsistent_ = rhs.extInconsistent_;
    00099           infeasible_      = rhs.infeasible_;
    00100           ineffective_     = rhs.ineffective_;
    00101           applied_         = rhs.applied_;
    00102         }
    00103         return *this;
    00104       }
    00106       ~ApplyCutsReturnCode(){}
    00108
    00111
    00112       inline int getNumInconsistent(){return intInconsistent_;}
    00114       inline int getNumInconsistentWrtIntegerModel(){return extInconsistent_;}
    00116       inline int getNumInfeasible(){return infeasible_;}
    00118       inline int getNumIneffective(){return ineffective_;}
    00120       inline int getNumApplied(){return applied_;}
    00122
    00123   private:
    00126
    00127       inline void incrementInternallyInconsistent(){intInconsistent_++;}
    00129       inline void incrementExternallyInconsistent(){extInconsistent_++;}
    00131       inline void incrementInfeasible(){infeasible_++;}
    00133       inline void incrementIneffective(){ineffective_++;}
    00135       inline void incrementApplied(){applied_++;}
    00137
    00139
    00140
    00141       int intInconsistent_;
    00143       int extInconsistent_;
    00145       int infeasible_;
    00147       int ineffective_;
    00149       int applied_;
    00151   };
    00152
    00153   //---------------------------------------------------------------------------
    00154
    00156
    00157
    00158     virtual void initialSolve() = 0;
    00159
    00161     virtual void resolve() = 0;
    00162
    00164     virtual void branchAndBound() = 0;
    00165
    00166 #ifdef CBC_NEXT_VERSION
    00167
    00184     virtual int solveBranches(int depth,const OsiSolverBranch * branch,
    00185                               OsiSolverResult * result,
    00186                               int & numberSolves, int & numberIterations,
    00187                               bool forceBranch=false);
    00188 #endif
    00189
    00190
    00191   //---------------------------------------------------------------------------
    00249     // Set an integer parameter
    00250     virtual bool setIntParam(OsiIntParam key, int value) {
    00251       if (key == OsiLastIntParam) return (false) ;
    00252       intParam_[key] = value;
    00253       return true;
    00254     }
    00255     // Set an double parameter
    00256     virtual bool setDblParam(OsiDblParam key, double value) {
    00257       if (key == OsiLastDblParam) return (false) ;
    00258       dblParam_[key] = value;
    00259       return true;
    00260     }
    00261     // Set an string parameter
    00262     virtual bool setStrParam(OsiStrParam key, const std::string & value) {
    00263       if (key == OsiLastStrParam) return (false) ;
    00264       strParam_[key] = value;
    00265       return true;
    00266     }
    00267     // Set a hint parameter
    00268     virtual bool setHintParam(OsiHintParam key, bool yesNo=true,
    00269                               OsiHintStrength strength=OsiHintTry,
    00270                               void * =NULL) {
    00271       if (key==OsiLastHintParam)
    00272         return false;
    00273       hintParam_[key] = yesNo;
    00274       hintStrength_[key] = strength;
    00275       if (strength == OsiForceDo)
    00276         throw CoinError("OsiForceDo illegal",
    00277                         "setHintParam", "OsiSolverInterface");
    00278       return true;
    00279     }
    00280     // Get an integer parameter
    00281     virtual bool getIntParam(OsiIntParam key, int& value) const {
    00282       if (key == OsiLastIntParam) return (false) ;
    00283       value = intParam_[key];
    00284       return true;
    00285     }
    00286     // Get an double parameter
    00287     virtual bool getDblParam(OsiDblParam key, double& value) const {
    00288       if (key == OsiLastDblParam) return (false) ;
    00289       value = dblParam_[key];
    00290       return true;
    00291     }
    00295     inline double getIntegerTolerance() const
    00296     { return dblParam_[OsiPrimalTolerance];}
    00297     // Get a string parameter
    00298     virtual bool getStrParam(OsiStrParam key, std::string& value) const {
    00299       if (key == OsiLastStrParam) return (false) ;
    00300       value = strParam_[key];
    00301       return true;
    00302     }
    00303     // get a hint parameter
    00304     virtual bool getHintParam(OsiHintParam key, bool& yesNo,
    00305                               OsiHintStrength& strength,
    00306                               void *& otherInformation) const {
    00307       if (key==OsiLastHintParam)
    00308         return false;
    00309       yesNo = hintParam_[key];
    00310       strength = hintStrength_[key];
    00311       otherInformation=NULL;
    00312       return true;
    00313     }
    00314     // get a hint parameter (less information)
    00315     virtual bool getHintParam(OsiHintParam key, bool& yesNo,
    00316                               OsiHintStrength& strength) const {
    00317       if (key==OsiLastHintParam)
    00318         return false;
    00319       yesNo = hintParam_[key];
    00320       strength = hintStrength_[key];
    00321       return true;
    00322     }
    00323     // get a hint parameter (even less information)
    00324     virtual bool getHintParam(OsiHintParam key, bool& yesNo) const {
    00325       if (key==OsiLastHintParam)
    00326         return false;
    00327       yesNo = hintParam_[key];
    00328       return true;
    00329     }
    00330     // copy all parameters in this section from one solver to another
    00331     void copyParameters(OsiSolverInterface & rhs);
    00333
    00334   //---------------------------------------------------------------------------
    00336
    00337
    00338     virtual bool isAbandoned() const = 0;
    00340     virtual bool isProvenOptimal() const = 0;
    00342     virtual bool isProvenPrimalInfeasible() const = 0;
    00344     virtual bool isProvenDualInfeasible() const = 0;
    00346     virtual bool isPrimalObjectiveLimitReached() const = 0;
    00348     virtual bool isDualObjectiveLimitReached() const = 0;
    00350     virtual bool isIterationLimitReached() const = 0;
    00352
    00353   //---------------------------------------------------------------------------
    00371     virtual CoinWarmStart *getEmptyWarmStart () const = 0 ;
    00372
    00379     virtual CoinWarmStart* getWarmStart() const = 0;
    00388     virtual CoinWarmStart* getPointerToWarmStart(bool & mustDelete) ;
    00389
    00398     virtual bool setWarmStart(const CoinWarmStart* warmstart) = 0;
    00400
    00401   //---------------------------------------------------------------------------
    00422
    00423     virtual void markHotStart();
    00425     virtual void solveFromHotStart();
    00427     virtual void unmarkHotStart();
    00429
    00430   //---------------------------------------------------------------------------
    00441
    00442     virtual int getNumCols() const = 0;
    00443
    00445     virtual int getNumRows() const = 0;
    00446
    00448     virtual int getNumElements() const = 0;
    00449
    00451     virtual int getNumIntegers() const ;
    00452
    00454     virtual const double * getColLower() const = 0;
    00455
    00457     virtual const double * getColUpper() const = 0;
    00458
    00468     virtual const char * getRowSense() const = 0;
    00469
    00482     virtual const double * getRightHandSide() const = 0;
    00483
    00492     virtual const double * getRowRange() const = 0;
    00493
    00495     virtual const double * getRowLower() const = 0;
    00496
    00498     virtual const double * getRowUpper() const = 0;
    00499
    00501     virtual const double * getObjCoefficients() const = 0;
    00502
    00504     virtual double getObjSense() const = 0;
    00505
    00507     virtual bool isContinuous(int colIndex) const = 0;
    00508
    00510     virtual bool isBinary(int colIndex) const;
    00511
    00516     virtual bool isInteger(int colIndex) const;
    00517
    00519     virtual bool isIntegerNonBinary(int colIndex) const;
    00520
    00522     virtual bool isFreeBinary(int colIndex) const;
    00529     inline const char * columnType(bool refresh=false) const
    00530     { return getColType(refresh);}
    00536     virtual const char * getColType(bool refresh=false) const;
    00537
    00539     virtual const CoinPackedMatrix * getMatrixByRow() const = 0;
    00540
    00542     virtual const CoinPackedMatrix * getMatrixByCol() const = 0;
    00543
    00545     virtual CoinPackedMatrix * getMutableMatrixByRow() const {return NULL;}
    00546
    00548     virtual CoinPackedMatrix * getMutableMatrixByCol() const {return NULL;}
    00549
    00551     virtual double getInfinity() const = 0;
    00553
    00556
    00557     virtual const double * getColSolution() const = 0;
    00558
    00562     const double * getStrictColSolution();
    00563
    00565     virtual const double * getRowPrice() const = 0;
    00566
    00568     virtual const double * getReducedCost() const = 0;
    00569
    00572     virtual const double * getRowActivity() const = 0;
    00573
    00575     virtual double getObjValue() const = 0;
    00576
    00579     virtual int getIterationCount() const = 0;
    00580
    00594     virtual std::vector<double*> getDualRays(int maxNumRays) const = 0;
    00606     virtual std::vector<double*> getPrimalRays(int maxNumRays) const = 0;
    00607
    00610     virtual OsiVectorInt getFractionalIndices(const double etol=1.e-05)
    00611       const;
    00613
    00614   //-------------------------------------------------------------------------
    00627     virtual void setObjCoeff( int elementIndex, double elementValue ) = 0;
    00628
    00630     virtual void setObjCoeffSet(const int* indexFirst,
    00631                                 const int* indexLast,
    00632                                 const double* coeffList);
    00633
    00639     virtual void setObjective(const double * array);
    00640
    00651     virtual void setObjSense(double s) = 0;
    00652
    00653
    00656     virtual void setColLower( int elementIndex, double elementValue ) = 0;
    00657
    00663     virtual void setColLower(const double * array);
    00664
    00667     virtual void setColUpper( int elementIndex, double elementValue ) = 0;
    00668
    00674     virtual void setColUpper(const double * array);
    00675
    00676
    00680     virtual void setColBounds( int elementIndex,
    00681                                double lower, double upper ) {
    00682        setColLower(elementIndex, lower);
    00683        setColUpper(elementIndex, upper);
    00684     }
    00685
    00692     virtual void setColSetBounds(const int* indexFirst,
    00693                                  const int* indexLast,
    00694                                  const double* boundList);
    00695
    00698     virtual void setRowLower( int elementIndex, double elementValue ) = 0;
    00699
    00702     virtual void setRowUpper( int elementIndex, double elementValue ) = 0;
    00703
    00707     virtual void setRowBounds( int elementIndex,
    00708                                double lower, double upper ) {
    00709        setRowLower(elementIndex, lower);
    00710        setRowUpper(elementIndex, upper);
    00711     }
    00712
    00719     virtual void setRowSetBounds(const int* indexFirst,
    00720                                  const int* indexLast,
    00721                                  const double* boundList);
    00722
    00723
    00725     virtual void setRowType(int index, char sense, double rightHandSide,
    00726                             double range) = 0;
    00727
    00732     virtual void setRowSetTypes(const int* indexFirst,
    00733                                 const int* indexLast,
    00734                                 const char* senseList,
    00735                                 const double* rhsList,
    00736                                 const double* rangeList);
    00737
    00747     virtual void setColSolution(const double *colsol) = 0;
    00748
    00758     virtual void setRowPrice(const double * rowprice) = 0;
    00759
    00768     virtual int reducedCostFix(double gap, bool justInteger=true);
    00770
    00771   //-------------------------------------------------------------------------
    00775     virtual void setContinuous(int index) = 0;
    00777     virtual void setInteger(int index) = 0;
    00780     virtual void setContinuous(const int* indices, int len);
    00783     virtual void setInteger(const int* indices, int len);
    00785   //-------------------------------------------------------------------------
    00786
    00787   //-------------------------------------------------------------------------
    00788
    00790     typedef std::vector<std::string> OsiNameVec ;
    00791
    00812
    00822     virtual std::string dfltRowColName(char rc,
    00823                                  int ndx, unsigned digits = 7) const ;
    00824
    00827   virtual std::string getObjName (unsigned maxLen = static_cast<unsigned>(std::string::npos)) const ;
    00828
    00831     virtual inline void setObjName (std::string name)
    00832     { objName_ = name ; }
    00833
    00840     virtual std::string getRowName(int rowIndex,
    00841                                    unsigned maxLen = static_cast<unsigned>(std::string::npos)) const ;
    00842
    00854     virtual const OsiNameVec &getRowNames() ;
    00855
    00861     virtual void setRowName(int ndx, std::string name) ;
    00862
    00869     virtual void setRowNames(OsiNameVec &srcNames,
    00870                      int srcStart, int len, int tgtStart) ;
    00871
    00877     virtual void deleteRowNames(int tgtStart, int len) ;
    00878
    00885     virtual std::string getColName(int colIndex,
    00886                                    unsigned maxLen = static_cast<unsigned>(std::string::npos)) const ;
    00887
    00897     virtual const OsiNameVec &getColNames() ;
    00898
    00904     virtual void setColName(int ndx, std::string name) ;
    00905
    00912     virtual void setColNames(OsiNameVec &srcNames,
    00913                      int srcStart, int len, int tgtStart) ;
    00914
    00920     virtual void deleteColNames(int tgtStart, int len) ;
    00921
    00922
    00929     void setRowColNames(const CoinMpsIO &mps) ;
    00930
    00936     void setRowColNames(CoinModel &mod) ;
    00937
    00944     void setRowColNames(CoinLpIO &mod) ;
    00945
    00947   //-------------------------------------------------------------------------
    00948
    00949   //-------------------------------------------------------------------------
    00955
    00957     virtual void addCol(const CoinPackedVectorBase& vec,
    00958                         const double collb, const double colub,
    00959                         const double obj) = 0;
    00960
    00966     virtual void addCol(const CoinPackedVectorBase& vec,
    00967                         const double collb, const double colub,
    00968                         const double obj, std::string name) ;
    00969
    00971     virtual void addCol(int numberElements,
    00972                         const int* rows, const double* elements,
    00973                         const double collb, const double colub,
    00974                         const double obj) ;
    00975
    00981     virtual void addCol(int numberElements,
    00982                         const int* rows, const double* elements,
    00983                         const double collb, const double colub,
    00984                         const double obj, std::string name) ;
    00985
    00991     virtual void addCols(const int numcols,
    00992                          const CoinPackedVectorBase * const * cols,
    00993                          const double* collb, const double* colub,
    00994                          const double* obj);
    00995
    01001     virtual void addCols(const int numcols, const int* columnStarts,
    01002                          const int* rows, const double* elements,
    01003                          const double* collb, const double* colub,
    01004                          const double* obj);
    01005
    01007     void addCols(const CoinBuild & buildObject);
    01008
    01014     int addCols(CoinModel & modelObject);
    01015
    01016 #if 0
    01017
    01018     virtual void addCols(const CoinPackedMatrix& matrix,
    01019                          const double* collb, const double* colub,
    01020                          const double* obj);
    01021 #endif
    01022
    01029     virtual void deleteCols(const int num, const int * colIndices) = 0;
    01030
    01032     virtual void addRow(const CoinPackedVectorBase& vec,
    01033                         const double rowlb, const double rowub) = 0;
    01034
    01040     virtual void addRow(const CoinPackedVectorBase& vec,
    01041                         const double rowlb, const double rowub,
    01042                         std::string name) ;
    01043
    01045     virtual void addRow(const CoinPackedVectorBase& vec,
    01046                         const char rowsen, const double rowrhs,
    01047                         const double rowrng) = 0;
    01048
    01054     virtual void addRow(const CoinPackedVectorBase& vec,
    01055                         const char rowsen, const double rowrhs,
    01056                         const double rowrng, std::string name) ;
    01057
    01062     virtual void addRow(int numberElements,
    01063                         const int *columns, const double *element,
    01064                         const double rowlb, const double rowub) ;
    01065
    01071     virtual void addRows(const int numrows,
    01072                          const CoinPackedVectorBase * const * rows,
    01073                          const double* rowlb, const double* rowub);
    01074
    01080     virtual void addRows(const int numrows,
    01081                          const CoinPackedVectorBase * const * rows,
    01082                          const char* rowsen, const double* rowrhs,
    01083                          const double* rowrng);
    01084
    01090     virtual void addRows(const int numrows, const int *rowStarts,
    01091                          const int *columns, const double *element,
    01092                          const double *rowlb, const double *rowub);
    01093
    01095     void addRows(const CoinBuild &buildObject);
    01096
    01105     int addRows(CoinModel &modelObject);
    01106
    01107 #if 0
    01108
    01109     virtual void addRows(const CoinPackedMatrix& matrix,
    01110                          const double* rowlb, const double* rowub);
    01112     virtual void addRows(const CoinPackedMatrix& matrix,
    01113                          const char* rowsen, const double* rowrhs,
    01114                          const double* rowrng);
    01115 #endif
    01116
    01122     virtual void deleteRows(const int num, const int * rowIndices) = 0;
    01123
    01126     virtual void saveBaseModel() {}
    01130     virtual void restoreBaseModel(int numberRows);
    01131     //-----------------------------------------------------------------------
    01154     virtual ApplyCutsReturnCode applyCuts(const OsiCuts & cs,
    01155                                           double effectivenessLb = 0.0);
    01156
    01161     virtual void applyRowCuts(int numberCuts, const OsiRowCut * cuts);
    01162
    01166     virtual void applyRowCuts(int numberCuts, const OsiRowCut ** cuts);
    01167
    01169     void deleteBranchingInfo(int numberDeleted, const int * which);
    01170
    01172
    01173   //---------------------------------------------------------------------------
    01174
    01192     virtual void loadProblem (const CoinPackedMatrix& matrix,
    01193                               const double* collb, const double* colub,
    01194                               const double* obj,
    01195                               const double* rowlb, const double* rowub) = 0;
    01196
    01206     virtual void assignProblem (CoinPackedMatrix*& matrix,
    01207                                 double*& collb, double*& colub, double*& obj,
    01208                                 double*& rowlb, double*& rowub) = 0;
    01209
    01226     virtual void loadProblem (const CoinPackedMatrix& matrix,
    01227                               const double* collb, const double* colub,
    01228                               const double* obj,
    01229                               const char* rowsen, const double* rowrhs,
    01230                               const double* rowrng) = 0;
    01231
    01241     virtual void assignProblem (CoinPackedMatrix*& matrix,
    01242                                 double*& collb, double*& colub, double*& obj,
    01243                                 char*& rowsen, double*& rowrhs,
    01244                                 double*& rowrng) = 0;
    01245
    01258     virtual void loadProblem (const int numcols, const int numrows,
    01259                               const CoinBigIndex * start, const int* index,
    01260                               const double* value,
    01261                               const double* collb, const double* colub,
    01262                               const double* obj,
    01263                               const double* rowlb, const double* rowub) = 0;
    01264
    01277     virtual void loadProblem (const int numcols, const int numrows,
    01278                               const CoinBigIndex * start, const int* index,
    01279                               const double* value,
    01280                               const double* collb, const double* colub,
    01281                               const double* obj,
    01282                               const char* rowsen, const double* rowrhs,
    01283                               const double* rowrng) = 0;
    01284
    01291     virtual int loadFromCoinModel (CoinModel & modelObject,
    01292                                    bool keepSolution=false);
    01293
    01299     virtual int readMps (const char *filename,
    01300                          const char *extension = "mps") ;
    01301
    01308     virtual int readMps (const char *filename, const char*extension,
    01309                         int & numberSets, CoinSet ** & sets);
    01310
    01316     virtual int readGMPL (const char *filename, const char *dataname=NULL);
    01317
    01324     virtual void writeMps (const char *filename,
    01325                            const char *extension = "mps",
    01326                            double objSense=0.0) const = 0;
    01327
    01341     int writeMpsNative (const char *filename,
    01342                         const char ** rowNames, const char ** columnNames,
    01343                         int formatType=0,int numberAcross=2,
    01344                         double objSense=0.0, int numberSOS=0,
    01345                         const CoinSet * setInfo=NULL) const ;
    01346
    01347 /***********************************************************************/
    01348 // Lp files
    01349
    01369   virtual void writeLp(const char *filename,
    01370                const char *extension = "lp",
    01371                 double epsilon = 1e-5,
    01372                 int numberAcross = 10,
    01373                 int decimals = 5,
    01374                 double objSense = 0.0,
    01375                 bool useRowNames = true) const;
    01376
    01381   virtual void writeLp(FILE *fp,
    01382                 double epsilon = 1e-5,
    01383                 int numberAcross = 10,
    01384                 int decimals = 5,
    01385                 double objSense = 0.0,
    01386                 bool useRowNames = true) const;
    01387
    01406   int writeLpNative(const char *filename,
    01407                     char const * const * const rowNames,
    01408                     char const * const * const columnNames,
    01409                     const double epsilon = 1.0e-5,
    01410                     const int numberAcross = 10,
    01411                     const int decimals = 5,
    01412                     const double objSense = 0.0,
    01413                     const bool useRowNames = true) const;
    01414
    01419   int writeLpNative(FILE *fp,
    01420                     char const * const * const rowNames,
    01421                     char const * const * const columnNames,
    01422                     const double epsilon = 1.0e-5,
    01423                     const int numberAcross = 10,
    01424                     const int decimals = 5,
    01425                     const double objSense = 0.0,
    01426                     const bool useRowNames = true) const;
    01427
    01430   virtual int readLp(const char *filename, const double epsilon = 1e-5);
    01431
    01434   int readLp(FILE *fp, const double epsilon = 1e-5);
    01435
    01441   virtual void replaceMatrixOptional(const CoinPackedMatrix & ) {}
    01443   virtual void replaceMatrix(const CoinPackedMatrix & ) {abort();}
    01445
    01446   //---------------------------------------------------------------------------
    01447
    01450 #ifdef COIN_SNAPSHOT
    01452   virtual CoinSnapshot * snapshot(bool createArrays=true) const;
    01453 #endif
    01454 #ifdef COIN_FACTORIZATION_INFO
    01456   virtual CoinBigIndex getSizeL() const;
    01458   virtual CoinBigIndex getSizeU() const;
    01459 #endif
    01460
    01461
    01462   //---------------------------------------------------------------------------
    01463
    01473     void setApplicationData (void * appData);
    01480     void setAuxiliaryInfo(OsiAuxInfo * auxiliaryInfo);
    01481
    01483     void * getApplicationData() const;
    01485     OsiAuxInfo * getAuxiliaryInfo() const;
    01487   //---------------------------------------------------------------------------
    01488
    01502   virtual void passInMessageHandler(CoinMessageHandler * handler);
    01504   void newLanguage(CoinMessages::Language language);
    01505   inline void setLanguage(CoinMessages::Language language)
    01506   {newLanguage(language);}
    01508   inline CoinMessageHandler * messageHandler() const
    01509   {return handler_;}
    01511   inline CoinMessages messages()
    01512   {return messages_;}
    01514   inline CoinMessages * messagesPointer()
    01515   {return &messages_;}
    01517   inline bool defaultHandler() const
    01518   { return defaultHandler_;}
    01520   //---------------------------------------------------------------------------
    01535     void findIntegers(bool justCount);
    01546     virtual int findIntegersAndSOS(bool justCount);
    01548     inline int numberObjects() const { return numberObjects_;}
    01550     inline void setNumberObjects(int number)
    01551     {  numberObjects_=number;}
    01552
    01554     inline OsiObject ** objects() const { return object_;}
    01555
    01557     const inline OsiObject * object(int which) const { return object_[which];}
    01559     inline OsiObject * modifiableObject(int which) const { return object_[which];}
    01560
    01562     void deleteObjects();
    01563
    01568     void addObjects(int numberObjects, OsiObject ** objects);
    01573     double forceFeasible();
    01575   //---------------------------------------------------------------------------
    01576
    01585     virtual void activateRowCutDebugger (const char * modelName);
    01586
    01592     virtual void activateRowCutDebugger( const double * solution);
    01602     const OsiRowCutDebugger * getRowCutDebugger() const;
    01604     const OsiRowCutDebugger * getRowCutDebuggerAlways() const;
    01605
    01607
    01608
    01616 public:
    01618
    01619
    01622   virtual int canDoSimplexInterface() const;
    01629   virtual void enableSimplexInterface(bool doingPrimal) ;
    01630
    01632   virtual void disableSimplexInterface() ;
    01633
    01640   virtual void enableFactorization() const;
    01642   virtual void disableFactorization() const;
    01643
    01648   virtual bool basisIsAvailable() const ;
    01650   inline bool optimalBasisIsAvailable() const
    01651   { return basisIsAvailable();}
    01652
    01665   virtual void getBasisStatus(int* cstat, int* rstat) const ;
    01666
    01673   virtual int setBasisStatus(const int* cstat, const int* rstat) ;
    01674
    01682   virtual int pivot(int colIn, int colOut, int outStatus) ;
    01683
    01695   virtual int primalPivotResult(int colIn, int sign,
    01696                                 int& colOut, int& outStatus,
    01697                                 double& t, CoinPackedVector* dx);
    01698
    01705   virtual int dualPivotResult(int& colIn, int& sign,
    01706                               int colOut, int outStatus,
    01707                               double& t, CoinPackedVector* dx) ;
    01708
    01710   virtual void getReducedGradient(double* columnReducedCosts,
    01711                                   double * duals,
    01712                                   const double * c) ;
    01713
    01716   virtual void setObjectiveAndRefresh(double* c) ;
    01717
    01719   virtual void getBInvARow(int row, double* z, double * slack=NULL) const ;
    01720
    01722   virtual void getBInvRow(int row, double* z) const ;
    01723
    01725   virtual void getBInvACol(int col, double* vec) const ;
    01726
    01728   virtual void getBInvCol(int col, double* vec) const ;
    01729
    01734   virtual void getBasics(int* index) const ;
    01736
    01737   //---------------------------------------------------------------------------
    01738
    01740
    01741
    01742     OsiSolverInterface();
    01743
    01749     virtual OsiSolverInterface * clone(bool copyData = true) const = 0;
    01750
    01752     OsiSolverInterface(const OsiSolverInterface &);
    01753
    01755     OsiSolverInterface & operator=(const OsiSolverInterface& rhs);
    01756
    01758     virtual ~OsiSolverInterface ();
    01759
    01766     virtual void reset();
    01768
    01769   //---------------------------------------------------------------------------
    01770
    01771 protected:
    01773
    01774
    01775     virtual void applyRowCut( const OsiRowCut & rc ) = 0;
    01776
    01778     virtual void applyColCut( const OsiColCut & cc ) = 0;
    01779
    01782     inline void
    01783     convertBoundToSense(const double lower, const double upper,
    01784                         char& sense, double& right, double& range) const;
    01787     inline void
    01788     convertSenseToBound(const char sense, const double right,
    01789                         const double range,
    01790                         double& lower, double& upper) const;
    01793     template <class T> inline T
    01794     forceIntoRange(const T value, const T lower, const T upper) const {
    01795       return value < lower ? lower : (value > upper ? upper : value);
    01796     }
    01803     void setInitialData();
    01805
    01807
    01808
    01809     OsiRowCutDebugger * rowCutDebugger_;
    01810    // Why not just make useful stuff protected?
    01812   CoinMessageHandler * handler_;
    01818   bool defaultHandler_;
    01820   CoinMessages messages_;
    01822   int numberIntegers_;
    01824   int numberObjects_;
    01825
    01827   OsiObject ** object_;
    01833   mutable char * columnType_;
    01834
    01836
    01837   //---------------------------------------------------------------------------
    01838
    01839 private:
    01841
    01842
    01843     OsiAuxInfo * appDataEtc_;
    01845     int intParam_[OsiLastIntParam];
    01847     double dblParam_[OsiLastDblParam];
    01849     std::string strParam_[OsiLastStrParam];
    01851     bool hintParam_[OsiLastHintParam];
    01853     OsiHintStrength hintStrength_[OsiLastHintParam];
    01856     CoinWarmStart* ws_;
    01858     std::vector<double> strictColSolution_;
    01859
    01861     OsiNameVec rowNames_ ;
    01863     OsiNameVec colNames_ ;
    01865     std::string objName_ ;
    01866
    01868 };
    01869
    01870 //#############################################################################
    01878 int
    01879 OsiSolverInterfaceCommonUnitTest(
    01880    const OsiSolverInterface* emptySi,
    01881    const std::string & mpsDir,
    01882    const std::string & netlibDir);
    01883
    01884 //#############################################################################
    01887 int
    01888 OsiSolverInterfaceMpsUnitTest(
    01889    const std::vector<OsiSolverInterface*> & vecSiP,
    01890    const std::string & mpsDir);
    01891
    01892 //#############################################################################
    01895 inline void
    01896 OsiSolverInterface::convertBoundToSense(const double lower, const double upper,
    01897                                         char& sense, double& right,
    01898                                         double& range) const
    01899 {
    01900   double inf = getInfinity();
    01901   range = 0.0;
    01902   if (lower > -inf) {
    01903     if (upper < inf) {
    01904       right = upper;
    01905       if (upper==lower) {
    01906         sense = 'E';
    01907       } else {
    01908         sense = 'R';
    01909         range = upper - lower;
    01910       }
    01911     } else {
    01912       sense = 'G';
    01913       right = lower;
    01914     }
    01915   } else {
    01916     if (upper < inf) {
    01917       sense = 'L';
    01918       right = upper;
    01919     } else {
    01920       sense = 'N';
    01921       right = 0.0;
    01922     }
    01923   }
    01924 }
    01925
    01926 //-----------------------------------------------------------------------------
    01929 inline void
    01930 OsiSolverInterface::convertSenseToBound(const char sense, const double right,
    01931                                         const double range,
    01932                                         double& lower, double& upper) const
    01933 {
    01934   double inf=getInfinity();
    01935   switch (sense) {
    01936   case 'E':
    01937     lower = upper = right;
    01938     break;
    01939   case 'L':
    01940     lower = -inf;
    01941     upper = right;
    01942     break;
    01943   case 'G':
    01944     lower = right;
    01945     upper = inf;
    01946     break;
    01947   case 'R':
    01948     lower = right - range;
    01949     upper = right;
    01950     break;
    01951   case 'N':
    01952     lower = -inf;
    01953     upper = inf;
    01954     break;
    01955   }
    01956 }
    01957
    01958 #endif