Loading...
Searching...
No Matches
ClpNode.hpp
Go to the documentation of this file.
/* $Id$ */
// Copyright (C) 2008, International Business Machines
// Corporation and others. All Rights Reserved.
// This code is licensed under the terms of the Eclipse Public License (EPL).
#ifndef ClpNode_H
#define ClpNode_H
#include "CoinPragma.hpp"
// This implements all stuff for Clp fathom
class ClpFactorization;
class ClpDualRowSteepest;
class ClpNodeStuff;
class ClpNode {
public:
void applyNode(ClpSimplex *model, int doBoundsEtc);
void chooseVariable(ClpSimplex *model, ClpNodeStuff *info);
int fixOnReducedCosts(ClpSimplex *model);
void createArrays(ClpSimplex *model);
void cleanUpForCrunch();
inline double objectiveValue() const
{
return objectiveValue_;
}
inline void setObjectiveValue(double value)
{
objectiveValue_ = value;
}
inline const double *primalSolution() const
{
return primalSolution_;
}
inline const double *dualSolution() const
{
return dualSolution_;
}
inline double branchingValue() const
{
return branchingValue_;
}
inline double sumInfeasibilities() const
{
return sumInfeasibilities_;
}
inline int numberInfeasibilities() const
{
return numberInfeasibilities_;
}
inline int depth() const
{
return depth_;
}
inline double estimatedSolution() const
{
return estimatedSolution_;
}
int way() const;
bool fathomed() const;
void changeState();
inline int sequence() const
{
return sequence_;
}
inline bool oddArraysExist() const
{
return lower_ != NULL;
}
inline const unsigned char *statusArray() const
{
return status_;
}
ClpNode();
ClpNode(ClpSimplex *model, const ClpNodeStuff *stuff, int depth);
void gutsOfConstructor(ClpSimplex *model, const ClpNodeStuff *stuff,
int arraysExist, int depth);
virtual ~ClpNode();
ClpNode(const ClpNode &);
ClpNode &operator=(const ClpNode &);
protected:
// For state of branch
typedef struct {
unsigned int firstBranch : 1; // nonzero if first branch on variable is up
unsigned int branch : 2; // 0 means do first branch next, 1 second, 2 finished
unsigned int spare : 29;
} branchState;
double branchingValue_;
double objectiveValue_;
double sumInfeasibilities_;
double estimatedSolution_;
ClpFactorization *factorization_;
ClpDualRowSteepest *weights_;
unsigned char *status_;
double *primalSolution_;
double *dualSolution_;
int *lower_;
int *upper_;
int *pivotVariables_;
int *fixed_;
branchState branchState_;
int sequence_;
int numberInfeasibilities_;
int depth_;
int numberFixed_;
int flags_;
int maximumFixed_;
int maximumRows_;
int maximumColumns_;
int maximumIntegers_;
};
class ClpNodeStuff {
public:
ClpNodeStuff();
virtual ~ClpNodeStuff();
ClpNodeStuff(const ClpNodeStuff &);
ClpNodeStuff &operator=(const ClpNodeStuff &);
void zap(int type);
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);
void update(int way, int sequence, double change, bool feasible);
int maximumNodes() const;
int maximumSpace() const;
public:
double integerTolerance_;
double integerIncrement_;
double smallChange_;
double *downPseudo_;
double *upPseudo_;
int *priority_;
int *numberDown_;
int *numberUp_;
int *numberDownInfeasible_;
int *numberUpInfeasible_;
double *saveCosts_;
ClpNode **nodeInfo_;
ClpSimplex *large_;
int *whichRow_;
int *whichColumn_;
#ifndef NO_FATHOM_PRINT
CoinMessageHandler *handler_;
#endif
int nBound_;
int saveOptions_;
int solverOptions_;
int maximumNodes_;
int numberBeforeTrust_;
int stateOfSearch_;
int nDepth_;
int nNodes_;
int numberNodesExplored_;
int numberIterations_;
int presolveType_;
#ifndef NO_FATHOM_PRINT
int startingDepth_;
int nodeCalled_;
#endif
};
class ClpHashValue {
public:
int index(double value) const;
int addValue(double value);
inline int numberEntries() const
{
return numberHash_;
}
ClpHashValue();
ClpHashValue(ClpSimplex *model);
virtual ~ClpHashValue();
ClpHashValue(const ClpHashValue &);
ClpHashValue &operator=(const ClpHashValue &);
private:
int hash(double value) const;
void resize(bool increaseMax);
protected:
// for hashing
typedef struct {
double value;
int index, next;
} CoinHashLink;
mutable CoinHashLink *hash_;
int numberHash_;
int maxHash_;
int lastUsed_;
};
#endif
/* vi: softtabstop=2 shiftwidth=2 expandtab tabstop=2
*/
type
CbcOrClpParameterType type() const
type
Definition CbcOrClpParam.hpp:462
ClpDualRowSteepest
Dual Row Pivot Steepest Edge Algorithm Class.
Definition ClpDualRowSteepest.hpp:20
ClpFactorization
This just implements CoinFactorization when an ClpMatrixBase object is passed.
Definition ClpFactorization.hpp:38
ClpHashValue::resize
void resize(bool increaseMax)
Resizes.
ClpHashValue::hash
int hash(double value) const
returns hash
ClpHashValue::numberHash_
int numberHash_
Number of entries in hash table.
Definition ClpNode.hpp:354
ClpHashValue::~ClpHashValue
virtual ~ClpHashValue()
Destructor.
ClpHashValue::ClpHashValue
ClpHashValue(const ClpHashValue &)
The copy constructor.
ClpHashValue::ClpHashValue
ClpHashValue()
Default constructor.
ClpHashValue::hash_
CoinHashLink * hash_
Hash table.
Definition ClpNode.hpp:352
ClpHashValue::lastUsed_
int lastUsed_
Last used space.
Definition ClpNode.hpp:358
ClpHashValue::operator=
ClpHashValue & operator=(const ClpHashValue &)
=
ClpHashValue::numberEntries
int numberEntries() const
Number of different entries.
Definition ClpNode.hpp:309
ClpHashValue::index
int index(double value) const
Return index or -1 if not found.
ClpHashValue::maxHash_
int maxHash_
Maximum number of entries in hash table i.e. size.
Definition ClpNode.hpp:356
ClpHashValue::addValue
int addValue(double value)
Add value to list and return index.
ClpHashValue::ClpHashValue
ClpHashValue(ClpSimplex *model)
Useful constructor.
ClpNodeStuff
Definition ClpNode.hpp:188
ClpNodeStuff::zap
void zap(int type)
Zaps stuff 1 - arrays, 2 ints, 3 both.
ClpNodeStuff::downPseudo_
double * downPseudo_
Down pseudo costs.
Definition ClpNode.hpp:235
ClpNodeStuff::ClpNodeStuff
ClpNodeStuff(const ClpNodeStuff &)
The copy constructor.
ClpNodeStuff::priority_
int * priority_
Priority.
Definition ClpNode.hpp:239
ClpNodeStuff::maximumNodes_
int maximumNodes_
Maximum number of nodes to do.
Definition ClpNode.hpp:276
ClpNodeStuff::presolveType_
int presolveType_
Type of presolve - 0 none, 1 crunch.
Definition ClpNode.hpp:290
ClpNodeStuff::nDepth_
int nDepth_
Number deep.
Definition ClpNode.hpp:282
ClpNodeStuff::ClpNodeStuff
ClpNodeStuff()
Default constructor.
ClpNodeStuff::numberDownInfeasible_
int * numberDownInfeasible_
Number of times down infeasible.
Definition ClpNode.hpp:245
ClpNodeStuff::integerIncrement_
double integerIncrement_
Integer increment.
Definition ClpNode.hpp:231
ClpNodeStuff::startingDepth_
int startingDepth_
Depth passed in.
Definition ClpNode.hpp:293
ClpNodeStuff::smallChange_
double smallChange_
Small change in branch.
Definition ClpNode.hpp:233
ClpNodeStuff::nBound_
int nBound_
Number bounds in large model.
Definition ClpNode.hpp:263
ClpNodeStuff::upPseudo_
double * upPseudo_
Up pseudo costs.
Definition ClpNode.hpp:237
ClpNodeStuff::numberNodesExplored_
int numberNodesExplored_
Number of nodes explored.
Definition ClpNode.hpp:286
ClpNodeStuff::saveOptions_
int saveOptions_
Save of specialOptions_ (local).
Definition ClpNode.hpp:265
ClpNodeStuff::whichRow_
int * whichRow_
Which rows in large model.
Definition ClpNode.hpp:255
ClpNodeStuff::large_
ClpSimplex * large_
Large model if crunched.
Definition ClpNode.hpp:253
ClpNodeStuff::maximumSpace
int maximumSpace() const
Return maximum space for nodes.
ClpNodeStuff::nodeCalled_
int nodeCalled_
Node at which called.
Definition ClpNode.hpp:295
ClpNodeStuff::whichColumn_
int * whichColumn_
Which columns in large model.
Definition ClpNode.hpp:257
ClpNodeStuff::numberBeforeTrust_
int numberBeforeTrust_
Number before trust from CbcModel.
Definition ClpNode.hpp:278
ClpNodeStuff::nodeInfo_
ClpNode ** nodeInfo_
Array of ClpNodes.
Definition ClpNode.hpp:251
ClpNodeStuff::integerTolerance_
double integerTolerance_
Integer tolerance.
Definition ClpNode.hpp:229
ClpNodeStuff::stateOfSearch_
int stateOfSearch_
State of search from CbcModel.
Definition ClpNode.hpp:280
ClpNodeStuff::operator=
ClpNodeStuff & operator=(const ClpNodeStuff &)
Operator =.
ClpNodeStuff::~ClpNodeStuff
virtual ~ClpNodeStuff()
Destructor.
ClpNodeStuff::numberUpInfeasible_
int * numberUpInfeasible_
Number of times up infeasible.
Definition ClpNode.hpp:247
ClpNodeStuff::numberUp_
int * numberUp_
Number of times up.
Definition ClpNode.hpp:243
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.
ClpNodeStuff::handler_
CoinMessageHandler * handler_
Cbc's message handler.
Definition ClpNode.hpp:260
ClpNodeStuff::numberIterations_
int numberIterations_
Number of iterations.
Definition ClpNode.hpp:288
ClpNodeStuff::maximumNodes
int maximumNodes() const
Return maximum number of nodes.
ClpNodeStuff::nNodes_
int nNodes_
Number nodes returned (-1 if fathom aborted).
Definition ClpNode.hpp:284
ClpNodeStuff::saveCosts_
double * saveCosts_
Copy of costs (local).
Definition ClpNode.hpp:249
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::update
void update(int way, int sequence, double change, bool feasible)
Update pseudo costs.
ClpNodeStuff::numberDown_
int * numberDown_
Number of times down.
Definition ClpNode.hpp:241
ClpNode
Definition ClpNode.hpp:19
ClpNode::sequence
int sequence() const
Sequence number of integer variable (-1 if none).
Definition ClpNode.hpp:94
ClpNode::estimatedSolution_
double estimatedSolution_
Estimated solution value.
Definition ClpNode.hpp:147
ClpNode::objectiveValue_
double objectiveValue_
Value of objective.
Definition ClpNode.hpp:143
ClpNode::branchState_
branchState branchState_
State of branch.
Definition ClpNode.hpp:167
ClpNode::maximumColumns_
int maximumColumns_
Maximum columns so far.
Definition ClpNode.hpp:183
ClpNode::fixed_
int * fixed_
Variables fixed by reduced costs (at end of branch) 0x10000000 added if fixed to UB.
Definition ClpNode.hpp:165
ClpNode::numberInfeasibilities_
int numberInfeasibilities_
Number of infeasibilities.
Definition ClpNode.hpp:171
ClpNode::upper_
int * upper_
Integer upper bounds (only used in fathomMany).
Definition ClpNode.hpp:161
ClpNode::depth_
int depth_
Relative depth.
Definition ClpNode.hpp:173
ClpNode::numberFixed_
int numberFixed_
Number fixed by reduced cost.
Definition ClpNode.hpp:175
ClpNode::flags_
int flags_
Flags - 1 duals scaled.
Definition ClpNode.hpp:177
ClpNode::numberInfeasibilities
int numberInfeasibilities() const
Number infeasibilities.
Definition ClpNode.hpp:73
ClpNode::lower_
int * lower_
Integer lower bounds (only used in fathomMany).
Definition ClpNode.hpp:159
ClpNode::branchingValue_
double branchingValue_
Initial value of integer variable.
Definition ClpNode.hpp:141
ClpNode::oddArraysExist
bool oddArraysExist() const
If odd arrays exist.
Definition ClpNode.hpp:99
ClpNode::chooseVariable
void chooseVariable(ClpSimplex *model, ClpNodeStuff *info)
Choose a new variable.
ClpNode::ClpNode
ClpNode(const ClpNode &)
The copy constructor.
ClpNode::fixOnReducedCosts
int fixOnReducedCosts(ClpSimplex *model)
Fix on reduced costs.
ClpNode::ClpNode
ClpNode(ClpSimplex *model, const ClpNodeStuff *stuff, int depth)
Constructor from model.
ClpNode::primalSolution
const double * primalSolution() const
Primal solution.
Definition ClpNode.hpp:53
ClpNode::cleanUpForCrunch
void cleanUpForCrunch()
Clean up as crunch is different model.
ClpNode::pivotVariables_
int * pivotVariables_
Pivot variables for factorization.
Definition ClpNode.hpp:163
ClpNode::dualSolution
const double * dualSolution() const
Dual solution.
Definition ClpNode.hpp:58
ClpNode::~ClpNode
virtual ~ClpNode()
Destructor.
ClpNode::changeState
void changeState()
Change state of variable i.e. go other way.
ClpNode::sequence_
int sequence_
Sequence number of integer variable (-1 if none).
Definition ClpNode.hpp:169
ClpNode::branchingValue
double branchingValue() const
Initial value of integer variable.
Definition ClpNode.hpp:63
ClpNode::way
int way() const
Way for integer variable -1 down , +1 up.
ClpNode::status_
unsigned char * status_
Status vector.
Definition ClpNode.hpp:153
ClpNode::maximumRows_
int maximumRows_
Maximum rows so far.
Definition ClpNode.hpp:181
ClpNode::fathomed
bool fathomed() const
Return true if branch exhausted.
ClpNode::estimatedSolution
double estimatedSolution() const
Estimated solution value.
Definition ClpNode.hpp:83
ClpNode::ClpNode
ClpNode()
Default constructor.
ClpNode::sumInfeasibilities_
double sumInfeasibilities_
Sum of infeasibilities.
Definition ClpNode.hpp:145
ClpNode::dualSolution_
double * dualSolution_
Dual solution.
Definition ClpNode.hpp:157
ClpNode::gutsOfConstructor
void gutsOfConstructor(ClpSimplex *model, const ClpNodeStuff *stuff, int arraysExist, int depth)
Does work of constructor (partly so gdb will work).
ClpNode::maximumFixed_
int maximumFixed_
Maximum number fixed by reduced cost.
Definition ClpNode.hpp:179
ClpNode::maximumIntegers_
int maximumIntegers_
Maximum Integers so far.
Definition ClpNode.hpp:185
ClpNode::weights_
ClpDualRowSteepest * weights_
Steepest edge weights.
Definition ClpNode.hpp:151
ClpNode::statusArray
const unsigned char * statusArray() const
Status array.
Definition ClpNode.hpp:104
ClpNode::setObjectiveValue
void setObjectiveValue(double value)
Set objective value.
Definition ClpNode.hpp:48
ClpNode::objectiveValue
double objectiveValue() const
Objective value.
Definition ClpNode.hpp:43
ClpNode::depth
int depth() const
Relative depth.
Definition ClpNode.hpp:78
ClpNode::primalSolution_
double * primalSolution_
Primal solution.
Definition ClpNode.hpp:155
ClpNode::factorization_
ClpFactorization * factorization_
Factorization.
Definition ClpNode.hpp:149
ClpNode::createArrays
void createArrays(ClpSimplex *model)
Create odd arrays.
ClpNode::operator=
ClpNode & operator=(const ClpNode &)
Operator =.
ClpNode::sumInfeasibilities
double sumInfeasibilities() const
Sum infeasibilities.
Definition ClpNode.hpp:68
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...
ClpSimplex
This solves LPs using the simplex method.
Definition ClpSimplex.hpp:106
ClpHashValue::CoinHashLink
Data.
Definition ClpNode.hpp:347
ClpHashValue::CoinHashLink::next
int next
Definition ClpNode.hpp:349
ClpHashValue::CoinHashLink::index
int index
Definition ClpNode.hpp:349
ClpHashValue::CoinHashLink::value
double value
Definition ClpNode.hpp:348
ClpNode::branchState
Definition ClpNode.hpp:133
ClpNode::branchState::spare
unsigned int spare
Definition ClpNode.hpp:136
ClpNode::branchState::firstBranch
unsigned int firstBranch
Definition ClpNode.hpp:134
ClpNode::branchState::branch
unsigned int branch
Definition ClpNode.hpp:135