15 #include "CoinPragma.hpp"
16 #include "OsiSolverInterface.hpp"
17 #include "CbcModel.hpp"
27 int pretendFailIsInfeasible)
30 maxFailure_(maxFailures),
31 maxInfeasible_(maxInfeasibles),
32 pretendFailIsInfeasible_(pretendFailIsInfeasible)
34 setPreProcessState(0);
53 maxFailure_(rhs.maxFailure_),
54 maxInfeasible_(rhs.maxInfeasible_),
55 pretendFailIsInfeasible_(rhs.pretendFailIsInfeasible_)
61 return new CbcFullNodeInfo(model,numberRowsAtContinuous);
66 int numberChangedBounds,
const int * variables,
67 const double * boundChanges,
68 const CoinWarmStartDiff *basisDiff)
const
71 boundChanges,basisDiff);
83 OsiSolverInterface * solver = model->solver();
86 int returnStatus = -1;
88 if (!bmNodeInfo)
return -1;
94 if (solver->isAbandoned()) {
99 else if (solver->isProvenPrimalInfeasible()) {
101 seqOfInfeasiblesSize++;
104 if (((seqOfUnsolvedSize==0) || (
maxFailure_ == 0)) &&
107 if (feasible && seqOfInfeasiblesSize > 1) {
108 (*model->messageHandler())<<
"Feasible node while father was infeasible."
112 if (solved && seqOfUnsolvedSize > 1) {
113 (*model->messageHandler())<<
"Solved node while father was unsolved."
118 solved && !feasible) {
119 (*model->messageHandler())<<
"Branching on infeasible node, sequence of infeasible size "
120 <<seqOfInfeasiblesSize<<CoinMessageEol;
129 if (!solved && parent != NULL &&
131 (*model->messageHandler())<<
"Branching on unsolved node, sequence of unsolved size "<<seqOfUnsolvedSize<<CoinMessageEol;
138 if (solver->isAbandoned() && parent != NULL &&
149 std::string probName;
virtual void setupCutGenerators(CbcModel &model)
Setup cut generators.
int getSequenceOfUnsolvedSize()
Number of consecutive unsolved parents only recorded if node is infeasible.
TNLPSolver::UnsolvedError * newUnsolvedError(int num, Ipopt::SmartPtr< TMINLP2TNLP > problem, std::string name)
Holds information for recreating a subproblem by incremental change from the parent for...
const TMINLP2TNLP * problem() const
get pointer to the TMINLP2TNLP adapter
This is class provides an Osi interface for a Mixed Integer Linear Program expressed as a TMINLP (so ...
void forceBranchable()
Force current solution to be branched on (make it fractionnal with small objective) ...
virtual CbcNodeInfo * fullNodeInfo(CbcModel *model, int numberRowsAtContinuous) const
Return a new Full node information pointer (descendant of CbcFullNodeInfo)
int maxInfeasible_
maximum number of consecutive infeasible nodes before giving up
virtual ~CbcNlpStrategy()
bool getStrParam(OsiStrParam key, std::string &value) const
virtual int status(CbcModel *model, CbcNodeInfo *parent, int whereFrom)
After a CbcModel::resolve this can return a status -1 no effect 0 treat as optimal 1 as 0 but do not ...
void forceInfeasible()
Force current solution to be infeasible.
virtual void setupPrinting(CbcModel &model, int modelLogLevel)
Do printing stuff.
int pretendFailIsInfeasible_
If yes when a problem is not solved (failed to be solved) will pretend that it is infeasible...
int getSequenceOfInfeasiblesSize()
Number of consecutive infeasible parents only recorded if node is infeasible.
virtual CbcStrategy * clone() const
Clone.
bool hasFailed_
did we fail?
virtual void setupOther(CbcModel &model)
Other stuff e.g. strong branching and preprocessing.
virtual CbcNodeInfo * partialNodeInfo(CbcModel *model, CbcNodeInfo *parent, CbcNode *owner, int numberChangedBounds, const int *variables, const double *boundChanges, const CoinWarmStartDiff *basisDiff) const
Return a new Partial node information pointer (descendant of CbcPartialNodeInfo)
int maxFailure_
maximum number of consecutive failures in a branch before giving up
virtual void setupHeuristics(CbcModel &model)
Setup heuristics.
CbcNlpStrategy(int maxFailures, int maxInfeasibles, int pretendFailIsInfeasible)