1 | // $Id: CbcBranchAllDifferent.hpp 1902 2013-04-10 16:58:16Z stefan $ |
---|
2 | // Copyright (C) 2004, International Business Machines |
---|
3 | // Corporation and others. All Rights Reserved. |
---|
4 | // This code is licensed under the terms of the Eclipse Public License (EPL). |
---|
5 | |
---|
6 | // Edwin 11/13/2009-- carved out of CbcBranchCut |
---|
7 | |
---|
8 | #ifndef CbcBranchAllDifferent_H |
---|
9 | #define CbcBranchAllDifferent_H |
---|
10 | |
---|
11 | #include "CbcBranchBase.hpp" |
---|
12 | #include "OsiRowCut.hpp" |
---|
13 | #include "CoinPackedMatrix.hpp" |
---|
14 | #include "CbcBranchCut.hpp" |
---|
15 | |
---|
16 | /** Define a branch class that branches so that it is only satsified if all |
---|
17 | members have different values |
---|
18 | So cut is x <= y-1 or x >= y+1 |
---|
19 | */ |
---|
20 | |
---|
21 | |
---|
22 | class CbcBranchAllDifferent : public CbcBranchCut { |
---|
23 | |
---|
24 | public: |
---|
25 | |
---|
26 | // Default Constructor |
---|
27 | CbcBranchAllDifferent (); |
---|
28 | |
---|
29 | /** Useful constructor - passed set of integer variables which must all be different |
---|
30 | */ |
---|
31 | CbcBranchAllDifferent (CbcModel * model, int number, const int * which); |
---|
32 | |
---|
33 | // Copy constructor |
---|
34 | CbcBranchAllDifferent ( const CbcBranchAllDifferent &); |
---|
35 | |
---|
36 | /// Clone |
---|
37 | virtual CbcObject * clone() const; |
---|
38 | |
---|
39 | // Assignment operator |
---|
40 | CbcBranchAllDifferent & operator=( const CbcBranchAllDifferent& rhs); |
---|
41 | |
---|
42 | // Destructor |
---|
43 | ~CbcBranchAllDifferent (); |
---|
44 | |
---|
45 | /// Infeasibility - large is 0.5 |
---|
46 | virtual double infeasibility(const OsiBranchingInformation * info, |
---|
47 | int &preferredWay) const; |
---|
48 | |
---|
49 | /// Creates a branching object |
---|
50 | virtual CbcBranchingObject * createCbcBranch(OsiSolverInterface * solver, const OsiBranchingInformation * info, int way) ; |
---|
51 | |
---|
52 | |
---|
53 | protected: |
---|
54 | /// data |
---|
55 | |
---|
56 | /// Number of entries |
---|
57 | int numberInSet_; |
---|
58 | /// Which variables |
---|
59 | int * which_; |
---|
60 | }; |
---|
61 | #endif |
---|
62 | |
---|