Cbc 2.10.5
Loading...
Searching...
No Matches
CbcGeneralDepth.hpp
Go to the documentation of this file.
1// $Id: CbcGeneralDepth.hpp 2465 2019-01-03 19:26:52Z unxusr $
2// Copyright (C) 2002, 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/10/2009-- carved out of CbcBranchActual
7
8#ifndef CbcGeneralDepth_H
9#define CbcGeneralDepth_H
10
11#include "CbcGeneral.hpp"
12#include "CbcBranchBase.hpp"
13#include "CbcSubProblem.hpp"
14
15#ifdef COIN_HAS_CLP
16
20#include "ClpSimplex.hpp"
21#include "ClpNode.hpp"
22
23class CbcGeneralDepth : public CbcGeneral {
24
25public:
26 // Default Constructor
27 CbcGeneralDepth();
28
35 CbcGeneralDepth(CbcModel *model, int maximumDepth);
36
37 // Copy constructor
38 CbcGeneralDepth(const CbcGeneralDepth &);
39
41 virtual CbcObject *clone() const;
42
43 // Assignment operator
44 CbcGeneralDepth &operator=(const CbcGeneralDepth &rhs);
45
46 // Destructor
47 ~CbcGeneralDepth();
48
50 virtual double infeasibility(const OsiBranchingInformation *info,
51 int &preferredWay) const;
52
55 virtual void feasibleRegion();
56
58 virtual CbcBranchingObject *createCbcBranch(OsiSolverInterface *solver, const OsiBranchingInformation *info, int way);
60 inline int maximumNodes() const
61 {
62 return maximumNodes_;
63 }
65 inline int maximumDepth() const
66 {
67 return maximumDepth_;
68 }
70 inline void setMaximumDepth(int value)
71 {
72 maximumDepth_ = value;
73 }
75 inline int numberNodes() const
76 {
77 return numberNodes_;
78 }
80 inline int whichSolution() const
81 {
82 return whichSolution_;
83 }
85 inline ClpNode *nodeInfo(int which)
86 {
87 return nodeInfo_->nodeInfo_[which];
88 }
89
91 virtual void redoSequenceEtc(CbcModel *model, int numberColumns, const int *originalColumns);
92
93protected:
96 int maximumDepth_;
98 int maximumNodes_;
100 mutable int whichSolution_;
102 mutable int numberNodes_;
104 mutable ClpNodeStuff *nodeInfo_;
105};
109class CbcNode;
110class CbcGeneralBranchingObject : public CbcBranchingObject {
111
112public:
113 // Default Constructor
114 CbcGeneralBranchingObject();
115
116 // Useful constructor
117 CbcGeneralBranchingObject(CbcModel *model);
118
119 // Copy constructor
120 CbcGeneralBranchingObject(const CbcGeneralBranchingObject &);
121
122 // Assignment operator
123 CbcGeneralBranchingObject &operator=(const CbcGeneralBranchingObject &rhs);
124
126 virtual CbcBranchingObject *clone() const;
127
128 // Destructor
129 virtual ~CbcGeneralBranchingObject();
130
133 virtual double branch();
136 virtual void checkIsCutoff(double cutoff);
137
141 virtual void print();
143 void state(double &objectiveValue, double &sumInfeasibilities,
144 int &numberUnsatisfied, int which) const;
146 inline void setNode(CbcNode *node)
147 {
148 node_ = node;
149 }
151 virtual CbcBranchObjType type() const
152 {
154 }
155
163 virtual int compareOriginalObject(const CbcBranchingObject *brObj) const;
164
173 virtual CbcRangeCompare compareBranchingObject(const CbcBranchingObject *brObj, const bool replaceIfOverlap = false);
175 inline int numberSubProblems() const
176 {
177 return numberSubProblems_;
178 }
180 inline int decrementNumberLeft()
181 {
182 numberSubLeft_--;
183 return numberSubLeft_;
184 }
186 inline int whichNode() const
187 {
188 return whichNode_;
189 }
191 inline void setWhichNode(int value)
192 {
193 whichNode_ = value;
194 }
195 // Sub problem
196 const CbcSubProblem *subProblem(int which) const
197 {
198 return subProblems_ + which;
199 }
200
201public:
203 // Sub problems
204 CbcSubProblem *subProblems_;
206 CbcNode *node_;
208 int numberSubProblems_;
210 int numberSubLeft_;
212 int whichNode_;
214 int numberRows_;
215};
219class CbcOneGeneralBranchingObject : public CbcBranchingObject {
220
221public:
222 // Default Constructor
223 CbcOneGeneralBranchingObject();
224
225 // Useful constructor
226 CbcOneGeneralBranchingObject(CbcModel *model,
227 CbcGeneralBranchingObject *object,
228 int whichOne);
229
230 // Copy constructor
231 CbcOneGeneralBranchingObject(const CbcOneGeneralBranchingObject &);
232
233 // Assignment operator
234 CbcOneGeneralBranchingObject &operator=(const CbcOneGeneralBranchingObject &rhs);
235
237 virtual CbcBranchingObject *clone() const;
238
239 // Destructor
240 virtual ~CbcOneGeneralBranchingObject();
241
244 virtual double branch();
247 virtual void checkIsCutoff(double cutoff);
248
252 virtual void print();
254 virtual CbcBranchObjType type() const
255 {
257 }
258
266 virtual int compareOriginalObject(const CbcBranchingObject *brObj) const;
267
276 virtual CbcRangeCompare compareBranchingObject(const CbcBranchingObject *brObj, const bool replaceIfOverlap = false);
277
278public:
281 CbcGeneralBranchingObject *object_;
283 int whichOne_;
284};
285#endif //COIN_HAS_CLP
286#endif
287
288/* vi: softtabstop=2 shiftwidth=2 expandtab tabstop=2
289*/
CbcRangeCompare
@ GeneralDepthBranchObj
@ OneGeneralBranchingObj
Abstract branching object base class Now just difference with OsiBranchingObject.
CbcBranchingObject & operator=(const CbcBranchingObject &rhs)
Assignment operator.
virtual double branch()=0
Execute the actions required to branch, as specified by the current state of the branching object,...
virtual void print() const
Print something about branch - only if log level high.
Define a catch all class.
virtual CbcObject * clone() const =0
Clone.
CbcGeneral & operator=(const CbcGeneral &rhs)
Simple Branch and bound class.
Definition CbcModel.hpp:100
Information required while the node is live.
Definition CbcNode.hpp:49
virtual void feasibleRegion()=0
For the variable(s) referenced by the object, look at the current solution and set bounds to match th...