1 | /* $Id: CbcBranchFollow2.hpp 1173 2009-06-04 09:44:10Z forrest $ */ |
---|
2 | // Copyright (C) 2004, International Business Machines |
---|
3 | // Corporation and others. All Rights Reserved. |
---|
4 | #ifndef CbcBranchFollowOn2_H |
---|
5 | #define CbcBranchFollowOn2_H |
---|
6 | |
---|
7 | #include "CbcBranchActual.hpp" |
---|
8 | #include "CoinPackedMatrix.hpp" |
---|
9 | |
---|
10 | |
---|
11 | /** Define a follow on class. |
---|
12 | The idea of this is that in air-crew scheduling problems crew may fly in on flight A |
---|
13 | and out on flight B or on some other flight. A useful branch is one which on one side |
---|
14 | fixes all which go out on flight B to 0, while the other branch fixes all those that do NOT |
---|
15 | go out on flight B to 0. |
---|
16 | |
---|
17 | This tries to generalize so that cuts are produced with sum aij xj <= bi on each side. |
---|
18 | It should be intelligent enough to fix if things can be fixed. |
---|
19 | We also need to make sure branch cuts work properly (i.e. persistence). |
---|
20 | |
---|
21 | This branching rule should be in addition to normal rules and have a high priority. |
---|
22 | */ |
---|
23 | |
---|
24 | class CbcFollowOn2 : public CbcObject { |
---|
25 | |
---|
26 | public: |
---|
27 | |
---|
28 | // Default Constructor |
---|
29 | CbcFollowOn2 (); |
---|
30 | |
---|
31 | /** Useful constructor |
---|
32 | */ |
---|
33 | CbcFollowOn2 (CbcModel * model); |
---|
34 | |
---|
35 | // Copy constructor |
---|
36 | CbcFollowOn2 ( const CbcFollowOn2 &); |
---|
37 | |
---|
38 | /// Clone |
---|
39 | virtual CbcObject * clone() const; |
---|
40 | |
---|
41 | // Assignment operator |
---|
42 | CbcFollowOn2 & operator=( const CbcFollowOn2& rhs); |
---|
43 | |
---|
44 | // Destructor |
---|
45 | ~CbcFollowOn2 (); |
---|
46 | |
---|
47 | /// Infeasibility - large is 0.5 |
---|
48 | virtual double infeasibility(int & preferredWay) const; |
---|
49 | |
---|
50 | /// This looks at solution and sets bounds to contain solution |
---|
51 | virtual void feasibleRegion(); |
---|
52 | /// Creates a branching object |
---|
53 | virtual CbcBranchingObject * createBranch(int way) ; |
---|
54 | /** As some computation is needed in more than one place - returns row. |
---|
55 | Also returns other row and effective rhs (so we can know if cut) |
---|
56 | */ |
---|
57 | virtual int gutsOfFollowOn2(int & otherRow, int & preferredWay, |
---|
58 | int & effectiveRhs) const; |
---|
59 | |
---|
60 | /// get and set for maximum rhws (affects cuts as branch) |
---|
61 | inline int maximumRhs() const |
---|
62 | { return maximumRhs_;} |
---|
63 | inline void setMaximumRhs(int value) |
---|
64 | { maximumRhs_=value;} |
---|
65 | protected: |
---|
66 | /// data |
---|
67 | /// Matrix |
---|
68 | CoinPackedMatrix matrix_; |
---|
69 | /// Matrix by row |
---|
70 | CoinPackedMatrix matrixByRow_; |
---|
71 | /// Possible rhs (if 0 then not possible) |
---|
72 | int * rhs_; |
---|
73 | /// If >1 then allow cuts if effective rhs <= this |
---|
74 | int maximumRhs_; |
---|
75 | }; |
---|
76 | |
---|
77 | #endif |
---|