1 | // $Id: CbcHeuristicDINS.hpp 2465 2019-01-03 19:26:52Z unxusr $ |
---|
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 CbcHeuristicDINS_H |
---|
9 | #define CbcHeuristicDINS_H |
---|
10 | |
---|
11 | #include "CbcHeuristic.hpp" |
---|
12 | |
---|
13 | class CbcHeuristicDINS : public CbcHeuristic { |
---|
14 | public: |
---|
15 | // Default Constructor |
---|
16 | CbcHeuristicDINS(); |
---|
17 | |
---|
18 | /* Constructor with model - assumed before cuts |
---|
19 | Initial version does not do Lps |
---|
20 | */ |
---|
21 | CbcHeuristicDINS(CbcModel &model); |
---|
22 | |
---|
23 | // Copy constructor |
---|
24 | CbcHeuristicDINS(const CbcHeuristicDINS &); |
---|
25 | |
---|
26 | // Destructor |
---|
27 | ~CbcHeuristicDINS(); |
---|
28 | |
---|
29 | /// Clone |
---|
30 | virtual CbcHeuristic *clone() const; |
---|
31 | |
---|
32 | /// Assignment operator |
---|
33 | CbcHeuristicDINS &operator=(const CbcHeuristicDINS &rhs); |
---|
34 | |
---|
35 | /// Create C++ lines to get to current state |
---|
36 | virtual void generateCpp(FILE *fp); |
---|
37 | |
---|
38 | /// Resets stuff if model changes |
---|
39 | virtual void resetModel(CbcModel *model); |
---|
40 | |
---|
41 | /// update model (This is needed if cliques update matrix etc) |
---|
42 | virtual void setModel(CbcModel *model); |
---|
43 | |
---|
44 | using CbcHeuristic::solution; |
---|
45 | /** returns 0 if no solution, 1 if valid solution. |
---|
46 | Sets solution values if good, sets objective value (only if good) |
---|
47 | This does Relaxation Induced Neighborhood Search |
---|
48 | */ |
---|
49 | virtual int solution(double &objectiveValue, |
---|
50 | double *newSolution); |
---|
51 | /// This version fixes stuff and does IP |
---|
52 | int solutionFix(double &objectiveValue, |
---|
53 | double *newSolution, |
---|
54 | const int *keep); |
---|
55 | |
---|
56 | /// Sets how often to do it |
---|
57 | inline void setHowOften(int value) |
---|
58 | { |
---|
59 | howOften_ = value; |
---|
60 | } |
---|
61 | /// Sets maximum number of solutions kept |
---|
62 | inline void setMaximumKeep(int value) |
---|
63 | { |
---|
64 | maximumKeepSolutions_ = value; |
---|
65 | } |
---|
66 | /// Sets tightness of extra constraint |
---|
67 | inline void setConstraint(int value) |
---|
68 | { |
---|
69 | localSpace_ = value; |
---|
70 | } |
---|
71 | |
---|
72 | protected: |
---|
73 | // Data |
---|
74 | |
---|
75 | /// Number of solutions so we can do something at solution |
---|
76 | int numberSolutions_; |
---|
77 | /// How often to do (code can change) |
---|
78 | int howOften_; |
---|
79 | /// Number of successes |
---|
80 | int numberSuccesses_; |
---|
81 | /// Number of tries |
---|
82 | int numberTries_; |
---|
83 | /// Maximum number of solutions to keep |
---|
84 | int maximumKeepSolutions_; |
---|
85 | /// Number of solutions kept |
---|
86 | int numberKeptSolutions_; |
---|
87 | /// Number of integer variables |
---|
88 | int numberIntegers_; |
---|
89 | /// Local parameter |
---|
90 | int localSpace_; |
---|
91 | /// Values of integer variables |
---|
92 | int **values_; |
---|
93 | }; |
---|
94 | |
---|
95 | #endif |
---|
96 | |
---|
97 | /* vi: softtabstop=2 shiftwidth=2 expandtab tabstop=2 |
---|
98 | */ |
---|