| 1 |
// (C) Copyright International Business Machines Corporation 2007 |
| 2 |
// All Rights Reserved. |
| 3 |
// This code is published under the Eclipse Public License. |
| 4 |
// |
| 5 |
// Authors : |
| 6 |
// Pierre Bonami, International Business Machines Corporation |
| 7 |
// |
| 8 |
// Date : 04/13/2007 |
| 9 |
#ifndef BonminSetup_H |
| 10 |
#define BonminSetup_H |
| 11 |
#include "BonBabSetupBase.hpp" |
| 12 |
namespace Bonmin |
| 13 |
{ |
| 14 |
/** Type of algorithms which can be used.*/ |
| 15 |
enum Algorithm{ |
| 16 |
Dummy=-1/** Dummy value before initialization.*/, |
| 17 |
B_BB=0/** Bonmin's Branch-and-bound.*/, |
| 18 |
B_OA=1/** Bonmin's Outer Approximation Decomposition.*/, |
| 19 |
B_QG=2/** Bonmin's Quesada & Grossmann branch-and-cut.*/, |
| 20 |
B_Hyb=3/** Bonmin's hybrid outer approximation.*/, |
| 21 |
B_Ecp=4/** Bonmin's implemantation of ecp cuts based branch-and-cut a la FilMINT.*/, |
| 22 |
B_IFP=5/** Bonmin's implemantation of iterated feasibility pump for MINLP.*/ |
| 23 |
}; |
| 24 |
/* Bonmin algorithm setup. */ |
| 25 |
class BonminSetup : public BabSetupBase |
| 26 |
{ |
| 27 |
public: |
| 28 |
/** Default constructor. */ |
| 29 |
BonminSetup(const CoinMessageHandler * handler = NULL); |
| 30 |
/** Copy constructor. */ |
| 31 |
BonminSetup(const BonminSetup & other); |
| 32 |
|
| 33 |
/** Copy but uses an other nlp.*/ |
| 34 |
BonminSetup(const BonminSetup &setup, |
| 35 |
OsiTMINLPInterface &nlp); |
| 36 |
|
| 37 |
/** Copy but uses another nlp and algorithm.*/ |
| 38 |
BonminSetup(const BonminSetup &setup, |
| 39 |
OsiTMINLPInterface &nlp, |
| 40 |
const std::string & prefix); |
| 41 |
/** virtual copy constructor. */ |
| 42 |
virtual BabSetupBase * clone() const |
| 43 |
{ |
| 44 |
return new BonminSetup(*this); |
| 45 |
} |
| 46 |
/** Make a copy with solver replace by one passed .*/ |
| 47 |
// virtual BabSetupBase *clone(OsiTMINLPInterface&nlp)const{ |
| 48 |
// return new BonminSetup(*this, nlp); |
| 49 |
// } |
| 50 |
/** Make a copy with solver replace by one passed .*/ |
| 51 |
BonminSetup *clone(OsiTMINLPInterface&nlp)const{ |
| 52 |
return new BonminSetup(*this, nlp); |
| 53 |
} |
| 54 |
/** Make a copy but take options with different prefix.*/ |
| 55 |
BonminSetup *clone(OsiTMINLPInterface &nlp, const std::string & prefix)const{ |
| 56 |
return new BonminSetup(*this, nlp, prefix); |
| 57 |
} |
| 58 |
virtual ~BonminSetup() |
| 59 |
{} |
| 60 |
/** @name Methods to instantiate: Registering and retrieving options and initializing everything. */ |
| 61 |
/** @{ */ |
| 62 |
/** Register all the options for this algorithm instance.*/ |
| 63 |
virtual void registerOptions(); |
| 64 |
/** Setup the defaults options for this algorithm. */ |
| 65 |
virtual void setBabDefaultOptions(Ipopt::SmartPtr<Bonmin::RegisteredOptions> roptions) |
| 66 |
{} |
| 67 |
/** @} */ |
| 68 |
/** Register all bonmin type executable options.*/ |
| 69 |
static void registerAllOptions(Ipopt::SmartPtr<Bonmin::RegisteredOptions> roptions); |
| 70 |
/** Initialize, read options and create appropriate bonmin setup.*/ |
| 71 |
void initialize(Ipopt::SmartPtr<TMINLP> tminlp, bool createContinuousSolver = true); |
| 72 |
/** Initialize, read options and create appropriate bonmin setup.*/ |
| 73 |
void initialize(const OsiTMINLPInterface& nlpSi, bool createContinuousSolver = true); |
| 74 |
/** Get the algorithm used.*/ |
| 75 |
Bonmin::Algorithm getAlgorithm(); |
| 76 |
|
| 77 |
void addCutGenerator(CuttingMethod & cg){ |
| 78 |
BabSetupBase::addCutGenerator(cg); |
| 79 |
} |
| 80 |
protected: |
| 81 |
/** Register standard MILP cut generators. */ |
| 82 |
static void registerMilpCutGenerators(Ipopt::SmartPtr<Bonmin::RegisteredOptions> roptions); |
| 83 |
/** Add milp cut generators according to options.*/ |
| 84 |
void addMilpCutGenerators(); |
| 85 |
/** Initialize a plain branch-and-bound.*/ |
| 86 |
void initializeBBB(); |
| 87 |
/** Initialize a branch-and-cut with some OA.*/ |
| 88 |
void initializeBHyb(bool createContinuousSolver = false); |
| 89 |
private: |
| 90 |
Algorithm algo_; |
| 91 |
}; |
| 92 |
}/** end namespace Bonmin*/ |
| 93 |
|
| 94 |
#endif |
| 95 |
|