CouenneFPpool.hpp

Go to the documentation of this file.
00001 /* $Id: CouenneFPpool.hpp 691 2011-06-18 14:11:50Z stefan $
00002  *
00003  * Name:    CouenneFPpool.hpp
00004  * Authors: Pietro Belotti
00005  *          Timo Berthold, ZIB Berlin
00006  * Purpose: Pool of MILP- (and why not? NLP-) feasible solutions for
00007  *          restart use in the Feasibility Pump and sets of solutions
00008  *          to be used as tabu list
00009  * 
00010  * This file is licensed under the Eclipse Public License (EPL)
00011  */
00012 
00013 #ifndef CouenneFPpool_hpp
00014 #define CouenneFPpool_hpp
00015 
00016 #include <set>
00017 
00018 #include "CouenneTypes.hpp"
00019 #include "CoinFinite.hpp"
00020 
00021 namespace Couenne {
00022 
00023   class CouenneProblem;
00024   class CouenneFeasPump;
00025 
00028   static enum what_to_compare {SUM_NINF = 0, SUM_INF, OBJVAL} comparedTerm_;
00029 
00031   class CouenneFPsolution {
00032 
00033   protected:
00034 
00035     CouNumber *x_;        
00036     int        n_;        
00037     int        nNLinf_;   
00038     int        nIinf_;    
00039     CouNumber  objVal_;   
00040     CouNumber  maxNLinf_; 
00041     CouNumber  maxIinf_;  
00042 
00046 
00047     bool       copied_;   
00048 
00049   public:
00050 
00051     CouenneFPsolution (CouenneProblem *p, CouNumber *x, bool copied = false); 
00052 
00055     CouenneFPsolution (CouNumber *x,
00056                        int n,
00057                        int nNLinf         = 1,
00058                        int nIinf          = 1,
00059                        CouNumber objVal   = COIN_DBL_MAX,
00060                        CouNumber maxNLinf = COIN_DBL_MAX,
00061                        CouNumber maxIinf  = COIN_DBL_MAX);
00062 
00063     CouenneFPsolution (const CouenneFPsolution &src); 
00064 
00065     CouenneFPsolution &operator= (const CouenneFPsolution &src); 
00066 
00067     ~CouenneFPsolution (); 
00068 
00070     const int n () const {return n_;}
00071 
00073     const double *x () const {return x_;}
00074 
00076     bool compare (const CouenneFPsolution &other, enum what_to_compare comparedTerm) const;
00077   };
00078 
00079 
00081   inline bool operator< (const CouenneFPsolution &one, 
00082                          const CouenneFPsolution &two)
00083   {return one.compare (two, comparedTerm_);}
00084 
00085 
00087   class compareSol {
00088 
00089   public:
00090     bool operator () (const CouenneFPsolution &one, 
00091                       const CouenneFPsolution &two) const;
00092   };
00093 
00094 
00096   class CouenneFPpool {
00097 
00098   protected:
00099 
00101     std::set <CouenneFPsolution> set_;
00102 
00103   public:
00104 
00106     CouenneFPpool (enum what_to_compare c)
00107     {comparedTerm_ = c;}
00108 
00110     CouenneFPpool (const CouenneFPpool &src);
00111 
00113     CouenneFPpool &operator= (const CouenneFPpool &src);
00114 
00116     std::set <CouenneFPsolution> &Set ()
00117     {return set_;}
00118 
00121     void findClosestAndReplace (double *sol, double *nSol, int nvars) ;
00122   };
00123 }
00124 
00125 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on 26 Jan 2012 for Couenne by  doxygen 1.6.1