1 | /* $Id: CouenneAggrProbing.hpp 946 2013-04-15 22:20:38Z stefan $ |
---|
2 | * |
---|
3 | * Name: CouenneAggrProbing.hpp |
---|
4 | * Author: Giacomo Nannicini |
---|
5 | * Purpose: A bound tightener based on aggressive probing |
---|
6 | * |
---|
7 | * (C) Giacomo Nannicini, 2010. |
---|
8 | * This file is licensed under the Eclipse Public License (EPL) |
---|
9 | */ |
---|
10 | |
---|
11 | #ifndef COUENNEAGGRPROBING_HPP |
---|
12 | #define COUENNEAGGRPROBING_HPP |
---|
13 | |
---|
14 | #include "BonRegisteredOptions.hpp" |
---|
15 | |
---|
16 | #include "BonOaDecBase.hpp" |
---|
17 | #include "CglConfig.h" |
---|
18 | #include "CglCutGenerator.hpp" |
---|
19 | #include "OsiColCut.hpp" |
---|
20 | #include "OsiSolverInterface.hpp" |
---|
21 | #include "CouenneProblem.hpp" |
---|
22 | #include "BonCouenneSetup.hpp" |
---|
23 | |
---|
24 | namespace Couenne { |
---|
25 | |
---|
26 | /// Cut Generator for aggressive BT; i.e., an aggressive probing. |
---|
27 | /// This probing strategy is very expensive and was initially |
---|
28 | /// developed to be run in parallel; hence, the user can choose to |
---|
29 | /// probe just a particular variable, without adding this cut |
---|
30 | /// generator to the list of cut generators normally employed by |
---|
31 | /// Couenne. However, it can also be used in the standard way; in |
---|
32 | /// that case, it chooses automatically the variables to probe (in a |
---|
33 | /// very naive way, for the moment). |
---|
34 | /// TODO: Implement some way to automatically choose the variables |
---|
35 | /// TODO: Implement the generateCuts method, for use in Branch-and-Bound |
---|
36 | |
---|
37 | class CouenneAggrProbing: public CglCutGenerator { |
---|
38 | |
---|
39 | public: |
---|
40 | |
---|
41 | /// Constructor |
---|
42 | CouenneAggrProbing(CouenneSetup* couenne, |
---|
43 | const Ipopt::SmartPtr<Ipopt::OptionsList> options); |
---|
44 | |
---|
45 | /// Copy constructor |
---|
46 | CouenneAggrProbing(const CouenneAggrProbing& rhs); |
---|
47 | |
---|
48 | /// Destructor |
---|
49 | ~CouenneAggrProbing(); |
---|
50 | |
---|
51 | /// Clone method (necessary for the abstract CglCutGenerator class) |
---|
52 | CouenneAggrProbing *clone () const |
---|
53 | {return new CouenneAggrProbing (*this);} |
---|
54 | |
---|
55 | /// The main CglCutGenerator; not implemented yet |
---|
56 | void generateCuts(const OsiSolverInterface & solver, |
---|
57 | OsiCuts& cuts, |
---|
58 | const CglTreeInfo = CglTreeInfo ()) |
---|
59 | #if CGL_VERSION_MAJOR == 0 && CGL_VERSION_MINOR <= 57 |
---|
60 | const |
---|
61 | #endif |
---|
62 | { } |
---|
63 | |
---|
64 | /// Probe one variable (try to tigthen the lower or the upper |
---|
65 | /// bound, depending on the value of the second argument), so that |
---|
66 | /// we can generate the corresponding column cut. This runs the |
---|
67 | /// main algorithm. It returns the new bound (equal to the initial |
---|
68 | /// one if we could not tigthen) |
---|
69 | double probeVariable(int index, bool probeLower); |
---|
70 | |
---|
71 | /// Alternative probing algorithm. This one does not work yet! |
---|
72 | /// Do not use, will probably segfault. |
---|
73 | double probeVariable2(int index, bool lower); |
---|
74 | |
---|
75 | /// Add list of options to be read from file |
---|
76 | static void registerOptions(Ipopt::SmartPtr <Bonmin::RegisteredOptions> roptions); |
---|
77 | |
---|
78 | /// Set/get maximum time to probe one variable |
---|
79 | void setMaxTime(double value); |
---|
80 | double getMaxTime() const; |
---|
81 | |
---|
82 | /// Set/get maximum number of failed steps |
---|
83 | void setMaxFailedSteps(int value); |
---|
84 | int getMaxFailedSteps() const; |
---|
85 | |
---|
86 | /// Set/get maximum number of nodes to probe one variable |
---|
87 | void setMaxNodes(int value); |
---|
88 | int getMaxNodes() const; |
---|
89 | |
---|
90 | /// Set/get restoreCutoff parameter (should we restore the initial |
---|
91 | /// cutoff value after each probing run?) |
---|
92 | void setRestoreCutoff(bool value); |
---|
93 | bool getRestoreCutoff() const; |
---|
94 | |
---|
95 | protected: |
---|
96 | |
---|
97 | /// Pointer to the CouenneProblem representation |
---|
98 | CouenneSetup* couenne_; |
---|
99 | |
---|
100 | /// Number of columns (want to have this handy) |
---|
101 | int numCols_; |
---|
102 | |
---|
103 | /// Maximum time to probe one variable |
---|
104 | double maxTime_; |
---|
105 | |
---|
106 | /// Maximum number of failed iterations |
---|
107 | int maxFailedSteps_; |
---|
108 | |
---|
109 | /// Maximum number of nodes in probing |
---|
110 | int maxNodes_; |
---|
111 | |
---|
112 | /// Restore initial cutoff (value and solution)? |
---|
113 | bool restoreCutoff_; |
---|
114 | |
---|
115 | /// Initial cutoff |
---|
116 | double initCutoff_; |
---|
117 | |
---|
118 | }; |
---|
119 | } |
---|
120 | |
---|
121 | #endif |
---|