CbcHeuristicDive.hpp
Go to the documentation of this file.
1 /* $Id: CbcHeuristicDive.hpp 1252 2009-10-20 09:22:24Z stefan $ */
2 // Copyright (C) 2008, International Business Machines
3 // Corporation and others. All Rights Reserved.
4 #ifndef CbcHeuristicDive_H
5 #define CbcHeuristicDive_H
6 
7 #include "CbcHeuristic.hpp"
9  int var;
10  double pseudoRedCost;
11 };
12 
13 
18 public:
19 
20  // Default Constructor
22 
23  // Constructor with model - assumed before cuts
24  CbcHeuristicDive (CbcModel & model);
25 
26  // Copy constructor
28 
29  // Destructor
31 
33  virtual CbcHeuristicDive * clone() const = 0;
34 
37 
39  virtual void generateCpp( FILE * ) {}
40 
42  void generateCpp( FILE * fp, const char * heuristic);
43 
45  virtual void resetModel(CbcModel * model);
46 
48  virtual void setModel(CbcModel * model);
49 
50  // REMLOVE using CbcHeuristic::solution ;
57  virtual int solution(double & objectiveValue,
58  double * newSolution);
59 
61  virtual void validate();
62 
64  void selectBinaryVariables();
65 
67  void setPercentageToFix(double value) {
68  percentageToFix_ = value;
69  }
70 
72  void setMaxIterations(int value) {
73  maxIterations_ = value;
74  }
75 
77  void setMaxSimplexIterations(int value) {
78  maxSimplexIterations_ = value;
79  }
80 
84  }
85 
87  void setMaxTime(double value) {
88  maxTime_ = value;
89  }
90 
92  virtual bool canHeuristicRun();
93 
100  virtual bool selectVariableToBranch(OsiSolverInterface* solver,
101  const double* newSolution,
102  int& bestColumn,
103  int& bestRound) = 0;
106  virtual void initializeData() {}
107 
109  int reducedCostFix (OsiSolverInterface* solver);
111  virtual int fixOtherVariables(OsiSolverInterface * solver,
112  const double * solution,
113  PseudoReducedCost * candidate,
114  const double * random);
115 
116 protected:
117  // Data
118 
119  // Original matrix by column
120  CoinPackedMatrix matrix_;
121 
122  // Original matrix by
123  CoinPackedMatrix matrixByRow_;
124 
125  // Down locks
126  unsigned short * downLocks_;
127 
128  // Up locks
129  unsigned short * upLocks_;
130 
132  double * downArray_;
133 
135  double * upArray_;
136 
137  // Indexes of binary variables with 0 objective coefficient
138  // and in variable bound constraints
139  std::vector<int> binVarIndex_;
140 
141  // Indexes of variable bound rows for each binary variable
142  std::vector<int> vbRowIndex_;
143 
144  // Percentage of integer variables to fix at bounds
146 
147  // Maximum number of major iterations
149 
150  // Maximum number of simplex iterations
152 
153  // Maximum number of simplex iterations at root node
155 
156  // Maximum time allowed
157  double maxTime_;
158 
159 };
160 #endif
161