Cgl trunk
CglTreeInfo.hpp
Go to the documentation of this file.
00001 // $Id$
00002 // Copyright (C) 2000, 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 #ifndef CglTreeInfo_H
00007 #define CglTreeInfo_H
00008 
00009 #include "OsiCuts.hpp"
00010 #include "OsiSolverInterface.hpp"
00011 #include "CoinHelperFunctions.hpp"
00012 class CglStored;
00015 class CglTreeInfo {
00016 public:
00018   int level;
00021   int pass;
00024   int formulation_rows;
00035   int options;
00037   bool inTree;
00047   OsiRowCut ** strengthenRow;
00049   CoinThreadRandom * randomNumberGenerator;
00051   CglTreeInfo ();
00052  
00054   CglTreeInfo (
00055     const CglTreeInfo &);
00057   virtual CglTreeInfo * clone() const;
00058 
00060   CglTreeInfo &
00061     operator=(
00062     const CglTreeInfo& rhs);
00063   
00065   virtual
00066     ~CglTreeInfo ();
00068   virtual bool fixes(int , int , int ,bool) {return false;}
00071   virtual int initializeFixing(const OsiSolverInterface * ) {return 0;}
00072   
00073 };
00074 
00076 typedef struct {
00077   //unsigned int oneFixed:1; //  nonzero if variable to 1 fixes all
00078   //unsigned int sequence:31; //  variable (in matrix) (but also see cliqueRow_)
00079   unsigned int fixes;
00080 } cliqueEntry;
00081 
00082 class CglTreeProbingInfo : public CglTreeInfo {
00083 public:
00085   CglTreeProbingInfo ();
00087   CglTreeProbingInfo (const OsiSolverInterface * model);
00088  
00090   CglTreeProbingInfo (
00091     const CglTreeProbingInfo &);
00093   virtual CglTreeInfo * clone() const;
00094 
00096   CglTreeProbingInfo &
00097     operator=(
00098     const CglTreeProbingInfo& rhs);
00099   
00101   virtual
00102     ~CglTreeProbingInfo ();
00103   OsiSolverInterface * analyze(const OsiSolverInterface & si, int createSolver=0);
00107   virtual bool fixes(int variable, int toValue, int fixedVariable,bool fixedToLower);
00110   virtual int initializeFixing(const OsiSolverInterface * model) ;
00112   int fixColumns(OsiSolverInterface & si) const;
00114   int fixColumns(int iColumn, int value, OsiSolverInterface & si) const;
00116   int packDown();
00118   void generateCuts(const OsiSolverInterface & si, OsiCuts & cs,
00119                     const CglTreeInfo info) const;
00121   inline cliqueEntry * fixEntries() const
00122   { convert(); return fixEntry_;}
00124   inline int * toZero() const
00125   { convert(); return toZero_;}
00127   inline int * toOne() const
00128   { convert(); return toOne_;}
00130   inline int * integerVariable() const
00131   { return integerVariable_;}
00133   inline int * backward() const
00134   { return backward_;}
00136   inline int numberVariables() const
00137   { return numberVariables_;}
00139   inline int numberIntegers() const
00140   { return numberIntegers_;}
00141 private:
00143   void convert() const;
00144 protected:
00146   mutable cliqueEntry * fixEntry_;
00148   mutable int * toZero_;
00150   mutable int * toOne_;
00152   int * integerVariable_;
00154   int * backward_;
00156   mutable int * fixingEntry_;
00158   int numberVariables_;
00160   int numberIntegers_;
00162   int maximumEntries_;
00164   mutable int numberEntries_;
00165 };
00166 inline int sequenceInCliqueEntry(const cliqueEntry & cEntry)
00167 { return cEntry.fixes&0x7fffffff;}
00168 inline void setSequenceInCliqueEntry(cliqueEntry & cEntry,int sequence)
00169 { cEntry.fixes = sequence|(cEntry.fixes&0x80000000);}
00170 inline bool oneFixesInCliqueEntry(const cliqueEntry & cEntry)
00171 { return (cEntry.fixes&0x80000000)!=0;}
00172 inline void setOneFixesInCliqueEntry(cliqueEntry & cEntry,bool oneFixes)
00173 { cEntry.fixes = (oneFixes ? 0x80000000 : 0)|(cEntry.fixes&0x7fffffff);}
00174 
00175 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines