| 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 BonHeuristicInnerApproximation_HPP |
| 12 |
#define BonHeuristicInnerApproximation_HPP |
| 13 |
#include "BonOsiTMINLPInterface.hpp" |
| 14 |
#include "BonBonminSetup.hpp" |
| 15 |
#include "CbcHeuristic.hpp" |
| 16 |
#include "CbcStrategy.hpp" |
| 17 |
|
| 18 |
namespace Bonmin { |
| 19 |
class SubMipSolver; |
| 20 |
class HeuristicInnerApproximation: public CbcHeuristic { |
| 21 |
public: |
| 22 |
|
| 23 |
/// Constructor with setup |
| 24 |
HeuristicInnerApproximation(BonminSetup * setup); |
| 25 |
|
| 26 |
/// Copy constructor |
| 27 |
HeuristicInnerApproximation(const HeuristicInnerApproximation ©); |
| 28 |
|
| 29 |
/// Destructor |
| 30 |
~HeuristicInnerApproximation(); |
| 31 |
|
| 32 |
/// Assignment operator |
| 33 |
HeuristicInnerApproximation & operator=( |
| 34 |
const HeuristicInnerApproximation & rhs); |
| 35 |
|
| 36 |
/// Clone |
| 37 |
virtual CbcHeuristic * clone() const { |
| 38 |
return new HeuristicInnerApproximation(*this); |
| 39 |
} |
| 40 |
|
| 41 |
/// Initialize method |
| 42 |
void Initialize(BonminSetup * setup); |
| 43 |
|
| 44 |
/// Resets stuff if model changes |
| 45 |
virtual void resetModel(CbcModel * model) { |
| 46 |
setModel(model); |
| 47 |
} |
| 48 |
|
| 49 |
/// Performs heuristic |
| 50 |
virtual int solution(double &solutionValue, double *betterSolution); |
| 51 |
|
| 52 |
/** Register the options common to all local search based heuristics.*/ |
| 53 |
static void registerOptions( |
| 54 |
Ipopt::SmartPtr<Bonmin::RegisteredOptions> roptions); |
| 55 |
|
| 56 |
protected: |
| 57 |
/** Setup to use for local searches (will make copies).*/ |
| 58 |
BonminSetup * setup_; |
| 59 |
|
| 60 |
private: |
| 61 |
/// How often to do (code can change) |
| 62 |
int howOften_; |
| 63 |
|
| 64 |
/// A subsolver for MIP |
| 65 |
SubMipSolver * mip_; |
| 66 |
|
| 67 |
/// Number of Approximation points |
| 68 |
int nbAp_; |
| 69 |
|
| 70 |
void extractInnerApproximation(OsiTMINLPInterface & nlp, OsiSolverInterface &si, |
| 71 |
const double * x, bool getObj); |
| 72 |
|
| 73 |
bool getMyInnerApproximation(OsiTMINLPInterface &si, OsiCuts &cs, int ind, |
| 74 |
const double * x, const double * x2); |
| 75 |
|
| 76 |
|
| 77 |
}; |
| 78 |
} |
| 79 |
|
| 80 |
#endif |