Bonmin 1.8.9
Loading...
Searching...
No Matches
BonLocalSolverBasedHeuristic.hpp
Go to the documentation of this file.
1// (C) Copyright CNRS
2// This code is published under the Eclipse Public License.
3//
4// Authors :
5// Pierre Bonami, LIF Université de la Méditérannée-CNRS
6//
7// Date : 06/18/2008
8
9#ifndef BonLocalSolverBasedHeuristic_H
10#define BonLocalSolverBasedHeuristic_H
11#include "BonBonminSetup.hpp"
12#include "CbcHeuristic.hpp"
13
14namespace Bonmin {
15 class LocalSolverBasedHeuristic : public CbcHeuristic {
16 public:
19
22
25
28
30 virtual CbcHeuristic * clone() const = 0;
31
34
35#if 0
37 virtual void setModel(CbcModel * model){throw -1;}
38#endif
40 virtual void resetModel(CbcModel * model){
41 setModel(model);
42 }
43
45 void setSetup(BonminSetup * setup){
46 setup_ = setup;
48 }
50 virtual int solution(double & objectiveValue,
51 double * newSolution)=0;
52
54 virtual int solution(double & objectiveValue,
55 double * newSolution,
56 OsiCuts & cs) {return 0;}
57
58
61 double *solution,
62 double & solValue,
63 double cutoff, std::string prefix = "local_solver.") const;
64
67
70
73 protected:
76
78 std::string prefix,
79 const std::string &option,
80 const std::string &value);
81
83 std::string prefix,
84 const std::string &option,
85 const double &value);
86
88 std::string prefix,
89 const std::string &option,
90 const int &value);
91 private:
93 double time_limit_;
95 int max_number_nodes_;
97 int max_number_solutions_;
98 };
99}
101#endif
102
Ipopt::SmartPtr< Ipopt::OptionsList > options()
Acces list of Options.
static void registerOptions(Ipopt::SmartPtr< Bonmin::RegisteredOptions > roptions)
Register the options common to all local search based heuristics.
LocalSolverBasedHeuristic & operator=(const LocalSolverBasedHeuristic &rhs)
Assignment operator.
static void changeIfNotSet(Ipopt::SmartPtr< Ipopt::OptionsList > options, std::string prefix, const std::string &option, const double &value)
static void changeIfNotSet(Ipopt::SmartPtr< Ipopt::OptionsList > options, std::string prefix, const std::string &option, const int &value)
virtual int solution(double &objectiveValue, double *newSolution)=0
Performs heuristic
void Initialize(Ipopt::SmartPtr< Ipopt::OptionsList > options)
Initiaize using passed options.
LocalSolverBasedHeuristic(const LocalSolverBasedHeuristic &other)
Copy constructor.
virtual void setupDefaults(Ipopt::SmartPtr< Ipopt::OptionsList > options)
Setup the defaults.
void setSetup(BonminSetup *setup)
Change setup used for heuristic.
virtual CbcHeuristic * clone() const =0
Virtual copy constructor.
int doLocalSearch(OsiTMINLPInterface *solver, double *solution, double &solValue, double cutoff, std::string prefix="local_solver.") const
Do a local search based on setup and passed solver.
BonminSetup * setup_
Setup to use for local searches (will make copies).
virtual int solution(double &objectiveValue, double *newSolution, OsiCuts &cs)
Performs heuristic which adds cuts
static void changeIfNotSet(Ipopt::SmartPtr< Ipopt::OptionsList > options, std::string prefix, const std::string &option, const std::string &value)
LocalSolverBasedHeuristic()
Default constructor.
virtual void resetModel(CbcModel *model)
Resets stuff if model changes.
LocalSolverBasedHeuristic(BonminSetup *setup)
Constructor with setup.
This is class provides an Osi interface for a Mixed Integer Linear Program expressed as a TMINLP (so ...
(C) Copyright International Business Machines Corporation 2007