# CouenneFPpool.hpp

Go to the documentation of this file.

    00001 /* $Id: CouenneFPpool.hpp 1061 2014-02-01 19:22:28Z pbelotti $
    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 #include "CouenneProblem.hpp"
    00021
    00022 namespace Couenne {
    00023
    00024   class CouenneProblem;
    00025   class CouenneFeasPump;
    00026
    00029   static enum what_to_compare {SUM_NINF = 0, SUM_INF, OBJVAL, ALL_VARS, INTEGER_VARS} comparedTerm_;
    00030
    00032   class CouenneFPsolution {
    00033
    00034   protected:
    00035
    00036     CouNumber *x_;
    00037     int        n_;
    00038     int        nNLinf_;
    00039     int        nIinf_;
    00040     CouNumber  objVal_;
    00041     CouNumber  maxNLinf_;
    00042     CouNumber  maxIinf_;
    00043
    00047
    00048     bool copied_;
    00049
    00050     CouenneProblem *problem_;
    00051
    00052
    00053
    00054   public:
    00055
    00056     CouenneFPsolution (CouenneProblem *p, CouNumber *x, bool copied = false);
    00057
    00058     CouenneFPsolution (const CouenneFPsolution &src);
    00059
    00060     CouenneFPsolution &operator= (const CouenneFPsolution &src);
    00061
    00062     ~CouenneFPsolution ();
    00063
    00065     const int n () const {return n_;}
    00066
    00068     const double *x () const {return x_;}
    00069
    00071     bool compare (const CouenneFPsolution &other, enum what_to_compare comparedTerm) const;
    00072   };
    00073
    00074
    00076   inline bool operator< (const CouenneFPsolution &one,
    00077                          const CouenneFPsolution &two)
    00078   {return one.compare (two, comparedTerm_);}
    00079
    00080
    00082   class compareSol {
    00083
    00084   public:
    00085     bool operator () (const CouenneFPsolution &one,
    00086                       const CouenneFPsolution &two) const;
    00087   };
    00088
    00089
    00091   class CouenneFPpool {
    00092
    00093   protected:
    00094
    00096     std::set <CouenneFPsolution, compareSol> set_;
    00097
    00099     CouenneProblem *problem_;
    00100
    00101   public:
    00102
    00104     CouenneFPpool (CouenneProblem *p, enum what_to_compare c):
    00105       problem_ (p) {comparedTerm_ = c;}
    00106
    00108     CouenneFPpool (const CouenneFPpool &src);
    00109
    00111     CouenneFPpool &operator= (const CouenneFPpool &src);
    00112
    00114     std::set <CouenneFPsolution, compareSol> &Set ()
    00115     {return set_;}
    00116
    00118     CouenneProblem *Problem ()
    00119     {return problem_;}
    00120
    00123     void findClosestAndReplace (double *&sol, const double *nSol, int nvars) ;
    00124   };
    00125 }
    00126
    00127 #endif

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines