source: branches/sandbox/Cbc/src/CbcBranchToFixLots.hpp @ 1351

Last change on this file since 1351 was 1351, checked in by EdwinStraver, 10 years ago

Combined CbcBranchDynamic?.cpp with CbcDynamicPseudoCostBranchingObject?
Combined CbcBranchCut? with CbcCutBranchingObject?
Combined CbcLotsize? with CbcBranchLotsize?.cpp

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    */
51    int shallWe() const;
52
53    /// Infeasibility - large is 0.5
54    virtual double infeasibility(const OsiBranchingInformation * info,
55                                 int &preferredWay) const;
56    /** \brief Return true if object can take part in normal heuristics
57    */
58    virtual bool canDoHeuristics() const {
59        return true;
60    }
61
62    /// Creates a branching object
63    virtual CbcBranchingObject * createCbcBranch(OsiSolverInterface * solver, const OsiBranchingInformation * info, int way) ;
64    /// Redoes data when sequence numbers change
65    virtual void redoSequenceEtc(CbcModel * model, int numberColumns, const int * originalColumns);
66
67
68protected:
69    /// data
70
71    /// Reduced cost tolerance i.e. dj has to be >= this before fixed
72    double djTolerance_;
73    /// We only need to make sure this fraction fixed
74    double fractionFixed_;
75    /// Never fix ones marked here
76    char * mark_;
77    /// Matrix by row
78    CoinPackedMatrix matrixByRow_;
79    /// Do if depth multiple of this
80    int depth_;
81    /// number of ==1 rows which need to be clean
82    int numberClean_;
83    /// If true then always create branch
84    bool alwaysCreate_;
85};
86#endif
Note: See TracBrowser for help on using the repository browser.