Couenne  0.5.8
CouenneFPpool.hpp
Go to the documentation of this file.
1 /* $Id: CouenneFPpool.hpp 1061 2014-02-01 19:22:28Z pbelotti $
2  *
3  * Name: CouenneFPpool.hpp
4  * Authors: Pietro Belotti
5  * Timo Berthold, ZIB Berlin
6  * Purpose: Pool of MILP- (and why not? NLP-) feasible solutions for
7  * restart use in the Feasibility Pump and sets of solutions
8  * to be used as tabu list
9  *
10  * This file is licensed under the Eclipse Public License (EPL)
11  */
12 
13 #ifndef CouenneFPpool_hpp
14 #define CouenneFPpool_hpp
15 
16 #include <set>
17 
18 #include "CouenneTypes.hpp"
19 #include "CoinFinite.hpp"
20 #include "CouenneProblem.hpp"
21 
22 namespace Couenne {
23 
24  class CouenneProblem;
25  class CouenneFeasPump;
26 
30 
33 
34  protected:
35 
37  int n_;
38  int nNLinf_;
39  int nIinf_;
43 
47 
48  bool copied_;
49 
53 
54  public:
55 
56  CouenneFPsolution (CouenneProblem *p, CouNumber *x, bool copied = false);
57 
59 
61 
63 
65  const int n () const {return n_;}
66 
68  const double *x () const {return x_;}
69 
71  bool compare (const CouenneFPsolution &other, enum what_to_compare comparedTerm) const;
72  };
73 
74 
76  inline bool operator< (const CouenneFPsolution &one,
77  const CouenneFPsolution &two)
78  {return one.compare (two, comparedTerm_);}
79 
80 
82  class compareSol {
83 
84  public:
85  bool operator () (const CouenneFPsolution &one,
86  const CouenneFPsolution &two) const;
87  };
88 
89 
91  class CouenneFPpool {
92 
93  protected:
94 
96  std::set <CouenneFPsolution, compareSol> set_;
97 
100 
101  public:
102 
105  problem_ (p) {comparedTerm_ = c;}
106 
109 
112 
114  std::set <CouenneFPsolution, compareSol> &Set ()
115  {return set_;}
116 
119  {return problem_;}
120 
123  void findClosestAndReplace (double *&sol, const double *nSol, int nvars) ;
124  };
125 }
126 
127 #endif
Pool of solutions.
CouenneFPpool & operator=(const CouenneFPpool &src)
assignment
void findClosestAndReplace(double *&sol, const double *nSol, int nvars)
finds, in pool, solution x closest to sol; removes it from the pool and overwrites it to sol
CouenneProblem * problem_
Problem pointer.
CouenneFPpool(CouenneProblem *p, enum what_to_compare c)
simple constructor (empty pool)
CouenneProblem * Problem()
return the problem pointer
std::set< CouenneFPsolution, compareSol > & Set()
return the main object in this class
CouenneFPpool(const CouenneFPpool &src)
copy constructor
std::set< CouenneFPsolution, compareSol > set_
Pool.
Class containing a solution with infeasibility evaluation.
int nNLinf_
number of NL infeasibilities
const double * x() const
returns vector
CouNumber objVal_
objective function value
CouNumber maxIinf_
maximum integer infeasibility
CouenneFPsolution & operator=(const CouenneFPsolution &src)
assignment
bool copied_
This is a temporary copy, not really a solution holder.
int n_
number of variables (for independence from CouenneProblem)
CouNumber * x_
solution
CouenneProblem * problem_
holds pointer to problem to check integrality in comparison of integer variables
bool compare(const CouenneFPsolution &other, enum what_to_compare comparedTerm) const
basic comparison procedure – what to compare depends on user's choice
const int n() const
returns size
CouenneFPsolution(const CouenneFPsolution &src)
copy constructor
int nIinf_
number of integer infeasibilities
CouenneFPsolution(CouenneProblem *p, CouNumber *x, bool copied=false)
CouenneProblem-aware constructor.
CouNumber maxNLinf_
maximum NL infeasibility
Class for MINLP problems with symbolic information.
class for comparing solutions (used in tabu list)
bool operator()(const CouenneFPsolution &one, const CouenneFPsolution &two) const
general include file for different compilers
double CouNumber
main number type in Couenne
bool operator<(const CouenneScalar &first, const CouenneScalar &second)
static enum Couenne::what_to_compare comparedTerm_
what_to_compare
what term to compare: the sum of infeasibilities, the sum of numbers of infeasible terms,...