1 | // Copyright (C) 2004, International Business Machines |
---|
2 | // Corporation and others. All Rights Reserved. |
---|
3 | #ifndef CbcHeuristicFeasibilityPump_H |
---|
4 | #define CbcHeuristicFeasibilityPump_H |
---|
5 | |
---|
6 | #include "CbcHeuristic.hpp" |
---|
7 | |
---|
8 | /** Rounding class |
---|
9 | */ |
---|
10 | |
---|
11 | class CbcHeuristicFPump : public CbcHeuristic { |
---|
12 | public: |
---|
13 | |
---|
14 | // Default Constructor |
---|
15 | CbcHeuristicFPump (); |
---|
16 | |
---|
17 | // Constructor with model - assumed before cuts |
---|
18 | CbcHeuristicFPump (CbcModel & model, |
---|
19 | double downValue=0.5,bool roundExpensive=false); |
---|
20 | |
---|
21 | // Copy constructor |
---|
22 | CbcHeuristicFPump ( const CbcHeuristicFPump &); |
---|
23 | |
---|
24 | // Destructor |
---|
25 | ~CbcHeuristicFPump (); |
---|
26 | |
---|
27 | /// Clone |
---|
28 | virtual CbcHeuristic * clone() const; |
---|
29 | |
---|
30 | /// Resets stuff if model changes |
---|
31 | virtual void resetModel(CbcModel * model); |
---|
32 | |
---|
33 | /// update model (This is needed if cliques update matrix etc) |
---|
34 | virtual void setModel(CbcModel * model); |
---|
35 | |
---|
36 | /** returns 1 if no solution, 0 if valid solution |
---|
37 | with better objective value than one passed in |
---|
38 | Sets solution values if good, sets objective value (only if good) |
---|
39 | This is called after cuts have been added - so can not add cuts. |
---|
40 | |
---|
41 | It may make sense for user to call this outside Branch and Cut to |
---|
42 | get solution. Or normally is just at root node. |
---|
43 | */ |
---|
44 | virtual int solution(double & objectiveValue, |
---|
45 | double * newSolution); |
---|
46 | |
---|
47 | /// Set maximum passes (default 100) |
---|
48 | inline void setMaximumPasses(int value) |
---|
49 | { maximumPasses_=value;}; |
---|
50 | /// Get maximum passes (default 100) |
---|
51 | inline int maximumPasses() const |
---|
52 | { return maximumPasses_;}; |
---|
53 | /// Set maximum Time (default off) - also sets starttime to current |
---|
54 | void setMaximumTime(double value); |
---|
55 | /// Get maximum Time (default 0.0 == time limit off) |
---|
56 | inline double maximumTime() const |
---|
57 | { return maximumTime_;}; |
---|
58 | |
---|
59 | protected: |
---|
60 | // Data |
---|
61 | /// Start time |
---|
62 | double startTime_; |
---|
63 | /// Maximum Cpu seconds |
---|
64 | double maximumTime_; |
---|
65 | /// Maximum number of passes |
---|
66 | int maximumPasses_; |
---|
67 | /// If less than this round down |
---|
68 | double downValue_; |
---|
69 | /// If true round to expensive |
---|
70 | bool roundExpensive_; |
---|
71 | |
---|
72 | private: |
---|
73 | /// Illegal Assignment operator |
---|
74 | CbcHeuristicFPump & operator=(const CbcHeuristicFPump& rhs); |
---|
75 | /** Rounds solution - down if < downValue |
---|
76 | If roundExpensive then always to more expnsive. |
---|
77 | returns 0 if current is solution |
---|
78 | */ |
---|
79 | int rounds(double * solution, const double * objective, |
---|
80 | bool roundExpensive=false, |
---|
81 | double downValue=0.5, int *flip=0); |
---|
82 | }; |
---|
83 | |
---|
84 | |
---|
85 | #endif |
---|