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