| 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 : 10/06/2007 |
| 9 |
|
| 10 |
#ifndef BonLinearCutsGenerator_H |
| 11 |
#define BonLinearCutsGenerator_H |
| 12 |
|
| 13 |
#include "CglCutGenerator.hpp" |
| 14 |
#include "CoinSmartPtr.hpp" |
| 15 |
#include "BonOuterApprox.hpp" |
| 16 |
#include "BonBonminSetup.hpp" |
| 17 |
#include <list> |
| 18 |
|
| 19 |
namespace Bonmin { |
| 20 |
class LinearCutsGenerator : public CglCutGenerator { |
| 21 |
public: |
| 22 |
/** Type for cut generation method with its frequency and string identification. */ |
| 23 |
struct CuttingMethod : public Coin::ReferencedObject |
| 24 |
{ |
| 25 |
int frequency; |
| 26 |
std::string id; |
| 27 |
CglCutGenerator * cgl; |
| 28 |
bool atSolution; |
| 29 |
bool normal; |
| 30 |
CuttingMethod(): |
| 31 |
atSolution(false), |
| 32 |
normal(true) |
| 33 |
{} |
| 34 |
|
| 35 |
CuttingMethod(const CuttingMethod & other): |
| 36 |
frequency(other.frequency), |
| 37 |
id(other.id), |
| 38 |
cgl(other.cgl), |
| 39 |
atSolution(other.atSolution), |
| 40 |
normal(other.normal) |
| 41 |
{} |
| 42 |
}; |
| 43 |
LinearCutsGenerator(): |
| 44 |
CglCutGenerator(), |
| 45 |
methods_(){ |
| 46 |
} |
| 47 |
|
| 48 |
|
| 49 |
LinearCutsGenerator(const LinearCutsGenerator & other): |
| 50 |
CglCutGenerator(other), |
| 51 |
methods_(other.methods_){ |
| 52 |
} |
| 53 |
|
| 54 |
CglCutGenerator * clone() const { |
| 55 |
return new LinearCutsGenerator(*this); |
| 56 |
} |
| 57 |
|
| 58 |
virtual ~LinearCutsGenerator(){ |
| 59 |
} |
| 60 |
|
| 61 |
bool needsOptimalBasis() { return false;} |
| 62 |
|
| 63 |
void initialize(BabSetupBase& s); |
| 64 |
|
| 65 |
void generateCuts(const OsiSolverInterface &solver, OsiCuts &cs, |
| 66 |
const CglTreeInfo info = CglTreeInfo()); |
| 67 |
|
| 68 |
private: |
| 69 |
std::list<Coin::SmartPtr<CuttingMethod> > methods_; |
| 70 |
}; |
| 71 |
|
| 72 |
}/* Ends Bonmin namespace.*/ |
| 73 |
|
| 74 |
#endif |
| 75 |
|