1 | // edwin 12/5/09 carved out of CbcHeuristicRINS |
---|
2 | #ifndef CbcHeuristicDINS_H |
---|
3 | #define CbcHeuristicDINS_H |
---|
4 | |
---|
5 | #include "CbcHeuristic.hpp" |
---|
6 | |
---|
7 | |
---|
8 | class CbcHeuristicDINS : public CbcHeuristic { |
---|
9 | public: |
---|
10 | |
---|
11 | // Default Constructor |
---|
12 | CbcHeuristicDINS (); |
---|
13 | |
---|
14 | /* Constructor with model - assumed before cuts |
---|
15 | Initial version does not do Lps |
---|
16 | */ |
---|
17 | CbcHeuristicDINS (CbcModel & model); |
---|
18 | |
---|
19 | // Copy constructor |
---|
20 | CbcHeuristicDINS ( const CbcHeuristicDINS &); |
---|
21 | |
---|
22 | // Destructor |
---|
23 | ~CbcHeuristicDINS (); |
---|
24 | |
---|
25 | /// Clone |
---|
26 | virtual CbcHeuristic * clone() const; |
---|
27 | |
---|
28 | |
---|
29 | /// Assignment operator |
---|
30 | CbcHeuristicDINS & operator=(const CbcHeuristicDINS& 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 | Sets solution values if good, sets objective value (only if good) |
---|
44 | This does Relaxation Induced Neighborhood Search |
---|
45 | */ |
---|
46 | virtual int solution(double & objectiveValue, |
---|
47 | double * newSolution); |
---|
48 | /// This version fixes stuff and does IP |
---|
49 | int solutionFix(double & objectiveValue, |
---|
50 | double * newSolution, |
---|
51 | const int * keep); |
---|
52 | |
---|
53 | /// Sets how often to do it |
---|
54 | inline void setHowOften(int value) { |
---|
55 | howOften_ = value; |
---|
56 | } |
---|
57 | /// Sets maximum number of solutions kept |
---|
58 | inline void setMaximumKeep(int value) { |
---|
59 | maximumKeepSolutions_ = value; |
---|
60 | } |
---|
61 | /// Sets tightness of extra constraint |
---|
62 | inline void setConstraint(int value) { |
---|
63 | localSpace_ = value; |
---|
64 | } |
---|
65 | |
---|
66 | protected: |
---|
67 | // Data |
---|
68 | |
---|
69 | /// Number of solutions so we can do something at solution |
---|
70 | int numberSolutions_; |
---|
71 | /// How often to do (code can change) |
---|
72 | int howOften_; |
---|
73 | /// Number of successes |
---|
74 | int numberSuccesses_; |
---|
75 | /// Number of tries |
---|
76 | int numberTries_; |
---|
77 | /// Maximum number of solutions to keep |
---|
78 | int maximumKeepSolutions_; |
---|
79 | /// Number of solutions kept |
---|
80 | int numberKeptSolutions_; |
---|
81 | /// Number of integer variables |
---|
82 | int numberIntegers_; |
---|
83 | /// Local parameter |
---|
84 | int localSpace_; |
---|
85 | /// Values of integer variables |
---|
86 | int ** values_; |
---|
87 | }; |
---|
88 | |
---|
89 | #endif |
---|
90 | |
---|