Couenne 0.5.8
CouenneFeasPump.hpp
Go to the documentation of this file.
1/* $Id: CouenneFeasPump.hpp 1071 2014-03-13 01:35:13Z pbelotti $
2 *
3 * Name: CouenneFeasPump.hpp
4 * Authors: Pietro Belotti
5 * Timo Berthold, ZIB Berlin
6 * Purpose: Define the Feasibility Pump heuristic class
7 * Created: August 5, 2009
8 *
9 * This file is licensed under the Eclipse Public License (EPL)
10 */
11
12#ifndef CouenneFeasPump_HPP
13#define CouenneFeasPump_HPP
14
15#include <queue>
16
17#include "CouenneTypes.hpp"
18#include "CbcHeuristic.hpp"
19#include "CouenneFPpool.hpp"
20#include "IpOptionsList.hpp"
21
22#ifdef COIN_HAS_SCIP
23#include "scip/scip.h"
24#endif
25
26struct Scip;
28
29//
30// A fading coefficient decreases from a to a^k at every iteration if
31// a > 0. If a is negative, then it increases from 1-|a| = 1+a to
32// 1-|a|^k and eventually converges to 1
33//
34
35inline double fadingCoeff (double a)
36{return (a<0) ? a+1 : a;}
37
38namespace Ipopt {
39 class IpoptApplication;
40}
41
42namespace Bonmin {
43 class RegisteredOptions;
44}
45
46namespace Couenne {
47
48 class expression;
49 class CouenneProblem;
50 class CouenneCutGenerator;
51 class CouenneTNLP;
52 class CouenneSparseMatrix;
53
56
58
59 public:
60
64
67 CouenneCutGenerator *cg = NULL,
69
72
75
77 virtual CbcHeuristic *clone () const;
78
81
83 virtual void resetModel (CbcModel *model) {}
84
92 virtual int solution (double &objectiveValue, double *newSolution);
93
95 void setNumberSolvePerLevel (int value)
96 {numberSolvePerLevel_ = value;}
97
98#ifdef COIN_HAS_SCIP
100 void checkInfinity (struct Scip *scip, double val, double infinity);
101#endif
102
106 virtual CouNumber solveMILP (const CouNumber *nSol, CouNumber *&iSol, int niter, int* nsuciter);
107
109 virtual CouNumber solveNLP (const CouNumber *nSol, CouNumber *&iSol);
110
114 expression *updateNLPObj (const double *);
115
119 bool fixIntVariables (const double *sol);
120
123
125 double findSolution (const double *nSol, double *&sol, int niter, int* nsuciter);
126
129 void init_MILP ();
130
133
136 {return problem_;}
137
140 {return compDistInt_;}
141
144
145 double multDistNLP () const {return fadingCoeff (multDistNLP_);}
146 double multHessNLP () const {return fadingCoeff (multHessNLP_);}
147 double multObjFNLP () const {return fadingCoeff (multObjFNLP_);}
148
149 double multDistMILP () const {return fadingCoeff (multDistMILP_);}
150 double multHessMILP () const {return fadingCoeff (multHessMILP_);}
151 double multObjFMILP () const {return fadingCoeff (multObjFMILP_);}
152
154 CouenneTNLP *nlp () const
155 {return nlp_;}
156
158 int &nCalls ()
159 {return nCalls_;}
160
162 int milpPhase (double *nSol, double *iSol);
163
165 int nlpPhase (double *iSol, double *nSol);
166
167#ifdef COIN_HAS_SCIP
168 SCIP_RETCODE ScipSolve (const double *nSol, double* &sol, int niter, int* nsuciter, CouNumber &obj);
169#endif
170
171 private:
172
173 //
174 // ESSENTIAL TOOLS for the FP: a problem pointer and one for the
175 // linearization cut generator
176 //
177
179 CouenneProblem *problem_;
180
182 CouenneCutGenerator *couenneCG_;
183
184 //
185 // PERSISTENT OBJECTS
186 //
187 // (not necessary to identify FP, but useful to keep between
188 // calls)
189 //
190
193 CouenneTNLP *nlp_;
194
197
200 OsiSolverInterface *milp_;
201
205 OsiSolverInterface *postlp_;
206
208 CouenneFPpool *pool_;
209
211 std::set <CouenneFPsolution, compareSol> tabuPool_;
212
214 int *match_;
215
216 //
217 // PARAMETERS
218 //
219
221 int numberSolvePerLevel_;
222
225
226 double multDistNLP_;
227 double multHessNLP_;
228 double multObjFNLP_;
229
230 double multDistMILP_;
231 double multHessMILP_;
232 double multObjFMILP_;
233
235 enum fpCompDistIntType compDistInt_;
236
238 enum fpCutPlane milpCuttingPlane_;
239
241 int nSepRounds_;
242
244 int maxIter_;
245
247 bool useSCIP_;
248
250 int milpMethod_;
251
253 enum fpTabuMgtPolicy tabuMgt_;
254
256 int nCalls_;
257
259 double fadeMult_;
260 };
261}
262
263#endif
double fadingCoeff(double a)
Cut Generator for linear convexifications.
Pool of solutions.
An implementation of the Feasibility pump that uses linearization and Ipopt to find the two sequences...
CouenneProblem * Problem() const
return pointer to problem
static void registerOptions(Ipopt::SmartPtr< Bonmin::RegisteredOptions >)
initialize options to be read later
virtual CouNumber solveNLP(const CouNumber *nSol, CouNumber *&iSol)
obtain solution to NLP
CouenneFeasPump(CouenneProblem *couenne=NULL, CouenneCutGenerator *cg=NULL, Ipopt::SmartPtr< Ipopt::OptionsList > options=NULL)
Constructor with (optional) MINLP pointer.
double multDistMILP() const
weight of distance in MILP
int milpPhase(double *nSol, double *iSol)
MILP phase of the FP.
CouenneFeasPump(const CouenneFeasPump &other)
Copy constructor.
double multObjFNLP() const
weight of objective in NLP
bool fixIntVariables(const double *sol)
admits a (possibly fractional) solution and fixes the integer components in the nonlinear problem for...
CouenneTNLP * nlp() const
return NLP
virtual int solution(double &objectiveValue, double *newSolution)
Run heuristic, return 1 if a better solution than the one passed is found and 0 otherwise.
virtual ~CouenneFeasPump()
Destructor.
void setNumberSolvePerLevel(int value)
set number of nlp's solved for each given level of the tree
expression * updateNLPObj(const double *)
set new expression as the NLP objective function using argument as point to minimize distance from.
double multHessMILP() const
weight of Hessian in MILP
double findSolution(const double *nSol, double *&sol, int niter, int *nsuciter)
find feasible solution (called by solveMILP ())
virtual CouNumber solveMILP(const CouNumber *nSol, CouNumber *&iSol, int niter, int *nsuciter)
find integer (possibly NLP-infeasible) point isol closest (according to the l-1 norm of the hessian) ...
int & nCalls()
return number of calls (can be changed)
double multDistNLP() const
Return Weights in computing distance, in both MILP and NLP (must sum up to 1 for MILP and for NLP):
CouenneFeasPump & operator=(const CouenneFeasPump &rhs)
Assignment operator.
virtual CbcHeuristic * clone() const
Clone.
enum fpCompDistIntType compDistInt() const
return type of MILP solved
void init_MILP()
initialize all solvers at the first call, where the initial MILP is built
int nlpPhase(double *iSol, double *nSol)
NLP phase of the FP.
double multHessNLP() const
weight of Hessian in NLP
virtual void resetModel(CbcModel *model)
Does nothing, but necessary as CbcHeuristic declares it pure virtual.
void initIpoptApp()
Common code for initializing non-smartptr ipopt application.
double multObjFMILP() const
weight of objective in MILP
Class for MINLP problems with symbolic information.
Class for handling NLPs using CouenneProblem.
Definition: CouenneTNLP.hpp:27
Expression base class.
general include file for different compilers
double CouNumber
main number type in Couenne