| 1 |
// Copyright (C) 2010, International Business Machines Corporation and others. |
| 2 |
// All Rights Reserved. |
| 3 |
// This code is published under the Eclipse Public License. |
| 4 |
// |
| 5 |
// Authors : |
| 6 |
// Pierre Bonami CNRS |
| 7 |
// |
| 8 |
// Date : May, 26 2010 |
| 9 |
|
| 10 |
#ifndef BonMilpRounding_HPP |
| 11 |
#define BonMilpRounding_HPP |
| 12 |
#include "BonOsiTMINLPInterface.hpp" |
| 13 |
#include "BonBonminSetup.hpp" |
| 14 |
#include "CbcHeuristic.hpp" |
| 15 |
#include "CbcStrategy.hpp" |
| 16 |
#include "OsiCuts.hpp" |
| 17 |
|
| 18 |
namespace Bonmin |
| 19 |
{ |
| 20 |
class SubMipSolver; |
| 21 |
class MilpRounding : public CbcHeuristic |
| 22 |
{ |
| 23 |
public: |
| 24 |
|
| 25 |
/// Constructor with setup |
| 26 |
MilpRounding(BonminSetup * setup); |
| 27 |
|
| 28 |
/// Copy constructor |
| 29 |
MilpRounding(const MilpRounding ©); |
| 30 |
|
| 31 |
/// Destructor |
| 32 |
~MilpRounding(); |
| 33 |
|
| 34 |
/// Assignment operator |
| 35 |
MilpRounding & operator=(const MilpRounding & rhs); |
| 36 |
|
| 37 |
/// Clone |
| 38 |
virtual CbcHeuristic * clone() const{ |
| 39 |
return new MilpRounding(*this); |
| 40 |
} |
| 41 |
|
| 42 |
/// Initialize method |
| 43 |
void Initialize(BonminSetup * setup); |
| 44 |
|
| 45 |
/// Resets stuff if model changes |
| 46 |
virtual void resetModel(CbcModel * model){ |
| 47 |
setModel(model); |
| 48 |
} |
| 49 |
|
| 50 |
/** Change setup used for heuristic.*/ |
| 51 |
virtual void setSetup(BonminSetup * setup){ |
| 52 |
setup_ = setup; |
| 53 |
// Initialize(setup_->options()); |
| 54 |
} |
| 55 |
|
| 56 |
/// Performs heuristic |
| 57 |
virtual int solution(double &solutionValue, double *betterSolution); |
| 58 |
|
| 59 |
|
| 60 |
static void registerOptions(Ipopt::SmartPtr<Bonmin::RegisteredOptions> roptions); |
| 61 |
protected: |
| 62 |
/** Setup to use for local searches (will make copies).*/ |
| 63 |
BonminSetup * setup_; |
| 64 |
|
| 65 |
private: |
| 66 |
/// How often to do (code can change) |
| 67 |
int howOften_; |
| 68 |
/// A subsolver for MIP |
| 69 |
SubMipSolver * mip_; |
| 70 |
|
| 71 |
OsiCuts noGoods; |
| 72 |
}; |
| 73 |
} |
| 74 |
#endif |