[1573] | 1 | // $Id: CbcHeuristicDINS.hpp 1899 2013-04-09 18:12:08Z 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 | |
---|
[1368] | 8 | #ifndef CbcHeuristicDINS_H |
---|
| 9 | #define CbcHeuristicDINS_H |
---|
| 10 | |
---|
| 11 | #include "CbcHeuristic.hpp" |
---|
| 12 | |
---|
| 13 | |
---|
| 14 | class CbcHeuristicDINS : public CbcHeuristic { |
---|
| 15 | public: |
---|
| 16 | |
---|
| 17 | // Default Constructor |
---|
| 18 | CbcHeuristicDINS (); |
---|
| 19 | |
---|
| 20 | /* Constructor with model - assumed before cuts |
---|
| 21 | Initial version does not do Lps |
---|
| 22 | */ |
---|
| 23 | CbcHeuristicDINS (CbcModel & model); |
---|
| 24 | |
---|
| 25 | // Copy constructor |
---|
| 26 | CbcHeuristicDINS ( const CbcHeuristicDINS &); |
---|
| 27 | |
---|
| 28 | // Destructor |
---|
| 29 | ~CbcHeuristicDINS (); |
---|
| 30 | |
---|
| 31 | /// Clone |
---|
| 32 | virtual CbcHeuristic * clone() const; |
---|
| 33 | |
---|
| 34 | |
---|
| 35 | /// Assignment operator |
---|
| 36 | CbcHeuristicDINS & operator=(const CbcHeuristicDINS& rhs); |
---|
| 37 | |
---|
| 38 | /// Create C++ lines to get to current state |
---|
| 39 | virtual void generateCpp( FILE * fp) ; |
---|
| 40 | |
---|
| 41 | /// Resets stuff if model changes |
---|
| 42 | virtual void resetModel(CbcModel * model); |
---|
| 43 | |
---|
| 44 | /// update model (This is needed if cliques update matrix etc) |
---|
| 45 | virtual void setModel(CbcModel * model); |
---|
| 46 | |
---|
| 47 | using CbcHeuristic::solution ; |
---|
| 48 | /** returns 0 if no solution, 1 if valid solution. |
---|
| 49 | Sets solution values if good, sets objective value (only if good) |
---|
| 50 | This does Relaxation Induced Neighborhood Search |
---|
| 51 | */ |
---|
| 52 | virtual int solution(double & objectiveValue, |
---|
| 53 | double * newSolution); |
---|
| 54 | /// This version fixes stuff and does IP |
---|
| 55 | int solutionFix(double & objectiveValue, |
---|
| 56 | double * newSolution, |
---|
| 57 | const int * keep); |
---|
| 58 | |
---|
| 59 | /// Sets how often to do it |
---|
| 60 | inline void setHowOften(int value) { |
---|
| 61 | howOften_ = value; |
---|
| 62 | } |
---|
| 63 | /// Sets maximum number of solutions kept |
---|
| 64 | inline void setMaximumKeep(int value) { |
---|
| 65 | maximumKeepSolutions_ = value; |
---|
| 66 | } |
---|
| 67 | /// Sets tightness of extra constraint |
---|
| 68 | inline void setConstraint(int value) { |
---|
| 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 | |
---|
[1432] | 95 | #endif |
---|
| 96 | |
---|