source: branches/sandbox/Cbc/src/CbcBranchLotsize.hpp @ 1308

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

Broke up CbcBranchDynamic? and CbcBranchLotsize?.cpp.
Updated spreadsheets.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 3.5 KB
Line 
1/* $Id: CbcBranchLotsize.hpp 1308 2009-11-17 22:19:19Z EdwinStraver $ */
2// Copyright (C) 2004, International Business Machines
3// Corporation and others.  All Rights Reserved.
4#ifndef CbcBranchLotsize_H
5#define CbcBranchLotsize_H
6
7#include "CbcBranchBase.hpp"
8#include "CbcLotsize.hpp"
9
10/** Lotsize branching object
11
12  This object can specify a two-way branch on an integer variable. For each
13  arm of the branch, the upper and lower bounds on the variable can be
14  independently specified.
15
16  Variable_ holds the index of the integer variable in the integerVariable_
17  array of the model.
18*/
19
20class CbcLotsizeBranchingObject : public CbcBranchingObject {
21
22public:
23
24    /// Default constructor
25    CbcLotsizeBranchingObject ();
26
27    /** Create a lotsize floor/ceiling branch object
28
29      Specifies a simple two-way branch. Let \p value = x*. One arm of the
30      branch will be is lb <= x <= valid range below(x*), the other valid range above(x*) <= x <= ub.
31      Specify way = -1 to set the object state to perform the down arm first,
32      way = 1 for the up arm.
33    */
34    CbcLotsizeBranchingObject (CbcModel *model, int variable,
35                               int way , double value, const CbcLotsize * lotsize) ;
36
37    /** Create a degenerate branch object
38
39      Specifies a `one-way branch'. Calling branch() for this object will
40      always result in lowerValue <= x <= upperValue. Used to fix in valid range
41    */
42
43    CbcLotsizeBranchingObject (CbcModel *model, int variable, int way,
44                               double lowerValue, double upperValue) ;
45
46    /// Copy constructor
47    CbcLotsizeBranchingObject ( const CbcLotsizeBranchingObject &);
48
49    /// Assignment operator
50    CbcLotsizeBranchingObject & operator= (const CbcLotsizeBranchingObject& rhs);
51
52    /// Clone
53    virtual CbcBranchingObject * clone() const;
54
55    /// Destructor
56    virtual ~CbcLotsizeBranchingObject ();
57
58    using CbcBranchingObject::branch ;
59    /** \brief Sets the bounds for the variable according to the current arm
60           of the branch and advances the object state to the next arm.
61    */
62    virtual double branch();
63
64#if 0
65    // No need to override. Default works fine.
66    /** Reset every information so that the branching object appears to point to
67        the previous child. This method does not need to modify anything in any
68        solver. */
69    virtual void previousBranch();
70#endif
71
72    using CbcBranchingObject::print ;
73    /** \brief Print something about branch - only if log level high
74    */
75    virtual void print();
76
77    /** Return the type (an integer identifier) of \c this */
78    virtual int type() const {
79        return 300;
80    }
81
82    // LL: compareOriginalObject can be inherited from the CbcBranchingObject
83    // since variable_ uniquely defines the lot sizing object.
84
85    /** Compare the \c this with \c brObj. \c this and \c brObj must be os the
86        same type and must have the same original object, but they may have
87        different feasible regions.
88        Return the appropriate CbcRangeCompare value (first argument being the
89        sub/superset if that's the case). In case of overlap (and if \c
90        replaceIfOverlap is true) replace the current branching object with one
91        whose feasible region is the overlap.
92     */
93    virtual CbcRangeCompare compareBranchingObject
94    (const CbcBranchingObject* brObj, const bool replaceIfOverlap = false);
95
96protected:
97    /// Lower [0] and upper [1] bounds for the down arm (way_ = -1)
98    double down_[2];
99    /// Lower [0] and upper [1] bounds for the up arm (way_ = 1)
100    double up_[2];
101};
102
103
104#endif
Note: See TracBrowser for help on using the repository browser.