/home/coin/SVN-release/Cbc-2.2.2/Cbc/src/CbcBranchActual.hpp

Go to the documentation of this file.
00001 // Copyright (C) 2002, International Business Machines
00002 // Corporation and others.  All Rights Reserved.
00003 #ifndef CbcBranchActual_H
00004 #define CbcBranchActual_H
00005 
00006 #include "CbcBranchBase.hpp"
00007 #include "CoinPackedMatrix.hpp"
00008 class CbcIntegerBranchingObject;
00010 
00011 
00012 class CbcClique : public CbcObject {
00013 
00014 public:
00015 
00016   // Default Constructor 
00017   CbcClique ();
00018 
00023   CbcClique (CbcModel * model, int cliqueType, int numberMembers,
00024              const int * which, const char * type,
00025              int identifier,int slack=-1);
00026   
00027   // Copy constructor 
00028   CbcClique ( const CbcClique &);
00029    
00031   virtual CbcObject * clone() const;
00032 
00033   // Assignment operator 
00034   CbcClique & operator=( const CbcClique& rhs);
00035 
00036   // Destructor 
00037   ~CbcClique ();
00038   
00039   using CbcObject::infeasibility ;
00041   virtual double infeasibility(int & preferredWay) const;
00042 
00043   using CbcObject::feasibleRegion ;
00045   virtual void feasibleRegion();
00046 
00047   using CbcObject::createBranch ;
00049   virtual CbcBranchingObject * createBranch(int way) ;
00051   inline int numberMembers() const
00052   {return numberMembers_;}
00053 
00055   inline int numberNonSOSMembers() const
00056   {return numberNonSOSMembers_;}
00057 
00059   inline const int * members() const
00060   {return members_;}
00061 
00064   inline char type(int index) const
00065   {if (type_) return type_[index]; else return 1;}
00066 
00068   inline int cliqueType() const
00069   {return cliqueType_;}
00071   virtual void redoSequenceEtc(CbcModel * model, int numberColumns, const int * originalColumns);
00072 
00073 protected:
00076   int numberMembers_;
00077 
00079   int numberNonSOSMembers_;
00080 
00082   int * members_;
00083 
00085   char * type_;
00086 
00088    int cliqueType_;
00089 
00091   int slack_;
00092 };
00093 
00101 class CbcSOS : public CbcObject {
00102 
00103 public:
00104 
00105   // Default Constructor 
00106   CbcSOS ();
00107 
00112   CbcSOS (CbcModel * model, int numberMembers,
00113            const int * which, const double * weights, int identifier,
00114           int type=1);
00115   
00116   // Copy constructor 
00117   CbcSOS ( const CbcSOS &);
00118    
00120   virtual CbcObject * clone() const;
00121 
00122   // Assignment operator 
00123   CbcSOS & operator=( const CbcSOS& rhs);
00124 
00125   // Destructor 
00126   ~CbcSOS ();
00127   
00128   using CbcObject::infeasibility ;
00130   virtual double infeasibility(int & preferredWay) const;
00132   virtual double infeasibility(const OsiBranchingInformation * info, 
00133                                int & preferredWay) const;
00134 
00135   using CbcObject::feasibleRegion ;
00137   virtual void feasibleRegion();
00138 
00139   using CbcObject::createBranch ;
00141   virtual CbcBranchingObject * createBranch(int way) ;
00142 
00143 
00144 
00148   virtual CbcObjectUpdateData createUpdateInformation(const OsiSolverInterface * solver, 
00149                                                         const CbcNode * node,
00150                                                         const CbcBranchingObject * branchingObject);
00152   virtual void updateInformation(const CbcObjectUpdateData & data) ;
00153   using CbcObject::solverBranch ;
00158   virtual OsiSolverBranch * solverBranch() const;
00160   virtual void redoSequenceEtc(CbcModel * model, int numberColumns, const int * originalColumns);
00161   
00163   OsiSOS * osiObject(const OsiSolverInterface * solver) const;
00165   inline int numberMembers() const
00166   {return numberMembers_;}
00167 
00169   inline const int * members() const
00170   {return members_;}
00171 
00173   inline int sosType() const
00174   {return sosType_;}
00176   inline int numberTimesDown() const
00177   { return numberTimesDown_;}
00179   inline int numberTimesUp() const
00180   { return numberTimesUp_;}
00181 
00183   inline const double * weights() const
00184   { return weights_;}
00185 
00187   inline void setNumberMembers(int n)
00188   {numberMembers_ = n;}
00189 
00191   inline int * mutableMembers() const
00192   {return members_;}
00193 
00195   inline double * mutableWeights() const
00196   { return weights_;}
00197 
00200   virtual bool canDoHeuristics() const 
00201   {return (sosType_==1&&integerValued_);}
00203   inline void setIntegerValued(bool yesNo)
00204   { integerValued_=yesNo;}
00205 private:
00207 
00209   int * members_;
00211   double * weights_;
00213   mutable double shadowEstimateDown_;
00215   mutable double shadowEstimateUp_;
00217   double downDynamicPseudoRatio_;
00219   double upDynamicPseudoRatio_;
00221   int numberTimesDown_;
00223   int numberTimesUp_;
00225   int numberMembers_;
00227   int sosType_;
00229   bool integerValued_;
00230 };
00231 
00233 
00234 
00235 class CbcSimpleInteger : public CbcObject {
00236 
00237 public:
00238 
00239   // Default Constructor 
00240   CbcSimpleInteger ();
00241 
00242   // Useful constructor - passed model and index
00243   CbcSimpleInteger (CbcModel * model,  int iColumn, double breakEven=0.5);
00244   
00245   // Useful constructor - passed model and Osi object
00246   CbcSimpleInteger (CbcModel * model,  const OsiSimpleInteger * object);
00247   
00248   // Copy constructor 
00249   CbcSimpleInteger ( const CbcSimpleInteger &);
00250    
00252   virtual CbcObject * clone() const;
00253 
00254   // Assignment operator 
00255   CbcSimpleInteger & operator=( const CbcSimpleInteger& rhs);
00256 
00257   // Destructor 
00258   ~CbcSimpleInteger ();
00260   OsiSimpleInteger * osiObject() const;
00261   using CbcObject::infeasibility ;
00263   virtual double infeasibility(const OsiSolverInterface * solver, 
00264                                const OsiBranchingInformation * info, int & preferredWay) const;
00265 
00266   using CbcObject::feasibleRegion ;
00272   virtual double feasibleRegion(OsiSolverInterface * solver, const OsiBranchingInformation * info) const;
00273 
00274   using CbcObject::createBranch ;
00280   virtual CbcBranchingObject * createBranch(OsiSolverInterface * solver,
00281                                             const OsiBranchingInformation * info, int way) ;
00283   void fillCreateBranch(CbcIntegerBranchingObject * branching, const OsiBranchingInformation * info, int way) ;
00284 
00285   using CbcObject::solverBranch ;
00290   virtual OsiSolverBranch * solverBranch(OsiSolverInterface * solver, const OsiBranchingInformation * info) const;
00292   virtual double infeasibility(int & preferredWay) const;
00293 
00300   virtual void feasibleRegion();
00301 
00306   virtual CbcBranchingObject * createBranch(int way) ;
00311   virtual int columnNumber() const;
00313   inline void setColumnNumber(int value)
00314   { columnNumber_ = value;}
00315 
00320   virtual void resetBounds(const OsiSolverInterface * solver) ;
00323   virtual void resetSequenceEtc(int numberColumns, const int * originalColumns) ;
00325   inline double originalLowerBound() const
00326   { return originalLower_;}
00327   inline void setOriginalLowerBound(double value)
00328   { originalLower_=value;}
00329   inline double originalUpperBound() const
00330   { return originalUpper_;}
00331   inline void setOriginalUpperBound(double value)
00332   { originalUpper_=value;}
00334   inline double breakEven() const
00335   { return breakEven_;}
00337   inline void setBreakEven(double value)
00338   { breakEven_=value;}
00339 
00340 
00341 protected:
00343 
00345   double originalLower_;
00347   double originalUpper_;
00349   double breakEven_;
00351   int columnNumber_;
00353   int preferredWay_;
00354 };
00361 class CbcNWay : public CbcObject {
00362 
00363 public:
00364 
00365   // Default Constructor 
00366   CbcNWay ();
00367 
00370   CbcNWay (CbcModel * model, int numberMembers,
00371              const int * which, int identifier);
00372   
00373   // Copy constructor 
00374   CbcNWay ( const CbcNWay &);
00375    
00377   virtual CbcObject * clone() const;
00378 
00380   CbcNWay & operator=( const CbcNWay& rhs);
00381 
00383   ~CbcNWay ();
00384 
00386   void setConsequence(int iColumn, const CbcConsequence & consequence);
00387   
00389   void applyConsequence(int iSequence, int state) const;
00390   
00391   using CbcObject::infeasibility ;
00393   virtual double infeasibility(int & preferredWay) const;
00394 
00395   using CbcObject::feasibleRegion ;
00397   virtual void feasibleRegion();
00398 
00399   using CbcObject::createBranch ;
00401   virtual CbcBranchingObject * createBranch(int way) ;
00402 
00404   inline int numberMembers() const
00405   {return numberMembers_;}
00406 
00408   inline const int * members() const
00409   {return members_;}
00411   virtual void redoSequenceEtc(CbcModel * model, int numberColumns, const int * originalColumns);
00412 
00413 protected:
00416   int numberMembers_;
00417 
00419   int * members_;
00421   CbcConsequence ** consequence_;
00422 };
00423 
00434 class CbcIntegerBranchingObject : public CbcBranchingObject {
00435 
00436 public:
00437 
00439   CbcIntegerBranchingObject ();
00440 
00448   CbcIntegerBranchingObject (CbcModel *model, int variable,
00449                              int way , double value) ;
00450   
00458   CbcIntegerBranchingObject (CbcModel *model, int variable, int way,
00459                              double lowerValue, double upperValue) ;
00460   
00462   CbcIntegerBranchingObject ( const CbcIntegerBranchingObject &);
00463    
00465   CbcIntegerBranchingObject & operator= (const CbcIntegerBranchingObject& rhs);
00466 
00468   virtual CbcBranchingObject * clone() const;
00469 
00471   virtual ~CbcIntegerBranchingObject ();
00472 
00474   void fillPart ( int variable, int way , double value) ;
00475   using CbcBranchingObject::branch ;
00480   virtual double branch();
00483   virtual void fix(OsiSolverInterface * solver,
00484                    double * lower, double * upper,
00485                    int branchState) const ;
00486 
00487 #if 0
00488   // No need to override. Default works fine.
00492   virtual void previousBranch();
00493 #endif
00494 
00495   using CbcBranchingObject::print ;
00498   virtual void print();
00499 
00501   inline const double * downBounds() const
00502   { return down_;}
00504   inline const double * upBounds() const
00505   { return up_;}
00507   inline void setDownBounds(const double bounds[2])
00508   { memcpy(down_,bounds,2*sizeof(double));}
00510   inline void setUpBounds(const double bounds[2])
00511   { memcpy(up_,bounds,2*sizeof(double));}
00512 #ifdef FUNNY_BRANCHING
00513 
00515   inline const int * variables() const
00516   { return variables_;}
00517   // New bound
00518   inline const double * newBounds() const
00519   { return newBounds_;}
00521   inline int numberExtraChangedBounds() const
00522   { return numberExtraChangedBounds_;}
00524   int applyExtraBounds(int iColumn, double lower, double upper, int way) ;
00526   void deactivate();
00528   inline bool active() const
00529   { return (down_[1]!=-COIN_DBL_MAX);}
00530 #endif
00531 
00533   virtual int type() const { return 100; }
00534 
00543   virtual CbcRangeCompare compareBranchingObject
00544   (const CbcBranchingObject* brObj, const bool replaceIfOverlap = false);
00545 
00546 protected:
00548   double down_[2];
00550   double up_[2];
00551 #ifdef FUNNY_BRANCHING
00552 
00554   int * variables_;
00555   // New bound
00556   double * newBounds_;
00558   int numberExtraChangedBounds_;
00559 #endif
00560 };
00561 
00562 
00564 
00565 
00566 class CbcSimpleIntegerPseudoCost : public CbcSimpleInteger {
00567 
00568 public:
00569 
00570   // Default Constructor 
00571   CbcSimpleIntegerPseudoCost ();
00572 
00573   // Useful constructor - passed model index
00574   CbcSimpleIntegerPseudoCost (CbcModel * model, int iColumn, double breakEven=0.5);
00575   
00576   // Useful constructor - passed and model index and pseudo costs
00577   CbcSimpleIntegerPseudoCost (CbcModel * model, int iColumn, 
00578                               double downPseudoCost, double upPseudoCost);
00579   // Useful constructor - passed and model index and pseudo costs
00580   CbcSimpleIntegerPseudoCost (CbcModel * model, int dummy,int iColumn, 
00581                               double downPseudoCost, double upPseudoCost);
00582   
00583   // Copy constructor 
00584   CbcSimpleIntegerPseudoCost ( const CbcSimpleIntegerPseudoCost &);
00585    
00587   virtual CbcObject * clone() const;
00588 
00589   // Assignment operator 
00590   CbcSimpleIntegerPseudoCost & operator=( const CbcSimpleIntegerPseudoCost& rhs);
00591 
00592   // Destructor 
00593   ~CbcSimpleIntegerPseudoCost ();
00594   
00595   using CbcObject::infeasibility ;
00597   virtual double infeasibility(int & preferredWay) const;
00598 
00599   using CbcObject::createBranch ;
00601   virtual CbcBranchingObject * createBranch(int way) ;
00602 
00604   inline double downPseudoCost() const
00605   { return downPseudoCost_;}
00607   inline void setDownPseudoCost(double value)
00608   { downPseudoCost_=value;}
00609 
00611   inline double upPseudoCost() const
00612   { return upPseudoCost_;}
00614   inline void setUpPseudoCost(double value)
00615   { upPseudoCost_=value;}
00616 
00618   inline double upDownSeparator() const
00619   { return upDownSeparator_;}
00621   inline void setUpDownSeparator(double value)
00622   { upDownSeparator_=value;}
00623 
00625   virtual double upEstimate() const;
00627   virtual double downEstimate() const;
00628   
00630   inline int method() const
00631   { return method_;}
00633   inline void setMethod(int value)
00634   { method_=value;}
00635 
00636 protected:
00638 
00640   double downPseudoCost_;
00642   double upPseudoCost_;
00647   double upDownSeparator_;
00654   int method_;
00655 };
00656 
00657 
00668 class CbcIntegerPseudoCostBranchingObject : public CbcIntegerBranchingObject {
00669 
00670 public:
00671 
00673   CbcIntegerPseudoCostBranchingObject ();
00674 
00682   CbcIntegerPseudoCostBranchingObject (CbcModel *model, int variable,
00683                              int way , double value) ;
00684   
00692   CbcIntegerPseudoCostBranchingObject (CbcModel *model, int variable, int way,
00693                              double lowerValue, double upperValue) ;
00694   
00696   CbcIntegerPseudoCostBranchingObject ( const CbcIntegerPseudoCostBranchingObject &);
00697    
00699   CbcIntegerPseudoCostBranchingObject & operator= (const CbcIntegerPseudoCostBranchingObject& rhs);
00700 
00702   virtual CbcBranchingObject * clone() const;
00703 
00705   virtual ~CbcIntegerPseudoCostBranchingObject ();
00706   
00707   using CbcBranchingObject::branch ;
00712   virtual double branch();
00713 
00715   inline double changeInGuessed() const
00716   { return changeInGuessed_;}
00718   inline void setChangeInGuessed(double value)
00719   { changeInGuessed_=value;}
00720 
00722   virtual int type() const { return 101; }
00723 
00732   virtual CbcRangeCompare compareBranchingObject
00733   (const CbcBranchingObject* brObj, const bool replaceIfOverlap = false);
00734 
00735 protected:
00737   double changeInGuessed_;
00738 };
00739 
00740 
00749 class CbcCliqueBranchingObject : public CbcBranchingObject {
00750 
00751 public:
00752 
00753   // Default Constructor 
00754   CbcCliqueBranchingObject ();
00755 
00756   // Useful constructor
00757   CbcCliqueBranchingObject (CbcModel * model,  const CbcClique * clique,
00758                             int way,
00759                             int numberOnDownSide, const int * down,
00760                             int numberOnUpSide, const int * up);
00761   
00762   // Copy constructor 
00763   CbcCliqueBranchingObject ( const CbcCliqueBranchingObject &);
00764    
00765   // Assignment operator 
00766   CbcCliqueBranchingObject & operator=( const CbcCliqueBranchingObject& rhs);
00767 
00769   virtual CbcBranchingObject * clone() const;
00770 
00771   // Destructor 
00772   virtual ~CbcCliqueBranchingObject ();
00773   
00774   using CbcBranchingObject::branch ;
00776   virtual double branch();
00777 
00778 #if 0
00779   // No need to override. Default works fine.
00783   virtual void previousBranch();
00784 #endif
00785 
00786   using CbcBranchingObject::print ;
00789   virtual void print();
00790 
00792   virtual int type() const { return 102; }
00793 
00801   virtual int compareOriginalObject(const CbcBranchingObject* brObj) const;
00802 
00811   virtual CbcRangeCompare compareBranchingObject
00812   (const CbcBranchingObject* brObj, const bool replaceIfOverlap = false);
00813 
00814 private:
00816   const CbcClique * clique_;
00818   unsigned int downMask_[2];
00820   unsigned int upMask_[2];
00821 };
00822 
00823 
00828 class CbcLongCliqueBranchingObject : public CbcBranchingObject {
00829 
00830 public:
00831 
00832   // Default Constructor 
00833   CbcLongCliqueBranchingObject ();
00834 
00835   // Useful constructor
00836   CbcLongCliqueBranchingObject (CbcModel * model,  const CbcClique * clique,
00837                                  int way,
00838                             int numberOnDownSide, const int * down,
00839                             int numberOnUpSide, const int * up);
00840   
00841   // Copy constructor 
00842   CbcLongCliqueBranchingObject ( const CbcLongCliqueBranchingObject &);
00843    
00844   // Assignment operator 
00845   CbcLongCliqueBranchingObject & operator=( const CbcLongCliqueBranchingObject& rhs);
00846 
00848   virtual CbcBranchingObject * clone() const;
00849 
00850   // Destructor 
00851   virtual ~CbcLongCliqueBranchingObject ();
00852   
00853   using CbcBranchingObject::branch ;
00855   virtual double branch();
00856 
00857 #if 0
00858   // No need to override. Default works fine.
00862   virtual void previousBranch();
00863 #endif
00864 
00865   using CbcBranchingObject::print ;
00868   virtual void print();
00869 
00871   virtual int type() const { return 103; }
00872 
00880   virtual int compareOriginalObject(const CbcBranchingObject* brObj) const;
00881 
00890   virtual CbcRangeCompare compareBranchingObject
00891   (const CbcBranchingObject* brObj, const bool replaceIfOverlap = false);
00892 
00893 private:
00895   const CbcClique * clique_;
00897   unsigned int * downMask_;
00899   unsigned int * upMask_;
00900 };
00901 
00907 class CbcSOSBranchingObject : public CbcBranchingObject {
00908 
00909 public:
00910 
00911   // Default Constructor 
00912   CbcSOSBranchingObject ();
00913 
00914   // Useful constructor
00915   CbcSOSBranchingObject (CbcModel * model,  const CbcSOS * clique,
00916                             int way,
00917                          double separator);
00918   
00919   // Copy constructor 
00920   CbcSOSBranchingObject ( const CbcSOSBranchingObject &);
00921    
00922   // Assignment operator 
00923   CbcSOSBranchingObject & operator=( const CbcSOSBranchingObject& rhs);
00924 
00926   virtual CbcBranchingObject * clone() const;
00927 
00928   // Destructor 
00929   virtual ~CbcSOSBranchingObject ();
00930   
00931   using CbcBranchingObject::branch ;
00933   virtual double branch();
00936   virtual void fix(OsiSolverInterface * solver,
00937                    double * lower, double * upper,
00938                    int branchState) const ;
00939 
00943   virtual void previousBranch() {
00944     CbcBranchingObject::previousBranch();
00945     computeNonzeroRange();
00946   }
00947 
00948   using CbcBranchingObject::print ;
00951   virtual void print();
00952 
00954   virtual int type() const { return 104; }
00955 
00963   virtual int compareOriginalObject(const CbcBranchingObject* brObj) const;
00964 
00973   virtual CbcRangeCompare compareBranchingObject
00974   (const CbcBranchingObject* brObj, const bool replaceIfOverlap = false);
00975 
00977   void computeNonzeroRange();
00978 
00979 private:
00981   const CbcSOS * set_;
00983   double separator_;
00989   int firstNonzero_;
00990   int lastNonzero_;
00991 };
00992 
00996 class CbcNWayBranchingObject : public CbcBranchingObject {
00997 
00998 public:
00999 
01000   // Default Constructor 
01001   CbcNWayBranchingObject ();
01002 
01007   CbcNWayBranchingObject (CbcModel * model,  const CbcNWay * nway,
01008                           int numberBranches, const int * order);
01009   
01010   // Copy constructor 
01011   CbcNWayBranchingObject ( const CbcNWayBranchingObject &);
01012    
01013   // Assignment operator 
01014   CbcNWayBranchingObject & operator=( const CbcNWayBranchingObject& rhs);
01015 
01017   virtual CbcBranchingObject * clone() const;
01018 
01019   // Destructor 
01020   virtual ~CbcNWayBranchingObject ();
01021   
01022   using CbcBranchingObject::branch ;
01024   virtual double branch();
01025 
01026 #if 0
01027   // FIXME: what do we need to do here?
01031   virtual void previousBranch();
01032 #endif
01033 
01034   using CbcBranchingObject::print ;
01037   virtual void print();
01040   virtual int numberBranches() const
01041   {return numberInSet_;}
01043   virtual bool twoWay() const
01044   { return false;}
01045 
01047   virtual int type() const { return 105; }
01048 
01056   virtual int compareOriginalObject(const CbcBranchingObject* brObj) const;
01057 
01066   virtual CbcRangeCompare compareBranchingObject
01067   (const CbcBranchingObject* brObj, const bool replaceIfOverlap = false);
01068 
01069 private:
01071   int * order_;
01073   const CbcNWay * object_;
01075   int numberInSet_;
01076 };
01077 
01084 class CbcBranchDefaultDecision : public CbcBranchDecision {
01085 public:
01086   // Default Constructor 
01087   CbcBranchDefaultDecision ();
01088 
01089   // Copy constructor 
01090   CbcBranchDefaultDecision ( const CbcBranchDefaultDecision &);
01091 
01092   virtual ~CbcBranchDefaultDecision();
01093 
01095   virtual CbcBranchDecision * clone() const;
01096 
01098   virtual void initialize(CbcModel * model);
01099 
01119   virtual int betterBranch(CbcBranchingObject * thisOne,
01120                             CbcBranchingObject * bestSoFar,
01121                             double changeUp, int numInfUp,
01122                             double changeDn, int numInfDn);
01124   virtual void setBestCriterion(double value);
01125   virtual double getBestCriterion() const;
01126 
01133   virtual int
01134   bestBranch (CbcBranchingObject ** objects, int numberObjects, int numberUnsatisfied,
01135               double * changeUp, int * numberInfeasibilitiesUp,
01136               double * changeDown, int * numberInfeasibilitiesDown,
01137               double objectiveValue) ;
01138 private:
01139   
01141   CbcBranchDefaultDecision & operator=(const CbcBranchDefaultDecision& rhs);
01142 
01144 
01146   double bestCriterion_;
01147 
01149   double bestChangeUp_;
01150 
01152   int bestNumberUp_;
01153 
01155   double bestChangeDown_;
01156 
01158   CbcBranchingObject * bestObject_;
01159 
01161   int bestNumberDown_;
01162 
01163 };
01164 
01176 class CbcFollowOn : public CbcObject {
01177 
01178 public:
01179 
01180   // Default Constructor 
01181   CbcFollowOn ();
01182 
01185   CbcFollowOn (CbcModel * model);
01186   
01187   // Copy constructor 
01188   CbcFollowOn ( const CbcFollowOn &);
01189    
01191   virtual CbcObject * clone() const;
01192 
01193   // Assignment operator 
01194   CbcFollowOn & operator=( const CbcFollowOn& rhs);
01195 
01196   // Destructor 
01197   ~CbcFollowOn ();
01198   
01199   using CbcObject::infeasibility ;
01201   virtual double infeasibility(int & preferredWay) const;
01202 
01203   using CbcObject::feasibleRegion ;
01205   virtual void feasibleRegion();
01206 
01207   using CbcObject::createBranch ;
01209   virtual CbcBranchingObject * createBranch(int way) ;
01211   virtual int gutsOfFollowOn(int & otherRow, int & preferredWay) const;
01212 
01213 protected:
01216   CoinPackedMatrix matrix_;
01218   CoinPackedMatrix matrixByRow_; 
01220   int * rhs_;
01221 };
01225 class CbcFixingBranchingObject : public CbcBranchingObject {
01226 
01227 public:
01228 
01229   // Default Constructor 
01230   CbcFixingBranchingObject ();
01231 
01232   // Useful constructor
01233   CbcFixingBranchingObject (CbcModel * model, 
01234                             int way,
01235                             int numberOnDownSide, const int * down,
01236                             int numberOnUpSide, const int * up);
01237   
01238   // Copy constructor 
01239   CbcFixingBranchingObject ( const CbcFixingBranchingObject &);
01240    
01241   // Assignment operator 
01242   CbcFixingBranchingObject & operator=( const CbcFixingBranchingObject& rhs);
01243 
01245   virtual CbcBranchingObject * clone() const;
01246 
01247   // Destructor 
01248   virtual ~CbcFixingBranchingObject ();
01249   
01250   using CbcBranchingObject::branch ;
01252   virtual double branch();
01253 
01254 #if 0
01255   // No need to override. Default works fine.
01259   virtual void previousBranch();
01260 #endif
01261 
01262   using CbcBranchingObject::print ;
01265   virtual void print();
01266 
01268   virtual int type() const { return 106; }
01269 
01277   virtual int compareOriginalObject(const CbcBranchingObject* brObj) const;
01278 
01287   virtual CbcRangeCompare compareBranchingObject
01288   (const CbcBranchingObject* brObj, const bool replaceIfOverlap = false);
01289 
01290 private:
01293   int numberDown_;
01295   int numberUp_;
01297   int * downList_;
01299   int * upList_;
01300 };
01311 class CbcFixVariable : public CbcConsequence {
01312 
01313 public:
01314 
01315   // Default Constructor 
01316   CbcFixVariable ();
01317 
01318   // One useful Constructor 
01319   CbcFixVariable (int numberStates,const int * states, const int * numberNewLower, const int ** newLowerValue,
01320                   const int ** lowerColumn,
01321                   const int * numberNewUpper, const int ** newUpperValue,
01322                   const int ** upperColumn);
01323 
01324   // Copy constructor 
01325   CbcFixVariable ( const CbcFixVariable & rhs);
01326    
01327   // Assignment operator 
01328   CbcFixVariable & operator=( const CbcFixVariable & rhs);
01329 
01331   virtual CbcConsequence * clone() const;
01332 
01334   virtual ~CbcFixVariable ();
01335 
01338   virtual void applyToSolver(OsiSolverInterface * solver, int state) const;
01339   
01340 protected:
01342   int numberStates_;
01344   int * states_;
01346   int * startLower_;
01348   int * startUpper_;
01350   double * newBound_;
01352   int * variable_;
01353 };
01360 class CbcDummyBranchingObject : public CbcBranchingObject {
01361 
01362 public:
01363 
01365   CbcDummyBranchingObject (CbcModel * model=NULL);
01366 
01368   CbcDummyBranchingObject ( const CbcDummyBranchingObject &);
01369    
01371   CbcDummyBranchingObject & operator= (const CbcDummyBranchingObject& rhs);
01372 
01374   virtual CbcBranchingObject * clone() const;
01375 
01377   virtual ~CbcDummyBranchingObject ();
01378   
01379   using CbcBranchingObject::branch ;
01382   virtual double branch();
01383 
01384 #if 0
01385   // No need to override. Default works fine.
01389   virtual void previousBranch();
01390 #endif
01391 
01392   using CbcBranchingObject::print ;
01395   virtual void print();
01396 
01398   virtual int type() const { return 107; }
01399 
01407   virtual int compareOriginalObject(const CbcBranchingObject* brObj) const;
01408 
01417   virtual CbcRangeCompare compareBranchingObject
01418   (const CbcBranchingObject* brObj, const bool replaceIfOverlap = false);
01419 
01420 };
01421 
01427 class CbcGeneral : public CbcObject {
01428 
01429 public:
01430 
01431   // Default Constructor 
01432   CbcGeneral ();
01433 
01437   CbcGeneral (CbcModel * model);
01438   
01439   // Copy constructor 
01440   CbcGeneral ( const CbcGeneral &);
01441    
01443   virtual CbcObject * clone() const=0;
01444 
01445   // Assignment operator 
01446   CbcGeneral & operator=( const CbcGeneral& rhs);
01447 
01448   // Destructor 
01449   ~CbcGeneral ();
01450   
01451   using CbcObject::infeasibility ;
01453   virtual double infeasibility(int & preferredWay) const=0;
01454 
01455   using CbcObject::feasibleRegion ;
01457   virtual void feasibleRegion()=0;
01458 
01459   using CbcObject::createBranch ;
01461   virtual CbcBranchingObject * createBranch(int way)=0 ;
01462 
01464   virtual void redoSequenceEtc(CbcModel * model, int numberColumns, const int * originalColumns)=0;
01465 
01466 protected:
01468 };
01469 #ifdef COIN_HAS_CLP
01470 
01474 #include "ClpSimplex.hpp"
01475 #include "ClpNode.hpp"
01476 
01477 class CbcGeneralDepth : public CbcGeneral {
01478 
01479 public:
01480 
01481   // Default Constructor 
01482   CbcGeneralDepth ();
01483 
01490   CbcGeneralDepth (CbcModel * model, int maximumDepth);
01491   
01492   // Copy constructor 
01493   CbcGeneralDepth ( const CbcGeneralDepth &);
01494    
01496   virtual CbcObject * clone() const;
01497 
01498   // Assignment operator 
01499   CbcGeneralDepth & operator=( const CbcGeneralDepth& rhs);
01500 
01501   // Destructor 
01502   ~CbcGeneralDepth ();
01503   
01504   using CbcObject::infeasibility ;
01506   virtual double infeasibility(int & preferredWay) const;
01507 
01508   using CbcObject::feasibleRegion ;
01510   virtual void feasibleRegion();
01511 
01512   using CbcObject::createBranch ;
01514   virtual CbcBranchingObject * createBranch(int way) ;
01516   inline int maximumDepth() const
01517   {return maximumDepth_;}
01519   inline void setMaximumDepth(int value)
01520   {maximumDepth_ = value;}
01522   inline int whichSolution() const
01523   {return whichSolution_;}
01525   inline ClpNode * nodeInfo(int which)
01526   { return nodeInfo_->nodeInfo_[which];}
01527 
01529   virtual void redoSequenceEtc(CbcModel * model, int numberColumns, const int * originalColumns);
01530 
01531 protected:
01534   int maximumDepth_;
01536   mutable int whichSolution_;
01538   mutable int numberNodes_;
01540   mutable ClpNodeStuff * nodeInfo_;
01541 };
01542 
01546 class CoinWarmStartDiff;
01547 class CbcSubProblem {
01548 
01549 public:
01550 
01552   CbcSubProblem ();
01553 
01555   CbcSubProblem (const OsiSolverInterface * solver,
01556                  const double * lowerBefore,
01557                  const double * upperBefore,
01558                  const unsigned char * status);
01559 
01561   CbcSubProblem ( const CbcSubProblem &);
01562    
01564   CbcSubProblem & operator= (const CbcSubProblem& rhs);
01565 
01567   virtual ~CbcSubProblem ();
01568 
01570   void apply(OsiSolverInterface * model);
01571 
01572 public:
01574   double objectiveValue_;
01576   double sumInfeasibilities_;
01579   int * variables_;
01581   double * newBounds_;
01583   CoinWarmStartDiff * statusDifference_;
01585   int numberChangedBounds_;
01587   int numberInfeasibilities_;
01588 };
01589 
01593 class CbcNode;
01594 class CbcGeneralBranchingObject : public CbcBranchingObject {
01595 
01596 public:
01597 
01598   // Default Constructor 
01599   CbcGeneralBranchingObject ();
01600 
01601   // Useful constructor
01602   CbcGeneralBranchingObject (CbcModel * model);
01603   
01604   // Copy constructor 
01605   CbcGeneralBranchingObject ( const CbcGeneralBranchingObject &);
01606    
01607   // Assignment operator 
01608   CbcGeneralBranchingObject & operator=( const CbcGeneralBranchingObject& rhs);
01609 
01611   virtual CbcBranchingObject * clone() const;
01612 
01613   // Destructor 
01614   virtual ~CbcGeneralBranchingObject ();
01615   
01616   using CbcBranchingObject::branch ;
01618   virtual double branch();
01621   virtual void checkIsCutoff(double cutoff);
01622 
01623   using CbcBranchingObject::print ;
01626   virtual void print();
01628   void state(double & objectiveValue,double & sumInfeasibilities,
01629              int & numberUnsatisfied,int which) const;
01631   inline void setNode(CbcNode * node)
01632   { node_ = node;}
01634   virtual int type() const { return 108; }
01635 
01643   virtual int compareOriginalObject(const CbcBranchingObject* brObj) const;
01644 
01653   virtual CbcRangeCompare compareBranchingObject
01654   (const CbcBranchingObject* brObj, const bool replaceIfOverlap = false);
01655 
01656 public:
01658   // Sub problems
01659   CbcSubProblem * subProblems_;
01661   CbcNode * node_;
01663   int numberSubProblems_;
01665   int numberRows_;
01666 };
01667 #endif
01668 #endif

Generated on Thu Nov 6 03:00:43 2008 by  doxygen 1.4.7