# CbcSOS.hpp

Go to the documentation of this file.

    00001 // $Id: CbcSOS.hpp 1902 2013-04-10 16:58:16Z stefan $
    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
    00008 #ifndef CbcSOS_H
    00009 #define CbcSOS_H
    00010
    00029 class CbcSOS : public CbcObject {
    00030
    00031 public:
    00032
    00033     // Default Constructor
    00034     CbcSOS ();
    00035
    00046     CbcSOS (CbcModel * model, int numberMembers,
    00047             const int * which, const double * weights, int identifier,
    00048             int type = 1);
    00049
    00050     // Copy constructor
    00051     CbcSOS ( const CbcSOS &);
    00052
    00054     virtual CbcObject * clone() const;
    00055
    00056     // Assignment operator
    00057     CbcSOS & operator=( const CbcSOS& rhs);
    00058
    00059     // Destructor
    00060     virtual ~CbcSOS ();
    00061
    00063     virtual double infeasibility(const OsiBranchingInformation * info,
    00064                                  int &preferredWay) const;
    00065
    00066     using CbcObject::feasibleRegion ;
    00068     virtual void feasibleRegion();
    00069
    00071     virtual CbcBranchingObject * createCbcBranch(OsiSolverInterface * solver, const OsiBranchingInformation * info, int way) ;
    00072
    00073
    00074
    00078     virtual CbcObjectUpdateData createUpdateInformation(const OsiSolverInterface * solver,
    00079             const CbcNode * node,
    00080             const CbcBranchingObject * branchingObject);
    00082     virtual void updateInformation(const CbcObjectUpdateData & data) ;
    00083     using CbcObject::solverBranch ;
    00088     virtual OsiSolverBranch * solverBranch() const;
    00090     virtual void redoSequenceEtc(CbcModel * model, int numberColumns, const int * originalColumns);
    00091
    00093     OsiSOS * osiObject(const OsiSolverInterface * solver) const;
    00095     inline int numberMembers() const {
    00096         return numberMembers_;
    00097     }
    00098
    00100     inline const int * members() const {
    00101         return members_;
    00102     }
    00103
    00105     inline int sosType() const {
    00106         return sosType_;
    00107     }
    00109     inline int numberTimesDown() const {
    00110         return numberTimesDown_;
    00111     }
    00113     inline int numberTimesUp() const {
    00114         return numberTimesUp_;
    00115     }
    00116
    00118     inline const double * weights() const {
    00119         return weights_;
    00120     }
    00121
    00123     inline void setNumberMembers(int n) {
    00124         numberMembers_ = n;
    00125     }
    00126
    00128     inline int * mutableMembers() const {
    00129         return members_;
    00130     }
    00131
    00133     inline double * mutableWeights() const {
    00134         return weights_;
    00135     }
    00136
    00139     virtual bool canDoHeuristics() const {
    00140         return (sosType_ == 1 && integerValued_);
    00141     }
    00143     inline void setIntegerValued(bool yesNo) {
    00144         integerValued_ = yesNo;
    00145     }
    00146 private:
    00148
    00150     int * members_;
    00163     double * weights_;
    00165     mutable double shadowEstimateDown_;
    00167     mutable double shadowEstimateUp_;
    00169     double downDynamicPseudoRatio_;
    00171     double upDynamicPseudoRatio_;
    00173     int numberTimesDown_;
    00175     int numberTimesUp_;
    00177     int numberMembers_;
    00179     int sosType_;
    00181     bool integerValued_;
    00182 };
    00183
    00189 class CbcSOSBranchingObject : public CbcBranchingObject {
    00190
    00191 public:
    00192
    00193     // Default Constructor
    00194     CbcSOSBranchingObject ();
    00195
    00196     // Useful constructor
    00197     CbcSOSBranchingObject (CbcModel * model,  const CbcSOS * clique,
    00198                            int way,
    00199                            double separator);
    00200
    00201     // Copy constructor
    00202     CbcSOSBranchingObject ( const CbcSOSBranchingObject &);
    00203
    00204     // Assignment operator
    00205     CbcSOSBranchingObject & operator=( const CbcSOSBranchingObject& rhs);
    00206
    00208     virtual CbcBranchingObject * clone() const;
    00209
    00210     // Destructor
    00211     virtual ~CbcSOSBranchingObject ();
    00212
    00213     using CbcBranchingObject::branch ;
    00215     virtual double branch();
    00218     virtual void fix(OsiSolverInterface * solver,
    00219                      double * lower, double * upper,
    00220                      int branchState) const ;
    00221
    00225     virtual void previousBranch() {
    00226         CbcBranchingObject::previousBranch();
    00227         computeNonzeroRange();
    00228     }
    00229
    00230     using CbcBranchingObject::print ;
    00233     virtual void print();
    00234
    00236     virtual CbcBranchObjType type() const {
    00237         return SoSBranchObj;
    00238     }
    00239
    00247     virtual int compareOriginalObject(const CbcBranchingObject* brObj) const;
    00248
    00257     virtual CbcRangeCompare compareBranchingObject
    00258     (const CbcBranchingObject* brObj, const bool replaceIfOverlap = false);
    00259
    00261     void computeNonzeroRange();
    00262
    00263 private:
    00265     const CbcSOS * set_;
    00267     double separator_;
    00273     int firstNonzero_;
    00274     int lastNonzero_;
    00275 };
    00276 #endif
    00277

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines