| 1 |
// (C) Copyright Carnegie Mellon University 2005 |
| 2 |
// All Rights Reserved. |
| 3 |
// This code is published under the Eclipse Public License. |
| 4 |
// |
| 5 |
// Authors : |
| 6 |
// P. Bonami, Carnegie Mellon University |
| 7 |
// |
| 8 |
// Date : 05/26/2005 |
| 9 |
|
| 10 |
#ifndef BonDummyHeuristic_HPP |
| 11 |
#define BonDummyHeuristic_HPP |
| 12 |
#include "BonOsiTMINLPInterface.hpp" |
| 13 |
|
| 14 |
#include "CbcHeuristic.hpp" |
| 15 |
namespace Bonmin |
| 16 |
{ |
| 17 |
class DummyHeuristic : public CbcHeuristic |
| 18 |
{ |
| 19 |
public: |
| 20 |
/// Default constructor |
| 21 |
DummyHeuristic(OsiTMINLPInterface * si = NULL); |
| 22 |
/// Usefull constructor |
| 23 |
DummyHeuristic(CbcModel &model, OsiTMINLPInterface * si = NULL); |
| 24 |
///Copy constructor |
| 25 |
DummyHeuristic( const DummyHeuristic ©): |
| 26 |
CbcHeuristic(copy), |
| 27 |
nlp_(copy.nlp_), |
| 28 |
knowsSolution(copy.knowsSolution) |
| 29 |
{} |
| 30 |
/// Set nlp_ |
| 31 |
void setNlp(OsiTMINLPInterface * si); |
| 32 |
/// heuristic method |
| 33 |
virtual int solution(double &solutionValue, double *betterSolution); |
| 34 |
virtual int solution(double &solutionValue, double *betterSolution, OsiCuts & cs) |
| 35 |
{ |
| 36 |
return solution(solutionValue, betterSolution); |
| 37 |
} |
| 38 |
virtual CbcHeuristic * clone()const |
| 39 |
{ |
| 40 |
return new DummyHeuristic(*this); |
| 41 |
} |
| 42 |
virtual void resetModel(CbcModel*) |
| 43 |
{} |
| 44 |
virtual bool shouldHeurRun(int whereFrom){ |
| 45 |
return true;} |
| 46 |
private: |
| 47 |
/// Pointer to the Ipopt interface |
| 48 |
OsiTMINLPInterface * nlp_; |
| 49 |
/// Do I have a solution? |
| 50 |
bool knowsSolution; |
| 51 |
}; |
| 52 |
} |
| 53 |
#endif |