Couenne 0.5.8
Loading...
Searching...
No Matches
CouenneIterativeRounding.hpp
Go to the documentation of this file.
1// (C) Copyright International Business Machines Corporation 2007
2// All Rights Reserved.
3// This code is published under the Eclipse Public License (EPL).
4//
5// Authors :
6// Giacomo Nannicini, Tepper School of Business, Carnegie Mellon University
7//
8// Date : 07/25/2010
9
10#ifndef COUENNEITERATIVEROUNDING_HPP
11#define COUENNEITERATIVEROUNDING_HPP
12
13#include "CouenneConfig.h"
14#include "CbcHeuristic.hpp"
16
17#ifdef COIN_HAS_CPX
19#else
20#include "CbcHeuristicFPump.hpp"
21#include "CbcHeuristicRINS.hpp"
24#endif
25
27#include "CouenneProblem.hpp"
28
29namespace Couenne{
30
35
37
38 public:
43 OsiSolverInterface* cinlp,
44 CouenneProblem* couenne,
48
51
53 virtual CbcHeuristic * clone() const;
54
57
60
63 couenne_ = couenne;
64 }
65
67 void resetModel(CbcModel * model){}
76 int solution(double & objectiveValue, double * newSolution);
77
79 void setMaxRoundingIter(int value){
80 maxRoundingIter_ = value;
81 }
82
84 void setMaxFirPoints(int value){
85 maxFirPoints_ = value;
86 }
87
89 void setMaxTime(double value){
90 maxTime_ = value;
91 }
92
94 void setMaxTimeFirstCall(double value){
95 maxTimeFirstCall_ = value;
96 }
97
102 void setOmega(double value){
103 omega_ = value;
104 }
105
109 void setBaseLbRhs(int value){
110 baseLbRhs_ = value;
111 }
112
124 void setAggressiveness(int value);
125
127 static void registerOptions (Ipopt::SmartPtr <Bonmin::RegisteredOptions>);
128
129private:
133 OsiSolverInterface * cinlp_;
135#ifdef COIN_HAS_CPX
136 OsiCpxSolverInterface * milp_;
137#else
138 OsiClpSolverInterface * milp_;
139#endif
141 int maxRoundingIter_;
143 int maxFirPoints_;
145 double maxTime_;
147 double maxTimeFirstCall_;
149 int numInitialRows_;
151 int numSol_;
153 int numIntegers_;
156 double* colLower_;
157 double* colUpper_;
160 double* colLowerNlp_;
161 double* colUpperNlp_;
162#ifndef COIN_HAS_CPX
164 CbcHeuristic** heuristics_;
165 int numHeuristics_;
166#endif
168 double startTime_;
170 double endTime_;
173 double omega_;
175 int baseLbRhs_;
176
178 CouenneProblem * couenne_;
179
181 inline bool areEqual(double a, double b){
182 return (fabs(a-b) <= COUENNE_EPS);
183 }
184
185 /* Try to find a first feasible solution */
186 int feasibilityIR(double& objectiveValue, double* newSolution);
187
188 /* Try to improve a given solution */
189 int improvementIR(double& objectiveValue, double* newSolution,
190 const double* startingSolution);
191
193 void setMilp();
194
197 int computeIntAtBound(const double* x);
198
202 int computeIntAtBound(const double* x, double& avgBoundSize);
203
205 void writeLB(OsiRowCut& cut, const double* x, char sense, double rhs);
206
208 int branchToCut(const double* x, OsiSolverInterface* solver,
209 std::vector<int>& previousBranches);
210
212 bool solveMilp(OsiSolverInterface* milp, double maxTime);
213 };
214}/* Ends namespace Couenne. */
215
216#endif
217
#define COUENNE_EPS
virtual CbcHeuristic * clone() const
Clone.
void setOmega(double value)
Set the value for omega, the multiplicative factor for the minimum log-barrier parameter mu used by F...
void setMaxTimeFirstCall(double value)
Set maximum CPU time for the heuristic at the root node only.
static void registerOptions(Ipopt::SmartPtr< Bonmin::RegisteredOptions >)
initialize options to be read later
void setMaxFirPoints(int value)
Set maximum number of points that we try to round in F-IR.
void setBaseLbRhs(int value)
Set the base value for the rhs of the local branching constraint in the I-IR heuristic.
void resetModel(CbcModel *model)
Does nothing.
void setMaxRoundingIter(int value)
Set maximum number of iterations for each rounding phase.
CouenneIterativeRounding()
Default constructor.
CouenneIterativeRounding(const CouenneIterativeRounding &other)
Copy constructor.
void setCouenneProblem(CouenneProblem *couenne)
Set the couenne problem to use.
void setNlp(Bonmin::OsiTMINLPInterface *nlp, OsiSolverInterface *cinlp)
Set the minlp solver.
void setMaxTime(double value)
Set maximum CPU time for the heuristic at each node.
virtual ~CouenneIterativeRounding()
Destructor.
void setAggressiveness(int value)
Set aggressiveness of heuristic.
CouenneIterativeRounding & operator=(const CouenneIterativeRounding &rhs)
Assignment operator.
int solution(double &objectiveValue, double *newSolution)
Run heuristic, return 1 if a better solution than the one passed is found and 0 otherwise.
CouenneIterativeRounding(Bonmin::OsiTMINLPInterface *nlp, OsiSolverInterface *cinlp, CouenneProblem *couenne, Ipopt::SmartPtr< Ipopt::OptionsList > options)
Constructor with model and Couenne problems.
Class for MINLP problems with symbolic information.
general include file for different compilers