1 | // edwin 12/5/09 carved out of CbcHeuristicRINS |
---|

2 | #ifndef CbcHeuristicVND_H |
---|

3 | #define CbcHeuristicVND_H |
---|

4 | |
---|

5 | #include "CbcHeuristic.hpp" |
---|

6 | |
---|

7 | |
---|

8 | /** LocalSearch class |
---|

9 | */ |
---|

10 | |
---|

11 | class CbcHeuristicVND : public CbcHeuristic { |
---|

12 | public: |
---|

13 | |
---|

14 | // Default Constructor |
---|

15 | CbcHeuristicVND (); |
---|

16 | |
---|

17 | /* Constructor with model - assumed before cuts |
---|

18 | Initial version does not do Lps |
---|

19 | */ |
---|

20 | CbcHeuristicVND (CbcModel & model); |
---|

21 | |
---|

22 | // Copy constructor |
---|

23 | CbcHeuristicVND ( const CbcHeuristicVND &); |
---|

24 | |
---|

25 | // Destructor |
---|

26 | ~CbcHeuristicVND (); |
---|

27 | |
---|

28 | /// Clone |
---|

29 | virtual CbcHeuristic * clone() const; |
---|

30 | |
---|

31 | |
---|

32 | /// Assignment operator |
---|

33 | CbcHeuristicVND & operator=(const CbcHeuristicVND& 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 | howOften_ = value; |
---|

59 | } |
---|

60 | /// base solution array so we can set |
---|

61 | inline double * baseSolution() const { |
---|

62 | return baseSolution_; |
---|

63 | } |
---|

64 | |
---|

65 | protected: |
---|

66 | // Data |
---|

67 | |
---|

68 | /// Number of solutions so we can do something at solution |
---|

69 | int numberSolutions_; |
---|

70 | /// How often to do (code can change) |
---|

71 | int howOften_; |
---|

72 | /// Number of successes |
---|

73 | int numberSuccesses_; |
---|

74 | /// Number of tries |
---|

75 | int numberTries_; |
---|

76 | /// Node when last done |
---|

77 | int lastNode_; |
---|

78 | /// Step size for decomposition |
---|

79 | int stepSize_; |
---|

80 | int k_; |
---|

81 | int kmax_; |
---|

82 | int nDifferent_; |
---|

83 | /// Base solution |
---|

84 | double * baseSolution_; |
---|

85 | }; |
---|

86 | |
---|

87 | #endif |
---|

88 | |
---|