source: trunk/Cbc/src/CbcBranchToFixLots.hpp @ 1514

Last change on this file since 1514 was 1432, checked in by bjarni, 10 years ago

Added extra return at end of each source file where needed, to remove possible linefeed conflicts (NightlyBuild? errors)

File size: 2.8 KB
Line 
1// Edwin 11/13/2009-- carved out of CbcBranchCut
2#ifndef CbcBranchToFixLots_H
3#define CbcBranchToFixLots_H
4
5#include "CbcBranchCut.hpp"
6#include "CbcBranchBase.hpp"
7#include "OsiRowCut.hpp"
8#include "CoinPackedMatrix.hpp"
9
10/** Define a branch class that branches so that one way variables are fixed
11    while the other way cuts off that solution.
12    a) On reduced cost
13    b) When enough ==1 or <=1 rows have been satisfied (not fixed - satisfied)
14*/
15
16
17class CbcBranchToFixLots : public CbcBranchCut {
18
19public:
20
21    // Default Constructor
22    CbcBranchToFixLots ();
23
24    /** Useful constructor - passed reduced cost tolerance and fraction we would like fixed.
25        Also depth level to do at.
26        Also passed number of 1 rows which when clean triggers fix
27        Always does if all 1 rows cleaned up and number>0 or if fraction columns reached
28        Also whether to create branch if can't reach fraction.
29    */
30    CbcBranchToFixLots (CbcModel * model, double djTolerance,
31                        double fractionFixed, int depth,
32                        int numberClean = 0,
33                        const char * mark = NULL,
34                        bool alwaysCreate = false);
35
36    // Copy constructor
37    CbcBranchToFixLots ( const CbcBranchToFixLots &);
38
39    /// Clone
40    virtual CbcObject * clone() const;
41
42    // Assignment operator
43    CbcBranchToFixLots & operator=( const CbcBranchToFixLots& rhs);
44
45    // Destructor
46    ~CbcBranchToFixLots ();
47
48    /** Does a lot of the work,
49        Returns 0 if no good, 1 if dj, 2 if clean, 3 if both
50        FIXME: should use enum or equivalent to make these numbers clearer.
51    */
52    int shallWe() const;
53
54    /// Infeasibility for an integer variable - large is 0.5, but also can be infinity when known infeasible.
55    virtual double infeasibility(const OsiBranchingInformation * info,
56                                 int &preferredWay) const;
57    /** \brief Return true if object can take part in normal heuristics
58    */
59    virtual bool canDoHeuristics() const {
60        return true;
61    }
62
63    /// Creates a branching object
64    virtual CbcBranchingObject * createCbcBranch(OsiSolverInterface * solver, const OsiBranchingInformation * info, int way) ;
65    /// Redoes data when sequence numbers change
66    virtual void redoSequenceEtc(CbcModel * model, int numberColumns, const int * originalColumns);
67
68
69protected:
70    /// data
71
72    /// Reduced cost tolerance i.e. dj has to be >= this before fixed
73    double djTolerance_;
74    /// We only need to make sure this fraction fixed
75    double fractionFixed_;
76    /// Never fix ones marked here
77    char * mark_;
78    /// Matrix by row
79    CoinPackedMatrix matrixByRow_;
80    /// Do if depth multiple of this
81    int depth_;
82    /// number of ==1 rows which need to be clean
83    int numberClean_;
84    /// If true then always create branch
85    bool alwaysCreate_;
86};
87#endif
88
Note: See TracBrowser for help on using the repository browser.