# 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   class CouenneIterativeRounding : public CbcHeuristic{
    00037
    00038   public:
    00040     CouenneIterativeRounding();
    00042     CouenneIterativeRounding(Bonmin::OsiTMINLPInterface* nlp,
    00043                              OsiSolverInterface* cinlp,
    00044                              CouenneProblem* couenne,
    00045                              Ipopt::SmartPtr<Ipopt::OptionsList> options);
    00047     CouenneIterativeRounding(const CouenneIterativeRounding &other);
    00048
    00050     virtual ~CouenneIterativeRounding();
    00051
    00053     virtual CbcHeuristic * clone() const;
    00054
    00056     CouenneIterativeRounding & operator=(const CouenneIterativeRounding &rhs);
    00057
    00059     void setNlp (Bonmin::OsiTMINLPInterface* nlp, OsiSolverInterface* cinlp);
    00060
    00062     void setCouenneProblem(CouenneProblem* couenne){
    00063       couenne_ = couenne;
    00064     }
    00065
    00067     void resetModel(CbcModel * model){}
    00076     int solution(double & objectiveValue, double * newSolution);
    00077
    00079     void setMaxRoundingIter(int value){
    00080       maxRoundingIter_ = value;
    00081     }
    00082
    00084     void setMaxFirPoints(int value){
    00085       maxFirPoints_ = value;
    00086     }
    00087
    00089     void setMaxTime(double value){
    00090       maxTime_ = value;
    00091     }
    00092
    00094     void setMaxTimeFirstCall(double value){
    00095       maxTimeFirstCall_ = value;
    00096     }
    00097
    00102     void setOmega(double value){
    00103       omega_ = value;
    00104     }
    00105
    00109     void setBaseLbRhs(int value){
    00110       baseLbRhs_ = value;
    00111     }
    00112
    00124     void setAggressiveness(int value);
    00125
    00127     static void registerOptions (Ipopt::SmartPtr <Bonmin::RegisteredOptions>);
    00128
    00129 private:
    00131     Bonmin::OsiTMINLPInterface * nlp_;
    00133     OsiSolverInterface * cinlp_;
    00135 #ifdef COIN_HAS_CPX
    00136     OsiCpxSolverInterface * milp_;
    00137 #else
    00138     OsiClpSolverInterface * milp_;
    00139 #endif
    00140
    00141     int maxRoundingIter_;
    00143     int maxFirPoints_;
    00145     double maxTime_;
    00147     double maxTimeFirstCall_;
    00149     int numInitialRows_;
    00151     int numSol_;
    00153     int numIntegers_;
    00156     double* colLower_;
    00157     double* colUpper_;
    00160     double* colLowerNlp_;
    00161     double* colUpperNlp_;
    00162 #ifndef COIN_HAS_CPX
    00163
    00164     CbcHeuristic** heuristics_;
    00165     int numHeuristics_;
    00166 #endif
    00167
    00168     double startTime_;
    00170     double endTime_;
    00173     double omega_;
    00175     int baseLbRhs_;
    00176
    00178     CouenneProblem * couenne_;
    00179
    00181     inline bool areEqual(double a, double b){
    00182       return (fabs(a-b) <= COUENNE_EPS);
    00183     }
    00184
    00185     /* Try to find a first feasible solution */
    00186     int feasibilityIR(double& objectiveValue, double* newSolution);
    00187
    00188     /* Try to improve a given solution */
    00189     int improvementIR(double& objectiveValue, double* newSolution,
    00190                       const double* startingSolution);
    00191
    00193     void setMilp();
    00194
    00197     int computeIntAtBound(const double* x);
    00198
    00202     int computeIntAtBound(const double* x, double& avgBoundSize);
    00203
    00205     void writeLB(OsiRowCut& cut, const double* x, char sense, double rhs);
    00206
    00208     int branchToCut(const double* x, OsiSolverInterface* solver,
    00209                     std::vector<int>& previousBranches);
    00210
    00212     bool solveMilp(OsiSolverInterface* milp, double maxTime);
    00213   };
    00214 }/* Ends namespace Couenne. */
    00215
    00216 #endif
    00217

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines