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 selectBinaryVariables();
00080
00082 void setPercentageToFix(double value) {
00083 percentageToFix_ = value;
00084 }
00085
00087 void setMaxIterations(int value) {
00088 maxIterations_ = value;
00089 }
00090
00092 void setMaxSimplexIterations(int value) {
00093 maxSimplexIterations_ = value;
00094 }
00096 inline int maxSimplexIterations() const {
00097 return maxSimplexIterations_;
00098 }
00099
00101 void setMaxSimplexIterationsAtRoot(int value) {
00102 maxSimplexIterationsAtRoot_ = value;
00103 }
00104
00106 void setMaxTime(double value) {
00107 maxTime_ = value;
00108 }
00109
00111 virtual bool canHeuristicRun();
00112
00119 virtual bool selectVariableToBranch(OsiSolverInterface* solver,
00120 const double* newSolution,
00121 int& bestColumn,
00122 int& bestRound) = 0;
00125 virtual void initializeData() {}
00126
00128 int reducedCostFix (OsiSolverInterface* solver);
00130 virtual int fixOtherVariables(OsiSolverInterface * solver,
00131 const double * solution,
00132 PseudoReducedCost * candidate,
00133 const double * random);
00134
00135 protected:
00136
00137
00138
00139 CoinPackedMatrix matrix_;
00140
00141
00142 CoinPackedMatrix matrixByRow_;
00143
00144
00145 unsigned short * downLocks_;
00146
00147
00148 unsigned short * upLocks_;
00149
00151 double * downArray_;
00152
00154 double * upArray_;
00155
00156
00157
00158 std::vector<int> binVarIndex_;
00159
00160
00161 std::vector<int> vbRowIndex_;
00162
00163
00164 double percentageToFix_;
00165
00166
00167 int maxIterations_;
00168
00169
00170 int maxSimplexIterations_;
00171
00172
00173 int maxSimplexIterationsAtRoot_;
00174
00175
00176 double maxTime_;
00177
00178 };
00179 #endif
00180