| 1 |
// (C) Copyright CNRS and others 2010 |
| 2 |
// All Rights Reserved. |
| 3 |
// This code is published under the Eclipse Public License. |
| 4 |
// |
| 5 |
// Authors : |
| 6 |
// Pierre Bonami, Université de la Méditérannée |
| 7 |
// Hassan Hijazi, Orange Labs |
| 8 |
// |
| 9 |
// Date : 05/22/2010 |
| 10 |
|
| 11 |
#ifndef SepaSetup_H |
| 12 |
#define SepaSetup_H |
| 13 |
#include "BonBonminSetup.hpp" |
| 14 |
#include "BonAmplSetup.hpp" |
| 15 |
namespace Sepa |
| 16 |
{ |
| 17 |
/** algorithm setup. */ |
| 18 |
class SepaSetup : public Bonmin::BonminSetup |
| 19 |
{ |
| 20 |
public: |
| 21 |
/** Default constructor. */ |
| 22 |
SepaSetup(const CoinMessageHandler * handler = NULL); |
| 23 |
/** Copy constructor. */ |
| 24 |
SepaSetup(const SepaSetup & other); |
| 25 |
|
| 26 |
/** Copy but uses an other nlp.*/ |
| 27 |
SepaSetup(const SepaSetup &setup, |
| 28 |
Bonmin::OsiTMINLPInterface &nlp); |
| 29 |
|
| 30 |
/** Copy but uses another nlp and algorithm.*/ |
| 31 |
SepaSetup(const SepaSetup &setup, |
| 32 |
Bonmin::OsiTMINLPInterface &nlp, |
| 33 |
const std::string & prefix); |
| 34 |
/** virtual copy constructor. */ |
| 35 |
virtual BabSetupBase * clone() const |
| 36 |
{ |
| 37 |
return new SepaSetup(*this); |
| 38 |
} |
| 39 |
/** Make a copy with solver replace by one passed .*/ |
| 40 |
// virtual BabSetupBase *clone(OsiTMINLPInterface&nlp)const{ |
| 41 |
// return new SepaSetup(*this, nlp); |
| 42 |
// } |
| 43 |
/** Make a copy with solver replace by one passed .*/ |
| 44 |
SepaSetup *clone(Bonmin::OsiTMINLPInterface&nlp)const{ |
| 45 |
return new SepaSetup(*this, nlp); |
| 46 |
} |
| 47 |
/** Make a copy but take options with different prefix.*/ |
| 48 |
SepaSetup *clone(Bonmin::OsiTMINLPInterface &nlp, const std::string & prefix)const{ |
| 49 |
return new SepaSetup(*this, nlp, prefix); |
| 50 |
} |
| 51 |
virtual ~SepaSetup() |
| 52 |
{} |
| 53 |
/** @name Methods to instantiate: Registering and retrieving options and initializing everything. */ |
| 54 |
/** @{ */ |
| 55 |
/** Register all the options for this algorithm instance.*/ |
| 56 |
virtual void registerOptions(); |
| 57 |
/** @} */ |
| 58 |
/** Register all bonmin type executable options.*/ |
| 59 |
static void registerAllOptions(Ipopt::SmartPtr<Bonmin::RegisteredOptions> roptions); |
| 60 |
/** Initialize, read options and create appropriate bonmin setup.*/ |
| 61 |
void initialize(Ipopt::SmartPtr<Bonmin::TMINLP> tminlp, bool createContinuousSolver = true); |
| 62 |
/** Initialize, read options and create appropriate bonmin setup.*/ |
| 63 |
void initialize(const Bonmin::OsiTMINLPInterface& nlpSi, bool createContinuousSolver = true); |
| 64 |
|
| 65 |
/** Ampl initialization*/ |
| 66 |
void initialize(char **& argv) |
| 67 |
{ |
| 68 |
readOptionsFile(); |
| 69 |
/* Read the model.*/ |
| 70 |
Ipopt::SmartPtr<Bonmin::AmplTMINLP> model = new Bonmin::AmplTMINLP(ConstPtr(journalist()), roptions(), options(), |
| 71 |
argv, NULL, "bonmin", NULL); |
| 72 |
mayPrintDoc(); |
| 73 |
initialize(Ipopt::GetRawPtr(model), true); |
| 74 |
} |
| 75 |
|
| 76 |
|
| 77 |
|
| 78 |
protected: |
| 79 |
/** Initialize a branch-and-cut with some OA.*/ |
| 80 |
void initializeSepa(); |
| 81 |
}; |
| 82 |
}/** end namespace Bonmin*/ |
| 83 |
|
| 84 |
#endif |
| 85 |
|