1 | // Copyright (C) 2008, International Business Machines |
---|
2 | // Corporation and others. All Rights Reserved. |
---|
3 | #ifndef CbcHeuristicDiveCoefficient_H |
---|
4 | #define CbcHeuristicDiveCoefficient_H |
---|
5 | |
---|
6 | #include "CbcHeuristic.hpp" |
---|
7 | |
---|
8 | /** DiveCoefficient class |
---|
9 | */ |
---|
10 | |
---|
11 | class CbcHeuristicDiveCoefficient : public CbcHeuristic { |
---|
12 | public: |
---|
13 | |
---|
14 | // Default Constructor |
---|
15 | CbcHeuristicDiveCoefficient (); |
---|
16 | |
---|
17 | // Constructor with model - assumed before cuts |
---|
18 | CbcHeuristicDiveCoefficient (CbcModel & model); |
---|
19 | |
---|
20 | // Copy constructor |
---|
21 | CbcHeuristicDiveCoefficient ( const CbcHeuristicDiveCoefficient &); |
---|
22 | |
---|
23 | // Destructor |
---|
24 | ~CbcHeuristicDiveCoefficient (); |
---|
25 | |
---|
26 | /// Clone |
---|
27 | virtual CbcHeuristicDiveCoefficient * clone() const; |
---|
28 | |
---|
29 | /// Assignment operator |
---|
30 | CbcHeuristicDiveCoefficient & operator=(const CbcHeuristicDiveCoefficient& rhs); |
---|
31 | |
---|
32 | /// Create C++ lines to get to current state |
---|
33 | virtual void generateCpp( FILE * fp) ; |
---|
34 | |
---|
35 | /// Resets stuff if model changes |
---|
36 | virtual void resetModel(CbcModel * model); |
---|
37 | |
---|
38 | /// update model (This is needed if cliques update matrix etc) |
---|
39 | virtual void setModel(CbcModel * model); |
---|
40 | |
---|
41 | using CbcHeuristic::solution ; |
---|
42 | /** returns 0 if no solution, 1 if valid solution |
---|
43 | with better objective value than one passed in |
---|
44 | Sets solution values if good, sets objective value (only if good) |
---|
45 | This is called after cuts have been added - so can not add cuts |
---|
46 | This does Coefficient Diving |
---|
47 | */ |
---|
48 | virtual int solution(double & objectiveValue, |
---|
49 | double * newSolution); |
---|
50 | |
---|
51 | /// Validate model i.e. sets when_ to 0 if necessary (may be NULL) |
---|
52 | virtual void validate(); |
---|
53 | |
---|
54 | /// Set percentage of integer variables to fix at bounds |
---|
55 | void setPercentageToFix(double value) |
---|
56 | { percentageToFix_ = value; } |
---|
57 | |
---|
58 | /// Set maximum number of iterations |
---|
59 | void setMaxIterations(int value) |
---|
60 | { maxIterations_ = value; } |
---|
61 | |
---|
62 | /// Set maximum time allowed |
---|
63 | void setMaxTime(double value) |
---|
64 | { maxTime_ = value; } |
---|
65 | |
---|
66 | protected: |
---|
67 | // Data |
---|
68 | |
---|
69 | // Original matrix by column |
---|
70 | CoinPackedMatrix matrix_; |
---|
71 | |
---|
72 | // Down locks |
---|
73 | unsigned short * downLocks_; |
---|
74 | |
---|
75 | // Up locks |
---|
76 | unsigned short * upLocks_; |
---|
77 | |
---|
78 | // Percentage of integer variables to fix at bounds |
---|
79 | double percentageToFix_; |
---|
80 | |
---|
81 | // Maximum number of iterations |
---|
82 | int maxIterations_; |
---|
83 | |
---|
84 | // Maximum time allowed |
---|
85 | double maxTime_; |
---|
86 | |
---|
87 | }; |
---|
88 | |
---|
89 | #endif |
---|