CbcHeuristicDW.hpp
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007 #ifndef CbcHeuristicDW_H
00008 #define CbcHeuristicDW_H
00009
00010 #include "CbcHeuristic.hpp"
00011
00017 class CbcHeuristicDW : public CbcHeuristic {
00018 public:
00019
00020
00021 CbcHeuristicDW ();
00022
00023
00024
00025 CbcHeuristicDW (CbcModel & model, int keepContinuous=0);
00026
00027
00028
00029 CbcHeuristicDW (CbcModel & model,
00030 int callBack(CbcHeuristicDW * currentHeuristic,
00031 CbcModel * thisModel,
00032 int whereFrom),
00033 int keepContinuous=0);
00034
00035
00036 CbcHeuristicDW ( const CbcHeuristicDW &);
00037
00038
00039 ~CbcHeuristicDW ();
00040
00042 virtual CbcHeuristic * clone() const;
00043
00044
00046 CbcHeuristicDW & operator=(const CbcHeuristicDW& rhs);
00047
00049 virtual void generateCpp( FILE * fp) ;
00050
00052 virtual void resetModel(CbcModel * model);
00053
00055 virtual void setModel(CbcModel * model);
00056 using CbcHeuristic::solution ;
00061 virtual int solution(double & objectiveValue,
00062 double * newSolution);
00065 inline int numberBlocks() const
00066 { return numberBlocks_;}
00068 void passInSolution(const double * solution);
00070 void passInContinuousSolution(const double * solution);
00076 void setProposalActions(int fullDWEverySoOften);
00078 double objectiveValueWhen(int whichDW) const;
00080 int numberColumnsDW(int whichDW) const;
00082 inline OsiSolverInterface * solver() const
00083 { return solver_;}
00085 OsiSolverInterface * DWModel(int whichDW) const;
00087 inline double bestObjective() const
00088 { return bestObjective_;}
00090 inline const double * bestSolution() const
00091 { return bestSolution_;}
00093 inline const double * continuousSolution() const
00094 { return continuousSolution_;}
00096 inline const double * fixedDj() const
00097 { return fixedDj_;}
00099 inline const double * objectiveDW() const
00100 { return objectiveDW_;}
00102 inline int numberDWTimes() const
00103 { return numberDWTimes_;}
00105 inline const int * numberColumnsDW() const
00106 { return numberColumnsDW_;}
00108 inline void setNumberPasses(int value)
00109 { numberPasses_ = value;}
00111 inline void setNumberBadPasses(int value)
00112 { numberBadPasses_ = value;}
00114 inline void setNumberNeeded(int value)
00115 { nNeededBase_ = value;}
00117 inline int getNumberNeeded() const
00118 {return nNeededBase_;}
00120 inline void setCurrentNumberNeeded(int value)
00121 { nNeeded_ = value;}
00123 inline int getCurrentNumberNeeded() const
00124 {return nNeeded_;}
00126 inline void setNumberNodes(int value)
00127 { nNodesBase_ = value;}
00129 inline int getNumberNodes() const
00130 {return nNodesBase_;}
00132 inline void setCurrentNumberNodes(int value)
00133 { nNodes_ = value;}
00135 inline int getCurrentNumberNodes() const
00136 {return nNodes_;}
00138 inline void setTargetObjective(double value)
00139 { targetObjective_ = value;}
00141 inline void setHowOften(int value) {
00142 howOften_ = value;
00143 }
00145 inline const int * whichRowBlock() const
00146 { return whichRowBlock_;}
00148 inline const int * whichColumnBlock() const
00149 { return whichColumnBlock_;}
00151 inline double * initialLower() const
00152 { return saveLower_;}
00154 inline double * initialUpper() const
00155 { return saveUpper_;}
00157 inline int * intArrays() const
00158 { return intArray_;}
00160 inline double * doubleArrays() const
00161 { return doubleArray_;}
00163 inline int phase() const
00164 { return phase_;}
00166 inline int pass() const
00167 { return pass_;}
00169 inline const int * columnsInBlock() const
00170 { return columnsInBlock_;}
00172 inline const int * startColumnBlock() const
00173 { return startColumnBlock_;}
00175 inline const int * intsInBlock() const
00176 { return intsInBlock_;}
00178 double objectiveValue(const double * solution);
00179 private:
00181 void gutsOfCopy(const CbcHeuristicDW & rhs);
00183 void gutsOfDelete();
00185 void setDefaults();
00187 void findStructure();
00189 void setupDWStructures();
00191 int addDW(const double * solution,int numberBlocksUsed,
00192 const int * whichBlocks);
00193 protected:
00194 typedef int (*heuristicCallBack) (CbcHeuristicDW * ,CbcModel *, int) ;
00195
00197 double targetObjective_;
00199 double bestObjective_;
00201 double lastObjective_;
00216 heuristicCallBack functionPointer_;
00218 int * intArray_;
00220 double * doubleArray_;
00222 OsiSolverInterface * solver_;
00224 OsiSolverInterface * dwSolver_;
00226 double * bestSolution_;
00228 double * continuousSolution_;
00230 double * fixedDj_;
00232 double * saveLower_;
00234 double * saveUpper_;
00236 double * random_;
00238 double * weights_;
00240 double * objectiveDW_;
00242 int * numberColumnsDW_;
00244 int * whichRowBlock_;
00246 int * whichColumnBlock_;
00248 int * dwBlock_;
00250 int * backwardRow_;
00252 int * rowsInBlock_;
00254 int * columnsInBlock_;
00256 int * startRowBlock_;
00258 int * startColumnBlock_;
00260 int * intsInBlock_;
00262 unsigned int * fingerPrint_;
00264 unsigned short * affinity_;
00270 int fullDWEverySoOften_;
00272 int numberPasses_;
00274 int howOften_;
00276 int maximumDW_;
00278 int numberDW_;
00280 int numberDWTimes_;
00282 int sizeFingerPrint_;
00284 int numberMasterColumns_;
00286 int numberMasterRows_;
00288 int numberBlocks_;
00290 int keepContinuous_;
00292 int phase_;
00294 int pass_;
00296 int nNeededBase_;
00298 int nNodesBase_;
00300 int nNeeded_;
00302 int nNodes_;
00304 int numberBadPasses_;
00305
00306 int solveState_;
00307 };
00308
00309 #endif