CouenneFeasPump.hpp
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #ifndef CouenneFeasPump_HPP
00013 #define CouenneFeasPump_HPP
00014
00015 #include <queue>
00016
00017 #include "CouenneTypes.hpp"
00018 #include "CbcHeuristic.hpp"
00019 #include "CouenneFPpool.hpp"
00020 #include "IpOptionsList.hpp"
00021
00022 #ifdef COIN_HAS_SCIP
00023 #include "scip/scip.h"
00024 #endif
00025
00026 struct Scip;
00027 class OsiSolverInterface;
00028
00029
00030
00031
00032
00033
00034
00035 inline double fadingCoeff (double a)
00036 {return (a<0) ? a+1 : a;}
00037
00038 namespace Ipopt {
00039 class IpoptApplication;
00040 }
00041
00042 namespace Bonmin {
00043 class RegisteredOptions;
00044 }
00045
00046 namespace Couenne {
00047
00048 class expression;
00049 class CouenneProblem;
00050 class CouenneCutGenerator;
00051 class CouenneTNLP;
00052 class CouenneSparseMatrix;
00053
00056
00057 class CouenneFeasPump: public CbcHeuristic {
00058
00059 public:
00060
00061 enum fpCompDistIntType {FP_DIST_INT, FP_DIST_ALL, FP_DIST_POST};
00062 enum fpCutPlane {FP_CUT_NONE, FP_CUT_INTEGRATED, FP_CUT_EXTERNAL, FP_CUT_POST};
00063 enum fpTabuMgtPolicy {FP_TABU_NONE, FP_TABU_POOL, FP_TABU_PERTURB, FP_TABU_CUT};
00064
00066 CouenneFeasPump (CouenneProblem *couenne = NULL,
00067 CouenneCutGenerator *cg = NULL,
00068 Ipopt::SmartPtr<Ipopt::OptionsList> options = NULL);
00069
00071 CouenneFeasPump (const CouenneFeasPump &other);
00072
00074 virtual ~CouenneFeasPump();
00075
00077 virtual CbcHeuristic *clone () const;
00078
00080 CouenneFeasPump &operator= (const CouenneFeasPump &rhs);
00081
00083 virtual void resetModel (CbcModel *model) {}
00084
00092 virtual int solution (double &objectiveValue, double *newSolution);
00093
00095 void setNumberSolvePerLevel (int value)
00096 {numberSolvePerLevel_ = value;}
00097
00098 #ifdef COIN_HAS_SCIP
00100 void checkInfinity (struct Scip *scip, double val, double infinity);
00101 #endif
00102
00106 virtual CouNumber solveMILP (const CouNumber *nSol, CouNumber *&iSol, int niter, int* nsuciter);
00107
00109 virtual CouNumber solveNLP (const CouNumber *nSol, CouNumber *&iSol);
00110
00114 expression *updateNLPObj (const double *);
00115
00119 bool fixIntVariables (const double *sol);
00120
00122 static void registerOptions (Ipopt::SmartPtr <Bonmin::RegisteredOptions>);
00123
00125 double findSolution (const double *nSol, double *&sol, int niter, int* nsuciter);
00126
00129 void init_MILP ();
00130
00132 void initIpoptApp ();
00133
00135 CouenneProblem *Problem () const
00136 {return problem_;}
00137
00139 enum fpCompDistIntType compDistInt () const
00140 {return compDistInt_;}
00141
00144
00145 double multDistNLP () const {return fadingCoeff (multDistNLP_);}
00146 double multHessNLP () const {return fadingCoeff (multHessNLP_);}
00147 double multObjFNLP () const {return fadingCoeff (multObjFNLP_);}
00148
00149 double multDistMILP () const {return fadingCoeff (multDistMILP_);}
00150 double multHessMILP () const {return fadingCoeff (multHessMILP_);}
00151 double multObjFMILP () const {return fadingCoeff (multObjFMILP_);}
00152
00154 CouenneTNLP *nlp () const
00155 {return nlp_;}
00156
00158 int &nCalls ()
00159 {return nCalls_;}
00160
00162 int milpPhase (double *nSol, double *iSol);
00163
00165 int nlpPhase (double *iSol, double *nSol);
00166
00167 #ifdef COIN_HAS_SCIP
00168 SCIP_RETCODE ScipSolve (const double *nSol, double* &sol, int niter, int* nsuciter, CouNumber &obj);
00169 #endif
00170
00171 private:
00172
00173
00174
00175
00176
00177
00179 CouenneProblem *problem_;
00180
00182 CouenneCutGenerator *couenneCG_;
00183
00184
00185
00186
00187
00188
00189
00190
00193 CouenneTNLP *nlp_;
00194
00196 Ipopt::IpoptApplication *app_;
00197
00200 OsiSolverInterface *milp_;
00201
00205 OsiSolverInterface *postlp_;
00206
00208 CouenneFPpool *pool_;
00209
00211 std::set <CouenneFPsolution, compareSol> tabuPool_;
00212
00214 int *match_;
00215
00216
00217
00218
00219
00221 int numberSolvePerLevel_;
00222
00225
00226 double multDistNLP_;
00227 double multHessNLP_;
00228 double multObjFNLP_;
00229
00230 double multDistMILP_;
00231 double multHessMILP_;
00232 double multObjFMILP_;
00233
00235 enum fpCompDistIntType compDistInt_;
00236
00238 enum fpCutPlane milpCuttingPlane_;
00239
00241 int nSepRounds_;
00242
00244 int maxIter_;
00245
00247 bool useSCIP_;
00248
00250 int milpMethod_;
00251
00253 enum fpTabuMgtPolicy tabuMgt_;
00254
00256 int nCalls_;
00257
00259 double fadeMult_;
00260 };
00261 }
00262
00263 #endif