Cbc trunk
|
00001 // $Id$ 00002 // Copyright (C) 2002, International Business Machines 00003 // Corporation and others. All Rights Reserved. 00004 // This code is licensed under the terms of the Eclipse Public License (EPL). 00005 00006 // Edwin 11/9/2009-- carved out of CbcBranchActual 00007 00012 #ifndef CbcNWay_H 00013 #define CbcNWay_H 00014 00015 class CbcNWay : public CbcObject { 00016 00017 public: 00018 00019 // Default Constructor 00020 CbcNWay (); 00021 00024 CbcNWay (CbcModel * model, int numberMembers, 00025 const int * which, int identifier); 00026 00027 // Copy constructor 00028 CbcNWay ( const CbcNWay &); 00029 00031 virtual CbcObject * clone() const; 00032 00034 CbcNWay & operator=( const CbcNWay& rhs); 00035 00037 virtual ~CbcNWay (); 00038 00040 void setConsequence(int iColumn, const CbcConsequence & consequence); 00041 00043 void applyConsequence(int iSequence, int state) const; 00044 00046 virtual double infeasibility(const OsiBranchingInformation * info, 00047 int &preferredWay) const; 00048 00049 using CbcObject::feasibleRegion ; 00051 virtual void feasibleRegion(); 00052 00054 virtual CbcBranchingObject * createCbcBranch(OsiSolverInterface * solver, const OsiBranchingInformation * info, int way) ; 00055 00057 inline int numberMembers() const { 00058 return numberMembers_; 00059 } 00060 00062 inline const int * members() const { 00063 return members_; 00064 } 00066 virtual void redoSequenceEtc(CbcModel * model, int numberColumns, const int * originalColumns); 00067 00068 protected: 00071 int numberMembers_; 00072 00074 int * members_; 00076 CbcConsequence ** consequence_; 00077 }; 00081 class CbcNWayBranchingObject : public CbcBranchingObject { 00082 00083 public: 00084 00085 // Default Constructor 00086 CbcNWayBranchingObject (); 00087 00092 CbcNWayBranchingObject (CbcModel * model, const CbcNWay * nway, 00093 int numberBranches, const int * order); 00094 00095 // Copy constructor 00096 CbcNWayBranchingObject ( const CbcNWayBranchingObject &); 00097 00098 // Assignment operator 00099 CbcNWayBranchingObject & operator=( const CbcNWayBranchingObject& rhs); 00100 00102 virtual CbcBranchingObject * clone() const; 00103 00104 // Destructor 00105 virtual ~CbcNWayBranchingObject (); 00106 00107 using CbcBranchingObject::branch ; 00109 virtual double branch(); 00110 00111 #ifdef JJF_ZERO 00112 // FIXME: what do we need to do here? 00116 virtual void previousBranch(); 00117 #endif 00118 00119 using CbcBranchingObject::print ; 00122 virtual void print(); 00125 virtual int numberBranches() const { 00126 return numberInSet_; 00127 } 00129 virtual bool twoWay() const { 00130 return false; 00131 } 00132 00134 virtual CbcBranchObjType type() const { 00135 return NWayBranchObj; 00136 } 00137 00145 virtual int compareOriginalObject(const CbcBranchingObject* brObj) const; 00146 00155 virtual CbcRangeCompare compareBranchingObject 00156 (const CbcBranchingObject* brObj, const bool replaceIfOverlap = false); 00157 00158 private: 00160 int * order_; 00162 const CbcNWay * object_; 00164 int numberInSet_; 00165 }; 00166 #endif