| 1 |
// (C) Copyright International Business Machines Corporation and Carnegie Mellon University 2006 |
| 2 |
// All Rights Reserved. |
| 3 |
// This code is published under the Eclipse Public License. |
| 4 |
// |
| 5 |
// Authors : |
| 6 |
// John J. Forrest, International Business Machines Corporation |
| 7 |
// Pierre Bonami, Carnegie Mellon University, |
| 8 |
// |
| 9 |
// Date : 03/15/2006 |
| 10 |
|
| 11 |
#ifndef BonCbcNlpStrategy_H |
| 12 |
#define BonCbcNlpStrategy_H |
| 13 |
|
| 14 |
#include "CbcStrategy.hpp" |
| 15 |
class CglPreProcess; |
| 16 |
class CbcNodeInfo; |
| 17 |
class CbcNode; |
| 18 |
class CoinWarmStartDiff; |
| 19 |
|
| 20 |
|
| 21 |
namespace Bonmin |
| 22 |
{ |
| 23 |
class CbcNlpStrategy : public CbcStrategy |
| 24 |
{ |
| 25 |
public: |
| 26 |
|
| 27 |
// Default Constructor |
| 28 |
CbcNlpStrategy (int maxFailures, |
| 29 |
int maxInfeasibles, |
| 30 |
int pretendFailIsInfeasible); |
| 31 |
|
| 32 |
// Copy constructor |
| 33 |
CbcNlpStrategy ( const CbcNlpStrategy &); |
| 34 |
|
| 35 |
// Destructor |
| 36 |
virtual ~CbcNlpStrategy (); |
| 37 |
|
| 38 |
/// Clone |
| 39 |
virtual CbcStrategy * clone() const; |
| 40 |
|
| 41 |
/// Return a new Full node information pointer (descendant of CbcFullNodeInfo) |
| 42 |
virtual CbcNodeInfo * fullNodeInfo(CbcModel * model,int numberRowsAtContinuous) const; |
| 43 |
/// Return a new Partial node information pointer (descendant of CbcPartialNodeInfo) |
| 44 |
virtual CbcNodeInfo * partialNodeInfo(CbcModel * model, CbcNodeInfo * parent, CbcNode * owner, |
| 45 |
int numberChangedBounds,const int * variables, |
| 46 |
const double * boundChanges, |
| 47 |
const CoinWarmStartDiff *basisDiff) const; |
| 48 |
/** After a CbcModel::resolve this can return a status |
| 49 |
-1 no effect |
| 50 |
0 treat as optimal |
| 51 |
1 as 0 but do not do any more resolves (i.e. no more cuts) |
| 52 |
2 treat as infeasible |
| 53 |
*/ |
| 54 |
virtual int status(CbcModel * model, CbcNodeInfo * parent, int whereFrom); |
| 55 |
/// set maximum number of consecutive failures in a branch before giving up |
| 56 |
inline void setMaxFailure(int value) |
| 57 |
{ |
| 58 |
maxFailure_ = value; |
| 59 |
} |
| 60 |
/// maximum number of consecutive infeasible nodes before giving up |
| 61 |
inline void setMaxInfeasible(int value) |
| 62 |
{ |
| 63 |
maxInfeasible_ = value; |
| 64 |
} |
| 65 |
|
| 66 |
/// Setup cut generators |
| 67 |
virtual void setupCutGenerators(CbcModel & model); |
| 68 |
/// Setup heuristics |
| 69 |
virtual void setupHeuristics(CbcModel & model); |
| 70 |
/// Do printing stuff |
| 71 |
virtual void setupPrinting(CbcModel & model,int modelLogLevel); |
| 72 |
/// Other stuff e.g. strong branching and preprocessing |
| 73 |
virtual void setupOther(CbcModel & model); |
| 74 |
|
| 75 |
bool hasFailed() |
| 76 |
{ |
| 77 |
return hasFailed_; |
| 78 |
} |
| 79 |
protected: |
| 80 |
// Data |
| 81 |
/// did we fail? |
| 82 |
bool hasFailed_; |
| 83 |
/// maximum number of consecutive failures in a branch before giving up |
| 84 |
int maxFailure_; |
| 85 |
/// maximum number of consecutive infeasible nodes before giving up |
| 86 |
int maxInfeasible_; |
| 87 |
/** If yes when a problem is not solved (failed to be solved) |
| 88 |
will pretend that it is infeasible. */ |
| 89 |
int pretendFailIsInfeasible_; |
| 90 |
|
| 91 |
private: |
| 92 |
/// Illegal Assignment operator |
| 93 |
CbcNlpStrategy & operator=(const CbcNlpStrategy& rhs); |
| 94 |
|
| 95 |
}; |
| 96 |
} |
| 97 |
|
| 98 |
#endif |