CbcHeuristicDive.hpp
Go to the documentation of this file.00001
00002
00003
00004
00005
00006 #ifndef CbcHeuristicDive_H
00007 #define CbcHeuristicDive_H
00008
00009 #include "CbcHeuristic.hpp"
00010 class CbcSubProblem;
00011 class OsiRowCut;
00012 struct PseudoReducedCost {
00013 int var;
00014 double pseudoRedCost;
00015 };
00016
00017
00021 class CbcHeuristicDive : public CbcHeuristic {
00022 public:
00023
00024
00025 CbcHeuristicDive ();
00026
00027
00028 CbcHeuristicDive (CbcModel & model);
00029
00030
00031 CbcHeuristicDive ( const CbcHeuristicDive &);
00032
00033
00034 ~CbcHeuristicDive ();
00035
00037 virtual CbcHeuristicDive * clone() const = 0;
00038
00040 CbcHeuristicDive & operator=(const CbcHeuristicDive& rhs);
00041
00043 virtual void generateCpp( FILE * ) {}
00044
00046 void generateCpp( FILE * fp, const char * heuristic);
00047
00049 virtual void resetModel(CbcModel * model);
00050
00052 virtual void setModel(CbcModel * model);
00053
00054
00061 virtual int solution(double & objectiveValue,
00062 double * newSolution);
00064 int solution(double & objectiveValue, int & numberNodes,
00065 int & numberCuts, OsiRowCut ** cuts,
00066 CbcSubProblem ** & nodes,
00067 double * newSolution);
00073 int fathom(CbcModel * model, int & numberNodes,CbcSubProblem ** & nodes);
00074
00076 virtual void validate();
00077
00079 void setPriorities();
00080
00082 void selectBinaryVariables();
00083
00085 void setPercentageToFix(double value) {
00086 percentageToFix_ = value;
00087 }
00088
00090 void setMaxIterations(int value) {
00091 maxIterations_ = value;
00092 }
00093
00095 void setMaxSimplexIterations(int value) {
00096 maxSimplexIterations_ = value;
00097 }
00099 inline int maxSimplexIterations() const {
00100 return maxSimplexIterations_;
00101 }
00102
00104 void setMaxSimplexIterationsAtRoot(int value) {
00105 maxSimplexIterationsAtRoot_ = value;
00106 }
00107
00109 void setMaxTime(double value) {
00110 maxTime_ = value;
00111 }
00112
00114 virtual bool canHeuristicRun();
00115
00122 virtual bool selectVariableToBranch(OsiSolverInterface* solver,
00123 const double* newSolution,
00124 int& bestColumn,
00125 int& bestRound) = 0;
00128 virtual void initializeData() {}
00129
00131 int reducedCostFix (OsiSolverInterface* solver);
00133 virtual int fixOtherVariables(OsiSolverInterface * solver,
00134 const double * solution,
00135 PseudoReducedCost * candidate,
00136 const double * random);
00137
00138 protected:
00139
00140
00141
00142 CoinPackedMatrix matrix_;
00143
00144
00145 CoinPackedMatrix matrixByRow_;
00146
00147
00148 unsigned short * downLocks_;
00149
00150
00151 unsigned short * upLocks_;
00152
00154 double * downArray_;
00155
00157 double * upArray_;
00158
00160 typedef struct {
00161 unsigned int direction:3;
00162 unsigned int priority:29;
00163 } PriorityType;
00164 PriorityType * priority_;
00165
00166
00167 std::vector<int> binVarIndex_;
00168
00169
00170 std::vector<int> vbRowIndex_;
00171
00172
00173 double percentageToFix_;
00174
00175
00176 double maxTime_;
00177
00178
00179 double smallObjective_;
00180
00181
00182 int maxIterations_;
00183
00184
00185 int maxSimplexIterations_;
00186
00187
00188 int maxSimplexIterationsAtRoot_;
00189
00190 };
00191 #endif
00192