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 | /// Create C++ lines to get to current state |
---|
30 | virtual void generateCpp( FILE * fp) ; |
---|
31 | |
---|
32 | /// Resets stuff if model changes |
---|
33 | virtual void resetModel(CbcModel * model); |
---|
34 | |
---|
35 | /// update model (This is needed if cliques update matrix etc) |
---|
36 | virtual void setModel(CbcModel * model); |
---|
37 | |
---|
38 | /** returns 0 if no solution, 1 if valid solution |
---|
39 | with better objective value than one passed in |
---|
40 | Sets solution values if good, sets objective value (only if good) |
---|
41 | This is called after cuts have been added - so can not add cuts. |
---|
42 | |
---|
43 | It may make sense for user to call this outside Branch and Cut to |
---|
44 | get solution. Or normally is just at root node. |
---|
45 | */ |
---|
46 | virtual int solution(double & objectiveValue, |
---|
47 | double * newSolution); |
---|
48 | |
---|
49 | /// Set maximum passes (default 100) |
---|
50 | inline void setMaximumPasses(int value) |
---|
51 | { maximumPasses_=value;}; |
---|
52 | /// Get maximum passes (default 100) |
---|
53 | inline int maximumPasses() const |
---|
54 | { return maximumPasses_;}; |
---|
55 | /// Set maximum Time (default off) - also sets starttime to current |
---|
56 | void setMaximumTime(double value); |
---|
57 | /// Get maximum Time (default 0.0 == time limit off) |
---|
58 | inline double maximumTime() const |
---|
59 | { return maximumTime_;}; |
---|
60 | |
---|
61 | protected: |
---|
62 | // Data |
---|
63 | /// Start time |
---|
64 | double startTime_; |
---|
65 | /// Maximum Cpu seconds |
---|
66 | double maximumTime_; |
---|
67 | /// Maximum number of passes |
---|
68 | int maximumPasses_; |
---|
69 | /// If less than this round down |
---|
70 | double downValue_; |
---|
71 | /// If true round to expensive |
---|
72 | bool roundExpensive_; |
---|
73 | |
---|
74 | private: |
---|
75 | /// Illegal Assignment operator |
---|
76 | CbcHeuristicFPump & operator=(const CbcHeuristicFPump& rhs); |
---|
77 | /** Rounds solution - down if < downValue |
---|
78 | If roundExpensive then always to more expnsive. |
---|
79 | returns 0 if current is solution |
---|
80 | */ |
---|
81 | int rounds(double * solution, const double * objective, |
---|
82 | bool roundExpensive=false, |
---|
83 | double downValue=0.5, int *flip=0); |
---|
84 | }; |
---|
85 | |
---|
86 | |
---|
87 | #endif |
---|