Clp 1.17.6

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ClpNode.hpp
Go to the documentation of this file.
1 /* $Id: ClpNode.hpp 2385 2019-01-06 19:43:06Z unxusr $ */
2 // Copyright (C) 2008, 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 #ifndef ClpNode_H
7 #define ClpNode_H
8
9 #include "CoinPragma.hpp"
10
11 // This implements all stuff for Clp fathom
16 class ClpFactorization;
17 class ClpDualRowSteepest;
18 class ClpNodeStuff;
19 class ClpNode {
20
21 public:
29 void applyNode(ClpSimplex *model, int doBoundsEtc);
31 void chooseVariable(ClpSimplex *model, ClpNodeStuff *info);
33 int fixOnReducedCosts(ClpSimplex *model);
35 void createArrays(ClpSimplex *model);
37 void cleanUpForCrunch();
39
42 inline double objectiveValue() const
44 {
45 return objectiveValue_;
46 }
48 inline void setObjectiveValue(double value)
49 {
50 objectiveValue_ = value;
51 }
53 inline const double *primalSolution() const
54 {
55 return primalSolution_;
56 }
58 inline const double *dualSolution() const
59 {
60 return dualSolution_;
61 }
63 inline double branchingValue() const
64 {
65 return branchingValue_;
66 }
68 inline double sumInfeasibilities() const
69 {
70 return sumInfeasibilities_;
71 }
73 inline int numberInfeasibilities() const
74 {
75 return numberInfeasibilities_;
76 }
78 inline int depth() const
79 {
80 return depth_;
81 }
83 inline double estimatedSolution() const
84 {
85 return estimatedSolution_;
86 }
88 int way() const;
90 bool fathomed() const;
92 void changeState();
94 inline int sequence() const
95 {
96 return sequence_;
97 }
99 inline bool oddArraysExist() const
100 {
101 return lower_ != NULL;
102 }
104 inline const unsigned char *statusArray() const
105 {
106 return status_;
107 }
109
113 ClpNode();
115 ClpNode(ClpSimplex *model, const ClpNodeStuff *stuff, int depth);
117 void gutsOfConstructor(ClpSimplex *model, const ClpNodeStuff *stuff,
118 int arraysExist, int depth);
120 virtual ~ClpNode();
122
126 ClpNode(const ClpNode &);
128 ClpNode &operator=(const ClpNode &);
130
131 protected:
132 // For state of branch
133 typedef struct {
134 unsigned int firstBranch : 1; // nonzero if first branch on variable is up
135 unsigned int branch : 2; // 0 means do first branch next, 1 second, 2 finished
136 unsigned int spare : 29;
137 } branchState;
140 double branchingValue_;
143 double objectiveValue_;
145 double sumInfeasibilities_;
147 double estimatedSolution_;
149 ClpFactorization *factorization_;
151 ClpDualRowSteepest *weights_;
153 unsigned char *status_;
155 double *primalSolution_;
157 double *dualSolution_;
159 int *lower_;
161 int *upper_;
163 int *pivotVariables_;
165 int *fixed_;
167 branchState branchState_;
169 int sequence_;
171 int numberInfeasibilities_;
173 int depth_;
175 int numberFixed_;
177 int flags_;
179 int maximumFixed_;
181 int maximumRows_;
183 int maximumColumns_;
185 int maximumIntegers_;
187 };
188 class ClpNodeStuff {
189
190 public:
194 ClpNodeStuff();
196 virtual ~ClpNodeStuff();
198
202 ClpNodeStuff(const ClpNodeStuff &);
204 ClpNodeStuff &operator=(const ClpNodeStuff &);
206 void zap(int type);
208
212 void fillPseudoCosts(const double *down, const double *up,
213 const int *priority,
214 const int *numberDown, const int *numberUp,
215 const int *numberDownInfeasible, const int *numberUpInfeasible,
216 int number);
218 void update(int way, int sequence, double change, bool feasible);
220 int maximumNodes() const;
222 int maximumSpace() const;
224
225 public:
228 double integerTolerance_;
231 double integerIncrement_;
233 double smallChange_;
235 double *downPseudo_;
237 double *upPseudo_;
239 int *priority_;
241 int *numberDown_;
243 int *numberUp_;
245 int *numberDownInfeasible_;
247 int *numberUpInfeasible_;
249 double *saveCosts_;
251 ClpNode **nodeInfo_;
253 ClpSimplex *large_;
255 int *whichRow_;
257 int *whichColumn_;
258 #ifndef NO_FATHOM_PRINT
259 CoinMessageHandler *handler_;
261 #endif
262 int nBound_;
265 int saveOptions_;
274 int solverOptions_;
276 int maximumNodes_;
278 int numberBeforeTrust_;
280 int stateOfSearch_;
282 int nDepth_;
284 int nNodes_;
286 int numberNodesExplored_;
288 int numberIterations_;
290 int presolveType_;
291 #ifndef NO_FATHOM_PRINT
292 int startingDepth_;
295 int nodeCalled_;
296 #endif
297
298 };
299 class ClpHashValue {
300
301 public:
304 int index(double value) const;
307 int addValue(double value);
309 inline int numberEntries() const
310 {
311 return numberHash_;
312 }
314
318 ClpHashValue();
320 ClpHashValue(ClpSimplex *model);
322 virtual ~ClpHashValue();
324
328 ClpHashValue(const ClpHashValue &);
330 ClpHashValue &operator=(const ClpHashValue &);
332 private:
336 int hash(double value) const;
338 void resize(bool increaseMax);
340
341 protected:
345 // for hashing
347 typedef struct {
348 double value;
349 int index, next;
350 } CoinHashLink;
352 mutable CoinHashLink *hash_;
354 int numberHash_;
356 int maxHash_;
358 int lastUsed_;
360 };
361 #endif
362
363 /* vi: softtabstop=2 shiftwidth=2 expandtab tabstop=2
364 */
ClpNodeStuff::saveOptions_
int saveOptions_
Save of specialOptions_ (local)
Definition: ClpNode.hpp:265
ClpNode::dualSolution_
double * dualSolution_
Dual solution.
Definition: ClpNode.hpp:157
ClpNodeStuff::smallChange_
double smallChange_
Small change in branch.
Definition: ClpNode.hpp:233
ClpNode::pivotVariables_
int * pivotVariables_
Pivot variables for factorization.
Definition: ClpNode.hpp:163
ClpHashValue
Definition: ClpNode.hpp:299
ClpNodeStuff::fillPseudoCosts
void fillPseudoCosts(const double *down, const double *up, const int *priority, const int *numberDown, const int *numberUp, const int *numberDownInfeasible, const int *numberUpInfeasible, int number)
Fill with pseudocosts.
ClpNode::operator=
ClpNode & operator=(const ClpNode &)
Operator =.
ClpNodeStuff::ClpNodeStuff
ClpNodeStuff()
Default constructor.
ClpNodeStuff::maximumNodes_
int maximumNodes_
Maximum number of nodes to do.
Definition: ClpNode.hpp:276
ClpNodeStuff::numberUpInfeasible_
int * numberUpInfeasible_
Number of times up infeasible.
Definition: ClpNode.hpp:247
ClpNode::fixed_
int * fixed_
Variables fixed by reduced costs (at end of branch) 0x10000000 added if fixed to UB.
Definition: ClpNode.hpp:165
ClpNode::gutsOfConstructor
void gutsOfConstructor(ClpSimplex *model, const ClpNodeStuff *stuff, int arraysExist, int depth)
Does work of constructor (partly so gdb will work)
ClpNode::branchingValue
double branchingValue() const
Initial value of integer variable.
Definition: ClpNode.hpp:63
ClpNode::statusArray
const unsigned char * statusArray() const
Status array.
Definition: ClpNode.hpp:104
ClpNodeStuff::integerTolerance_
double integerTolerance_
Integer tolerance.
Definition: ClpNode.hpp:229
ClpNodeStuff::handler_
CoinMessageHandler * handler_
Cbc&#39;s message handler.
Definition: ClpNode.hpp:260
ClpNode::createArrays
void createArrays(ClpSimplex *model)
Create odd arrays.
ClpNode::factorization_
ClpFactorization * factorization_
Factorization.
Definition: ClpNode.hpp:149
ClpNodeStuff::numberUp_
int * numberUp_
Number of times up.
Definition: ClpNode.hpp:243
ClpNodeStuff::nodeCalled_
int nodeCalled_
Node at which called.
Definition: ClpNode.hpp:295
ClpDualRowSteepest
Dual Row Pivot Steepest Edge Algorithm Class.
Definition: ClpDualRowSteepest.hpp:20
ClpHashValue::CoinHashLink
Data.
Definition: ClpNode.hpp:347
ClpNode::status_
unsigned char * status_
Status vector.
Definition: ClpNode.hpp:153
ClpFactorization
This just implements CoinFactorization when an ClpMatrixBase object is passed.
Definition: ClpFactorization.hpp:34
ClpNode::dualSolution
const double * dualSolution() const
Dual solution.
Definition: ClpNode.hpp:58
ClpNode::objectiveValue_
double objectiveValue_
Value of objective.
Definition: ClpNode.hpp:143
ClpNodeStuff::saveCosts_
double * saveCosts_
Copy of costs (local)
Definition: ClpNode.hpp:249
ClpHashValue::addValue
int addValue(double value)
Add value to list and return index.
ClpNode::primalSolution_
double * primalSolution_
Primal solution.
Definition: ClpNode.hpp:155
ClpNode::cleanUpForCrunch
void cleanUpForCrunch()
Clean up as crunch is different model.
CoinMessageHandler
Base class for message handling.
Definition: CoinMessageHandler.hpp:345
ClpHashValue::CoinHashLink::next
int next
Definition: ClpNode.hpp:349
ClpNodeStuff::nodeInfo_
ClpNode ** nodeInfo_
Array of ClpNodes.
Definition: ClpNode.hpp:251
ClpHashValue::numberHash_
int numberHash_
Number of entries in hash table.
Definition: ClpNode.hpp:354
ClpNode::estimatedSolution
double estimatedSolution() const
Estimated solution value.
Definition: ClpNode.hpp:83
ClpNode::maximumColumns_
int maximumColumns_
Maximum columns so far.
Definition: ClpNode.hpp:183
ClpNode::maximumRows_
int maximumRows_
Maximum rows so far.
Definition: ClpNode.hpp:181
ClpHashValue::ClpHashValue
ClpHashValue()
Default constructor.
ClpHashValue::~ClpHashValue
virtual ~ClpHashValue()
Destructor.
ClpNodeStuff::update
void update(int way, int sequence, double change, bool feasible)
Update pseudo costs.
ClpNodeStuff::numberBeforeTrust_
int numberBeforeTrust_
Number before trust from CbcModel.
Definition: ClpNode.hpp:278
ClpHashValue::operator=
ClpHashValue & operator=(const ClpHashValue &)
=
ClpNode::branchState_
branchState branchState_
State of branch.
Definition: ClpNode.hpp:167
ClpNode::fixOnReducedCosts
int fixOnReducedCosts(ClpSimplex *model)
Fix on reduced costs.
ClpHashValue::hash_
CoinHashLink * hash_
Hash table.
Definition: ClpNode.hpp:352
ClpNode::objectiveValue
double objectiveValue() const
Objective value.
Definition: ClpNode.hpp:43
ClpNodeStuff::downPseudo_
double * downPseudo_
Down pseudo costs.
Definition: ClpNode.hpp:235
ClpNodeStuff::numberDownInfeasible_
int * numberDownInfeasible_
Number of times down infeasible.
Definition: ClpNode.hpp:245
ClpNodeStuff::nDepth_
int nDepth_
Number deep.
Definition: ClpNode.hpp:282
ClpNodeStuff::whichColumn_
int * whichColumn_
Which columns in large model.
Definition: ClpNode.hpp:257
ClpHashValue::index
int index(double value) const
Return index or -1 if not found.
ClpSimplex
This solves LPs using the simplex method.
Definition: ClpSimplex.hpp:106
ClpNode::primalSolution
const double * primalSolution() const
Primal solution.
Definition: ClpNode.hpp:53
ClpHashValue::CoinHashLink::value
double value
Definition: ClpNode.hpp:348
ClpNodeStuff::operator=
ClpNodeStuff & operator=(const ClpNodeStuff &)
Operator =.
ClpNode::chooseVariable
void chooseVariable(ClpSimplex *model, ClpNodeStuff *info)
Choose a new variable.
CoinPragma.hpp
ClpNode::ClpNode
ClpNode()
Default constructor.
ClpHashValue::hash
int hash(double value) const
returns hash
ClpNodeStuff::startingDepth_
int startingDepth_
Depth passed in.
Definition: ClpNode.hpp:293
ClpNodeStuff::maximumSpace
int maximumSpace() const
Return maximum space for nodes.
ClpNodeStuff::upPseudo_
double * upPseudo_
Up pseudo costs.
Definition: ClpNode.hpp:237
ClpNodeStuff::maximumNodes
int maximumNodes() const
Return maximum number of nodes.
ClpNode::sumInfeasibilities
double sumInfeasibilities() const
Sum infeasibilities.
Definition: ClpNode.hpp:68
ClpNode::oddArraysExist
bool oddArraysExist() const
If odd arrays exist.
Definition: ClpNode.hpp:99
ClpNode::weights_
ClpDualRowSteepest * weights_
Steepest edge weights.
Definition: ClpNode.hpp:151
ClpNodeStuff::numberDown_
int * numberDown_
Number of times down.
Definition: ClpNode.hpp:241
ClpNode::maximumFixed_
int maximumFixed_
Maximum number fixed by reduced cost.
Definition: ClpNode.hpp:179
ClpNode::numberInfeasibilities
int numberInfeasibilities() const
Number infeasibilities.
Definition: ClpNode.hpp:73
ClpHashValue::resize
void resize(bool increaseMax)
Resizes.
ClpNode::sequence_
int sequence_
Sequence number of integer variable (-1 if none)
Definition: ClpNode.hpp:169
ClpNode::branchState
Definition: ClpNode.hpp:133
ClpNode::depth
int depth() const
Relative depth.
Definition: ClpNode.hpp:78
ClpNode::changeState
void changeState()
Change state of variable i.e. go other way.
ClpNodeStuff::integerIncrement_
double integerIncrement_
Integer increment.
Definition: ClpNode.hpp:231
ClpNodeStuff::nNodes_
int nNodes_
Number nodes returned (-1 if fathom aborted)
Definition: ClpNode.hpp:284
ClpNodeStuff::zap
void zap(int type)
Zaps stuff 1 - arrays, 2 ints, 3 both.
ClpHashValue::maxHash_
int maxHash_
Maximum number of entries in hash table i.e. size.
Definition: ClpNode.hpp:356
ClpNodeStuff::large_
ClpSimplex * large_
Large model if crunched.
Definition: ClpNode.hpp:253
ClpHashValue::lastUsed_
int lastUsed_
Last used space.
Definition: ClpNode.hpp:358
ClpNode::setObjectiveValue
void setObjectiveValue(double value)
Set objective value.
Definition: ClpNode.hpp:48
ClpNodeStuff::priority_
int * priority_
Priority.
Definition: ClpNode.hpp:239
ClpNode::sequence
int sequence() const
Sequence number of integer variable (-1 if none)
Definition: ClpNode.hpp:94
ClpNode
Definition: ClpNode.hpp:19
ClpNode::fathomed
bool fathomed() const
Return true if branch exhausted.
ClpNodeStuff
Definition: ClpNode.hpp:188
ClpNodeStuff::presolveType_
int presolveType_
Type of presolve - 0 none, 1 crunch.
Definition: ClpNode.hpp:290
ClpNode::lower_
int * lower_
Integer lower bounds (only used in fathomMany)
Definition: ClpNode.hpp:159
ClpNode::numberInfeasibilities_
int numberInfeasibilities_
Number of infeasibilities.
Definition: ClpNode.hpp:171
ClpNode::sumInfeasibilities_
double sumInfeasibilities_
Sum of infeasibilities.
Definition: ClpNode.hpp:145
ClpNodeStuff::~ClpNodeStuff
virtual ~ClpNodeStuff()
Destructor.
ClpNode::flags_
int flags_
Flags - 1 duals scaled.
Definition: ClpNode.hpp:177
ClpNode::estimatedSolution_
double estimatedSolution_
Estimated solution value.
Definition: ClpNode.hpp:147
ClpNode::maximumIntegers_
int maximumIntegers_
Maximum Integers so far.
Definition: ClpNode.hpp:185
ClpNode::~ClpNode
virtual ~ClpNode()
Destructor.
ClpNodeStuff::solverOptions_
int solverOptions_
Options to pass to solver 1 - create external reduced costs for columns 2 - create external reduced c...
Definition: ClpNode.hpp:274
ClpNodeStuff::whichRow_
int * whichRow_
Which rows in large model.
Definition: ClpNode.hpp:255
ClpNodeStuff::nBound_
int nBound_
Number bounds in large model.
Definition: ClpNode.hpp:263
ClpNode::upper_
int * upper_
Integer upper bounds (only used in fathomMany)
Definition: ClpNode.hpp:161
ClpNodeStuff::numberNodesExplored_
int numberNodesExplored_
Number of nodes explored.
Definition: ClpNode.hpp:286
ClpNodeStuff::numberIterations_
int numberIterations_
Number of iterations.
Definition: ClpNode.hpp:288
ClpNode::depth_
int depth_
Relative depth.
Definition: ClpNode.hpp:173
ClpHashValue::numberEntries
int numberEntries() const
Number of different entries.
Definition: ClpNode.hpp:309
ClpNodeStuff::stateOfSearch_
int stateOfSearch_
State of search from CbcModel.
Definition: ClpNode.hpp:280
ClpNode::way
int way() const
Way for integer variable -1 down , +1 up.
ClpNode::applyNode
void applyNode(ClpSimplex *model, int doBoundsEtc)
Applies node to model 0 - just tree bounds 1 - tree bounds and basis etc 2 - saved bounds and basis e...
ClpNode::branchingValue_
double branchingValue_
Initial value of integer variable.
Definition: ClpNode.hpp:141
ClpNode::numberFixed_
int numberFixed_
Number fixed by reduced cost.
Definition: ClpNode.hpp:175