1 | // Copyright (C) 2004, International Business Machines |
---|
2 | // Corporation and others. All Rights Reserved. |
---|
3 | #ifndef CbcFathom_H |
---|
4 | #define CbcFathom_H |
---|
5 | #include "CbcConfig.h" |
---|
6 | |
---|
7 | class CbcModel; |
---|
8 | |
---|
9 | //############################################################################# |
---|
10 | /** Fathom base class. |
---|
11 | |
---|
12 | The idea is that after some branching the problem will be effectively smaller than |
---|
13 | the original problem and maybe there will be a more specialized technique which can completely |
---|
14 | fathom this branch quickly. |
---|
15 | |
---|
16 | One method is to presolve the problem to give a much smaller new problem and then do branch |
---|
17 | and cut on that. Another might be dynamic programming. |
---|
18 | |
---|
19 | */ |
---|
20 | |
---|
21 | class CbcFathom { |
---|
22 | public: |
---|
23 | // Default Constructor |
---|
24 | CbcFathom (); |
---|
25 | |
---|
26 | // Constructor with model - assumed before cuts |
---|
27 | CbcFathom (CbcModel & model); |
---|
28 | |
---|
29 | virtual ~CbcFathom(); |
---|
30 | |
---|
31 | /// update model (This is needed if cliques update matrix etc) |
---|
32 | virtual void setModel(CbcModel * model); |
---|
33 | |
---|
34 | /// Clone |
---|
35 | virtual CbcFathom * clone() const=0; |
---|
36 | |
---|
37 | /// Resets stuff if model changes |
---|
38 | virtual void resetModel(CbcModel * model)=0; |
---|
39 | |
---|
40 | /** returns 0 if no fathoming attempted, 1 fully fathomed, |
---|
41 | 2 incomplete search, 3 incomplete search but treat as complete. |
---|
42 | If solution then newSolution will not be NULL and |
---|
43 | will be freed by CbcModel. It is expected that the solution is better |
---|
44 | than best so far but CbcModel will double check. |
---|
45 | |
---|
46 | If returns 3 then of course there is no guarantee of global optimum |
---|
47 | */ |
---|
48 | virtual int fathom(double *& newSolution)=0; |
---|
49 | |
---|
50 | // Is this method possible |
---|
51 | inline bool possible() const |
---|
52 | { return possible_;}; |
---|
53 | |
---|
54 | protected: |
---|
55 | |
---|
56 | /// Model |
---|
57 | CbcModel * model_; |
---|
58 | /// Possible - if this method of fathoming can be used |
---|
59 | bool possible_; |
---|
60 | private: |
---|
61 | |
---|
62 | /// Illegal Assignment operator |
---|
63 | CbcFathom & operator=(const CbcFathom& rhs); |
---|
64 | |
---|
65 | }; |
---|
66 | #ifdef COIN_HAS_CLP |
---|
67 | #include "OsiClpSolverInterface.hpp" |
---|
68 | |
---|
69 | //############################################################################# |
---|
70 | |
---|
71 | /** |
---|
72 | |
---|
73 | This is for codes where solver needs to know about CbcModel |
---|
74 | */ |
---|
75 | |
---|
76 | class CbcOsiSolver : public OsiClpSolverInterface { |
---|
77 | |
---|
78 | public: |
---|
79 | |
---|
80 | /**@name Constructors and destructors */ |
---|
81 | //@{ |
---|
82 | /// Default Constructor |
---|
83 | CbcOsiSolver (); |
---|
84 | |
---|
85 | /// Clone |
---|
86 | virtual OsiSolverInterface * clone(bool copyData=true) const; |
---|
87 | |
---|
88 | /// Copy constructor |
---|
89 | CbcOsiSolver (const CbcOsiSolver &); |
---|
90 | |
---|
91 | /// Assignment operator |
---|
92 | CbcOsiSolver & operator=(const CbcOsiSolver& rhs); |
---|
93 | |
---|
94 | /// Destructor |
---|
95 | virtual ~CbcOsiSolver (); |
---|
96 | |
---|
97 | //@} |
---|
98 | |
---|
99 | |
---|
100 | /**@name Sets and Gets */ |
---|
101 | //@{ |
---|
102 | /// Set Cbc Model |
---|
103 | inline void setCbcModel(CbcModel * model) |
---|
104 | { cbcModel_=model;}; |
---|
105 | /// Return Cbc Model |
---|
106 | inline CbcModel * cbcModel() const |
---|
107 | { return cbcModel_;}; |
---|
108 | //@} |
---|
109 | |
---|
110 | //--------------------------------------------------------------------------- |
---|
111 | |
---|
112 | protected: |
---|
113 | |
---|
114 | |
---|
115 | /**@name Private member data */ |
---|
116 | //@{ |
---|
117 | /// Pointer back to CbcModel |
---|
118 | CbcModel * cbcModel_; |
---|
119 | //@} |
---|
120 | }; |
---|
121 | #endif |
---|
122 | #endif |
---|