CouenneIterativeRounding.hpp

Go to the documentation of this file.
00001 // (C) Copyright International Business Machines Corporation 2007 
00002 // All Rights Reserved.
00003 // This code is published under the Eclipse Public License (EPL).
00004 //
00005 // Authors :
00006 // Giacomo Nannicini, Tepper School of Business, Carnegie Mellon University
00007 //
00008 // Date : 07/25/2010
00009 
00010 #ifndef COUENNEITERATIVEROUNDING_HPP
00011 #define COUENNEITERATIVEROUNDING_HPP
00012 
00013 #include "CouenneConfig.h"
00014 #include "CbcHeuristic.hpp"
00015 #include "BonOsiTMINLPInterface.hpp"
00016 
00017 #ifdef COIN_HAS_CPX
00018 #include "OsiCpxSolverInterface.hpp"
00019 #else
00020 #include "CbcHeuristicFPump.hpp"
00021 #include "CbcHeuristicRINS.hpp"
00022 #include "CbcHeuristicDiveFractional.hpp"
00023 #include "CbcHeuristicRandRound.hpp"
00024 #endif
00025 
00026 #include "CouenneCutGenerator.hpp"
00027 #include "CouenneProblem.hpp"
00028 
00029 namespace Couenne{
00030 
00036   using Couenne::CouenneProblem;
00037 
00038   class CouenneIterativeRounding : public CbcHeuristic{
00039 
00040   public:
00042     CouenneIterativeRounding();
00044     CouenneIterativeRounding(Bonmin::OsiTMINLPInterface* nlp, 
00045                              OsiSolverInterface* cinlp,
00046                              CouenneProblem* couenne,
00047                              Ipopt::SmartPtr<Ipopt::OptionsList> options);
00049     CouenneIterativeRounding(const CouenneIterativeRounding &other);
00050     
00052     virtual ~CouenneIterativeRounding();
00053     
00055     virtual CbcHeuristic * clone() const;
00056     
00058     CouenneIterativeRounding & operator=(const CouenneIterativeRounding &rhs);
00059     
00061     void setNlp (Bonmin::OsiTMINLPInterface* nlp, OsiSolverInterface* cinlp);
00062 
00064     void setCouenneProblem(CouenneProblem* couenne){
00065       couenne_ = couenne;
00066     }
00067 
00069     void resetModel(CbcModel * model){}
00078     int solution(double & objectiveValue, double * newSolution);
00079 
00081     void setMaxRoundingIter(int value){
00082       maxRoundingIter_ = value;
00083     }
00084     
00086     void setMaxFirPoints(int value){
00087       maxFirPoints_ = value;
00088     }
00089 
00091     void setMaxTime(double value){
00092       maxTime_ = value;
00093     }
00094 
00096     void setMaxTimeFirstCall(double value){
00097       maxTimeFirstCall_ = value;
00098     }
00099 
00104     void setOmega(double value){
00105       omega_ = value;
00106     }
00107 
00111     void setBaseLbRhs(int value){
00112       baseLbRhs_ = value;
00113     }
00114 
00126     void setAggressiveness(int value);
00127 
00129     static void registerOptions (Ipopt::SmartPtr <Bonmin::RegisteredOptions>);
00130 
00131 private:
00133     Bonmin::OsiTMINLPInterface * nlp_;
00135     OsiSolverInterface * cinlp_;
00137 #ifdef COIN_HAS_CPX
00138     OsiCpxSolverInterface * milp_;
00139 #else
00140     OsiClpSolverInterface * milp_;
00141 #endif
00142 
00143     int maxRoundingIter_;
00145     int maxFirPoints_;
00147     double maxTime_;
00149     double maxTimeFirstCall_;
00151     int numInitialRows_;
00153     int numSol_;
00155     int numIntegers_;
00158     double* colLower_;
00159     double* colUpper_;
00162     double* colLowerNlp_;
00163     double* colUpperNlp_;
00164 #ifndef COIN_HAS_CPX
00165 
00166     CbcHeuristic** heuristics_;
00167     int numHeuristics_;
00168 #endif
00169 
00170     double startTime_;
00172     double endTime_;
00175     double omega_;
00177     int baseLbRhs_;
00178 
00180     CouenneProblem * couenne_;
00181 
00183     inline bool areEqual(double a, double b){
00184       return (fabs(a-b) <= COUENNE_EPS);
00185     }
00186 
00187     /* Try to find a first feasible solution */
00188     int feasibilityIR(double& objectiveValue, double* newSolution);
00189 
00190     /* Try to improve a given solution */
00191     int improvementIR(double& objectiveValue, double* newSolution,
00192                       const double* startingSolution);
00193 
00195     void setMilp();
00196 
00199     int computeIntAtBound(const double* x);
00200 
00204     int computeIntAtBound(const double* x, double& avgBoundSize);
00205 
00207     void writeLB(OsiRowCut& cut, const double* x, char sense, double rhs);
00208 
00210     int branchToCut(const double* x, OsiSolverInterface* solver,
00211                     std::vector<int>& previousBranches);
00212 
00214     bool solveMilp(OsiSolverInterface* milp, double maxTime);
00215   };
00216 }/* Ends namespace Couenne. */
00217 
00218 #endif
00219 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on 13 May 2015 for Couenne by  doxygen 1.6.1