1 | // $Id: CbcHeuristicVND.hpp 1902 2013-04-10 16:58:16Z stefan $ |
---|
2 | // Copyright (C) 2006, International Business Machines |
---|
3 | // Corporation and others. All Rights Reserved. |
---|
4 | // This code is licensed under the terms of the Eclipse Public License (EPL). |
---|
5 | |
---|
6 | // edwin 12/5/09 carved out of CbcHeuristicRINS |
---|
7 | |
---|
8 | #ifndef CbcHeuristicVND_H |
---|
9 | #define CbcHeuristicVND_H |
---|
10 | |
---|
11 | #include "CbcHeuristic.hpp" |
---|
12 | |
---|
13 | |
---|
14 | /** LocalSearch class |
---|
15 | */ |
---|
16 | |
---|
17 | class CbcHeuristicVND : public CbcHeuristic { |
---|
18 | public: |
---|
19 | |
---|
20 | // Default Constructor |
---|
21 | CbcHeuristicVND (); |
---|
22 | |
---|
23 | /* Constructor with model - assumed before cuts |
---|
24 | Initial version does not do Lps |
---|
25 | */ |
---|
26 | CbcHeuristicVND (CbcModel & model); |
---|
27 | |
---|
28 | // Copy constructor |
---|
29 | CbcHeuristicVND ( const CbcHeuristicVND &); |
---|
30 | |
---|
31 | // Destructor |
---|
32 | ~CbcHeuristicVND (); |
---|
33 | |
---|
34 | /// Clone |
---|
35 | virtual CbcHeuristic * clone() const; |
---|
36 | |
---|
37 | |
---|
38 | /// Assignment operator |
---|
39 | CbcHeuristicVND & operator=(const CbcHeuristicVND& rhs); |
---|
40 | |
---|
41 | /// Create C++ lines to get to current state |
---|
42 | virtual void generateCpp( FILE * fp) ; |
---|
43 | |
---|
44 | /// Resets stuff if model changes |
---|
45 | virtual void resetModel(CbcModel * model); |
---|
46 | |
---|
47 | /// update model (This is needed if cliques update matrix etc) |
---|
48 | virtual void setModel(CbcModel * model); |
---|
49 | |
---|
50 | using CbcHeuristic::solution ; |
---|
51 | /** returns 0 if no solution, 1 if valid solution. |
---|
52 | Sets solution values if good, sets objective value (only if good) |
---|
53 | This does Relaxation Induced Neighborhood Search |
---|
54 | */ |
---|
55 | virtual int solution(double & objectiveValue, |
---|
56 | double * newSolution); |
---|
57 | /// This version fixes stuff and does IP |
---|
58 | int solutionFix(double & objectiveValue, |
---|
59 | double * newSolution, |
---|
60 | const int * keep); |
---|
61 | |
---|
62 | /// Sets how often to do it |
---|
63 | inline void setHowOften(int value) { |
---|
64 | howOften_ = value; |
---|
65 | } |
---|
66 | /// base solution array so we can set |
---|
67 | inline double * baseSolution() const { |
---|
68 | return baseSolution_; |
---|
69 | } |
---|
70 | |
---|
71 | protected: |
---|
72 | // Data |
---|
73 | |
---|
74 | /// Number of solutions so we can do something at solution |
---|
75 | int numberSolutions_; |
---|
76 | /// How often to do (code can change) |
---|
77 | int howOften_; |
---|
78 | /// Number of successes |
---|
79 | int numberSuccesses_; |
---|
80 | /// Number of tries |
---|
81 | int numberTries_; |
---|
82 | /// Node when last done |
---|
83 | int lastNode_; |
---|
84 | /// Step size for decomposition |
---|
85 | int stepSize_; |
---|
86 | int k_; |
---|
87 | int kmax_; |
---|
88 | int nDifferent_; |
---|
89 | /// Base solution |
---|
90 | double * baseSolution_; |
---|
91 | }; |
---|
92 | |
---|
93 | #endif |
---|
94 | |
---|