Debian Codegraph @

Bonmin/src/Algorithms/OaGenerators/BonDummyHeuristic.cpp

raw
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 #include "BonDummyHeuristic.hpp"
11 #include "CoinHelperFunctions.hpp"
12 #include "CbcModel.hpp"
13
14 #include "OsiAuxInfo.hpp"
15 namespace Bonmin
16 {
17 /// Default constructor
18 DummyHeuristic::DummyHeuristic(CbcModel &model,
19 OsiTMINLPInterface * si)
20 :
21 CbcHeuristic(model),
22 nlp_(si),
23 knowsSolution(false)
24 {}
25
26 DummyHeuristic::DummyHeuristic(OsiTMINLPInterface * si)
27 :
28 CbcHeuristic(),
29 nlp_(si),
30 knowsSolution(false)
31 {}
32 /// Assign an OsiTMINLPInterface
33 void
34 DummyHeuristic::setNlp(OsiTMINLPInterface * si)
35 {
36 nlp_ = si;
37 }
38 /// heuristic method
39 int
40 DummyHeuristic::solution(double &solutionValue, double *betterSolution)
41 {
42 OsiBabSolver * babSolver = dynamic_cast<OsiBabSolver *>
43 (model_->solver()->getAuxiliaryInfo());
44 // double bestKnown = getObjValue();
45 if (babSolver) {
46 return babSolver->solution(solutionValue, betterSolution,
47 model_->getNumCols());
48 }
49 return 0;
50 }
51
52 }