Couenne  0.2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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 
51 
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 
108  CouenneFPpool (const CouenneFPpool &src);
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.
CouNumber maxNLinf_
maximum NL infeasibility
std::set< CouenneFPsolution, compareSol > & Set()
return the main object in this class
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 ...
class for comparing solutions (used in tabu list)
int n_
number of variables (for independence from CouenneProblem)
int nNLinf_
number of NL infeasibilities
CouenneFPsolution & operator=(const CouenneFPsolution &src)
assignment
what_to_compare
what term to compare: the sum of infeasibilities, the sum of numbers of infeasible terms...
~CouenneFPsolution()
destructor
Class containing a solution with infeasibility evaluation.
CouenneFPpool(CouenneProblem *p, enum what_to_compare c)
simple constructor (empty pool)
static enum Couenne::what_to_compare comparedTerm_
bool copied_
This is a temporary copy, not really a solution holder.
CouenneProblem * problem_
Problem pointer.
const int n() const
returns size
Class for MINLP problems with symbolic information.
const double * x() const
returns vector
CouenneProblem * Problem()
return the problem pointer
bool operator()(const CouenneFPsolution &one, const CouenneFPsolution &two) const
CouenneFPsolution(CouenneProblem *p, CouNumber *x, bool copied=false)
CouenneProblem-aware constructor.
double CouNumber
main number type in Couenne
CouNumber objVal_
objective function value
bool compare(const CouenneFPsolution &other, enum what_to_compare comparedTerm) const
basic comparison procedure – what to compare depends on user&#39;s choice
CouNumber * x_
solution
int nIinf_
number of integer infeasibilities
std::set< CouenneFPsolution, compareSol > set_
Pool.
CouenneProblem * problem_
holds pointer to problem to check integrality in comparison of integer variables
CouNumber maxIinf_
maximum integer infeasibility
bool operator<(const CouenneScalar &first, const CouenneScalar &second)