Bonmin 1.8.9
Loading...
Searching...
No Matches
BonOaNlpOptim.hpp
Go to the documentation of this file.
1// (C) Copyright Carnegie Mellon University 2005, 2006
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 BonOaNlpOptim_HPP
11#define BonOaNlpOptim_HPP
12#include "CglCutGenerator.hpp"
14#include "BonOAMessages.hpp"
15#include "BonBabSetupBase.hpp"
16namespace Bonmin
17{
20 {
21 public:
24 int maxDepth = 10, bool addOnlyViolated = false,
25 bool globalCuts = true);
26
31 :
32 CglCutGenerator(copy),
33 nlp_(copy.nlp_),
34 maxDepth_(copy.maxDepth_),
35 nSolve_(0),
36 addOnlyViolated_(copy.addOnlyViolated_),
37 global_(copy.global_),
38 solves_per_level_(copy.solves_per_level_)
39 {
40 handler_ = new CoinMessageHandler();
41 handler_ -> setLogLevel(copy.handler_->logLevel());
42 messages_ = OaMessages();
43 }
45 {
46 delete handler_;
47 handler_ = handler->clone();
48 }
50 virtual CglCutGenerator * clone() const
51 {
52 return new OaNlpOptim(*this);
53 }
54
56 virtual ~OaNlpOptim()
57 {
58 if (handler_)
59 delete handler_;
60 }
61
65 virtual void generateCuts( const OsiSolverInterface & si, OsiCuts & cs,
66 const CglTreeInfo info);
67
68
69
70 inline void setMaxDepth(int value)
71 {
72 maxDepth_ = value;
73 }
74 inline void setAddOnlyViolated(bool yesno)
75 {
76 addOnlyViolated_ = yesno;
77 }
78 inline void setGlobalCuts(bool yesno)
79 {
80 global_ = yesno;
81 }
82 inline int getNSolve()
83 {
84 return nSolve_;
85 }
87 void setLogLevel(int value)
88 {
89 handler_->setLogLevel(value);
90 }
91
94
95 private:
97 OsiTMINLPInterface * nlp_;
98
100 int maxDepth_;
101
103 mutable int nSolve_;
105 CoinMessageHandler * handler_;
107 CoinMessages messages_;
109 bool addOnlyViolated_;
111 bool global_;
113 double solves_per_level_;
114 };
115}
116#endif
A class to have all elements necessary to setup a branch-and-bound.
Output messages for Outer approximation cutting planes.
Generate cuts for the nlp corresponding to continuous relaxation at a node.
OaNlpOptim(BabSetupBase &b)
Constructor with basic setup.
void setLogLevel(int value)
set log level
void passInMessageHandler(const CoinMessageHandler *handler)
OaNlpOptim(OsiTMINLPInterface *si=NULL, int maxDepth=10, bool addOnlyViolated=false, bool globalCuts=true)
Default constructor.
virtual ~OaNlpOptim()
Desctructor.
void setAddOnlyViolated(bool yesno)
void assignInterface(OsiTMINLPInterface *si)
Assign an OsiTMINLPInterface.
static void registerOptions(Ipopt::SmartPtr< Bonmin::RegisteredOptions > roptions)
Register OaNlpOptim options.
void setGlobalCuts(bool yesno)
void setMaxDepth(int value)
OaNlpOptim(const OaNlpOptim &copy)
Copy constructor.
virtual void generateCuts(const OsiSolverInterface &si, OsiCuts &cs, const CglTreeInfo info)
cut generation method
virtual CglCutGenerator * clone() const
Abstract constructor.
This is class provides an Osi interface for a Mixed Integer Linear Program expressed as a TMINLP (so ...
void setLogLevel(int value)
virtual CoinMessageHandler * clone() const
int logLevel() const
(C) Copyright International Business Machines Corporation 2007