source: branches/sandbox/Cbc/src/CbcSimpleInteger.hpp @ 1293

Last change on this file since 1293 was 1293, checked in by EdwinStraver, 10 years ago
File size: 4.1 KB
Line 
1// Edwin 11/9/2009-- carved out of CbcBranchActual
2
3#ifndef CbcSimpleInteger_H
4#define CbcSimpleInteger_H
5
6#include "CbcIntegerBranchingObject.hpp"
7/// Define a single integer class
8
9
10class CbcSimpleInteger : public CbcObject {
11
12public:
13
14    // Default Constructor
15    CbcSimpleInteger ();
16
17    // Useful constructor - passed model and index
18    CbcSimpleInteger (CbcModel * model,  int iColumn, double breakEven = 0.5);
19
20    // Useful constructor - passed model and Osi object
21    CbcSimpleInteger (CbcModel * model,  const OsiSimpleInteger * object);
22
23    // Copy constructor
24    CbcSimpleInteger ( const CbcSimpleInteger &);
25
26    /// Clone
27    virtual CbcObject * clone() const;
28
29    // Assignment operator
30    CbcSimpleInteger & operator=( const CbcSimpleInteger& rhs);
31
32    // Destructor
33    virtual ~CbcSimpleInteger ();
34    /// Construct an OsiSimpleInteger object
35    OsiSimpleInteger * osiObject() const;
36    /// Infeasibility - large is 0.5
37    virtual double infeasibility(const OsiBranchingInformation * info,
38                                 int &preferredWay) const;
39
40    using CbcObject::feasibleRegion ;
41    /** Set bounds to fix the variable at the current (integer) value.
42
43      Given an integer value, set the lower and upper bounds to fix the
44      variable. Returns amount it had to move variable.
45    */
46    virtual double feasibleRegion(OsiSolverInterface * solver, const OsiBranchingInformation * info) const;
47
48    /** Create a branching object and indicate which way to branch first.
49
50        The branching object has to know how to create branches (fix
51        variables, etc.)
52    */
53    virtual CbcBranchingObject * createCbcBranch(OsiSolverInterface * solver, const OsiBranchingInformation * info, int way) ;
54    /// Fills in a created branching object
55    void fillCreateBranch(CbcIntegerBranchingObject * branching, const OsiBranchingInformation * info, int way) ;
56
57    using CbcObject::solverBranch ;
58    /** Create an OsiSolverBranch object
59
60        This returns NULL if branch not represented by bound changes
61    */
62    virtual OsiSolverBranch * solverBranch(OsiSolverInterface * solver, const OsiBranchingInformation * info) const;
63
64    /** Set bounds to fix the variable at the current (integer) value.
65
66      Given an integer value, set the lower and upper bounds to fix the
67      variable. The algorithm takes a bit of care in order to compensate for
68      minor numerical inaccuracy.
69    */
70    virtual void feasibleRegion();
71
72    /** Column number if single column object -1 otherwise,
73        so returns >= 0
74        Used by heuristics
75    */
76    virtual int columnNumber() const;
77    /// Set column number
78    inline void setColumnNumber(int value) {
79        columnNumber_ = value;
80    }
81
82    /** Reset variable bounds to their original values.
83
84      Bounds may be tightened, so it may be good to be able to set this info in object.
85     */
86    virtual void resetBounds(const OsiSolverInterface * solver) ;
87    /**  Change column numbers after preprocessing
88     */
89    virtual void resetSequenceEtc(int numberColumns, const int * originalColumns) ;
90    /// Original bounds
91    inline double originalLowerBound() const {
92        return originalLower_;
93    }
94    inline void setOriginalLowerBound(double value) {
95        originalLower_ = value;
96    }
97    inline double originalUpperBound() const {
98        return originalUpper_;
99    }
100    inline void setOriginalUpperBound(double value) {
101        originalUpper_ = value;
102    }
103    /// Breakeven e.g 0.7 -> >= 0.7 go up first
104    inline double breakEven() const {
105        return breakEven_;
106    }
107    /// Set breakeven e.g 0.7 -> >= 0.7 go up first
108    inline void setBreakEven(double value) {
109        breakEven_ = value;
110    }
111
112
113protected:
114    /// data
115
116    /// Original lower bound
117    double originalLower_;
118    /// Original upper bound
119    double originalUpper_;
120    /// Breakeven i.e. >= this preferred is up
121    double breakEven_;
122    /// Column number in model
123    int columnNumber_;
124    /// If -1 down always chosen first, +1 up always, 0 normal
125    int preferredWay_;
126};
127#endif
Note: See TracBrowser for help on using the repository browser.