Generated on Sat Feb 7 2015 02:01:15 for Gecode by doxygen 1.8.9.1
merit.hpp
Go to the documentation of this file.
1 /* -*- mode: C++; c-basic-offset: 2; indent-tabs-mode: nil -*- */
2 /*
3  * Main authors:
4  * Christian Schulte <schulte@gecode.org>
5  *
6  * Contributing authors:
7  * Vincent Barichard <Vincent.Barichard@univ-angers.fr>
8  *
9  * Copyright:
10  * Christian Schulte, 2012
11  * Vincent Barichard, 2012
12  *
13  * Last modified:
14  * $Date: 2013-06-13 20:53:42 +0200 (Thu, 13 Jun 2013) $ by $Author: tack $
15  * $Revision: 13706 $
16  *
17  * This file is part of Gecode, the generic constraint
18  * development environment:
19  * http://www.gecode.org
20  *
21  * Permission is hereby granted, free of charge, to any person obtaining
22  * a copy of this software and associated documentation files (the
23  * "Software"), to deal in the Software without restriction, including
24  * without limitation the rights to use, copy, modify, merge, publish,
25  * distribute, sublicense, and/or sell copies of the Software, and to
26  * permit persons to whom the Software is furnished to do so, subject to
27  * the following conditions:
28  *
29  * The above copyright notice and this permission notice shall be
30  * included in all copies or substantial portions of the Software.
31  *
32  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
33  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
34  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
35  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
36  * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
37  * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
38  * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
39  *
40  */
41 
42 namespace Gecode { namespace Float { namespace Branch {
43 
44  // Minimum merit
47  : MeritBase<FloatView,double>(home,vb) {}
50  : MeritBase<FloatView,double>(home,shared,m) {}
51  forceinline double
53  return x.min();
54  }
55 
56  // Maximum merit
59  : MeritBase<FloatView,double>(home,vb) {}
62  : MeritBase<FloatView,double>(home,shared,m) {}
63  forceinline double
65  return x.max();
66  }
67 
68  // Size merit
71  : MeritBase<FloatView,double>(home,vb) {}
74  : MeritBase<FloatView,double>(home,shared,m) {}
75  forceinline double
77  return x.size();
78  }
79 
80  // Size over degree merit
83  : MeritBase<FloatView,double>(home,vb) {}
86  MeritDegreeSize& m)
87  : MeritBase<FloatView,double>(home,shared,m) {}
88  forceinline double
90  return x.size() / static_cast<double>(x.degree());
91  }
92 
93  // Size over AFC merit
96  : MeritBase<FloatView,double>(home,vb), afc(vb.afc()) {}
99  : MeritBase<FloatView,double>(home,shared,m) {
100  afc.update(home,shared,m.afc);
101  }
102  forceinline double
104  return x.size() / x.afc(home);
105  }
106  forceinline bool
107  MeritAFCSize::notice(void) const {
108  return true;
109  }
110  forceinline void
112  afc.~AFC();
113  }
114 
115  // Size over activity merit
118  const VarBranch& vb)
119  : MeritBase<FloatView,double>(home,vb), activity(vb.activity()) {}
123  : MeritBase<FloatView,double>(home,shared,m) {
124  activity.update(home, shared, m.activity);
125  }
126  forceinline double
128  return activity[i] / static_cast<double>(x.size());
129  }
130  forceinline bool
132  return true;
133  }
134  forceinline void
137  }
138 
139 }}}
140 
141 // STATISTICS: float-branch
void update(int i)
Update activity value at position i.
Definition: activity.hpp:303
double operator()(const Space &home, FloatView x, int i)
Return size over AFC as merit for view x at position i.
Definition: merit.hpp:103
FloatNum size(void) const
Return size of domain (distance between maximum and minimum)
Definition: float.hpp:81
Merit class for size over activity.
Definition: branch.hh:157
FloatNum min(void) const
Return minimum of domain.
Definition: float.hpp:64
Merit class for size over afc.
Definition: branch.hh:134
double operator()(const Space &home, FloatView x, int i)
Return size over degree as merit for view x at position i.
Definition: merit.hpp:89
AFC afc
Definition: afc.cpp:139
Base-class for merit class.
~AFC(void)
Destructor.
Definition: afc.hpp:154
void dispose(Space &home)
Dispose view selection.
Definition: merit.hpp:135
Computation spaces.
Definition: core.hpp:1362
Merit class for maximum of float view.
Definition: branch.hh:86
unsigned int degree(void) const
Return degree (number of subscribed propagators and advisors)
Definition: view.hpp:438
AFC afc
AFC information.
Definition: branch.hh:137
Activity activity
Activity information.
Definition: branch.hh:160
Gecode::IntArgs i(4, 1, 2, 3, 4)
double operator()(const Space &home, FloatView x, int i)
Return size over activity as merit for view x at position i.
Definition: merit.hpp:127
double operator()(const Space &home, FloatView x, int i)
Return minimum as merit for view x at position i.
Definition: merit.hpp:52
double operator()(const Space &home, FloatView x, int i)
Return size as merit for view x at position i.
Definition: merit.hpp:76
MeritDegreeSize(Space &home, const VarBranch &vb)
Constructor for initialization.
Definition: merit.hpp:82
MeritActivitySize(Space &home, const VarBranch &vb)
Constructor for initialization.
Definition: merit.hpp:117
bool notice(void) const
Whether dispose must always be called (that is, notice is needed)
Definition: merit.hpp:131
double operator()(const Space &home, FloatView x, int i)
Return maximum as merit for view x at position i.
Definition: merit.hpp:64
void dispose(Space &home)
Dispose view selection.
Definition: merit.hpp:111
~Activity(void)
Destructor.
Definition: activity.cpp:74
bool notice(void) const
Whether dispose must always be called (that is, notice is needed)
Definition: merit.hpp:107
Float view for float variables.
Definition: view.hpp:56
MeritMin(Space &home, const VarBranch &vb)
Constructor for initialization.
Definition: merit.hpp:46
Variable branching information.
Definition: branch-var.hpp:55
double afc(const Space &home) const
Return accumulated failure count.
Definition: view.hpp:443
Node * x
Pointer to corresponding Boolean expression node.
Definition: bool-expr.cpp:253
#define forceinline
Definition: config.hpp:132
MeritSize(Space &home, const VarBranch &vb)
Constructor for initialization.
Definition: merit.hpp:70
MeritAFCSize(Space &home, const VarBranch &vb)
Constructor for initialization.
Definition: merit.hpp:95
bool shared(const ConstView< ViewA > &, const ConstView< ViewB > &)
Test whether views share same variable.
Definition: view.hpp:662
FloatNum max(void) const
Return maximum of domain.
Definition: float.hpp:68
Merit class for size over degree.
Definition: branch.hh:118
Gecode toplevel namespace
void update(Space &home, bool share, AFC &a)
Updating during cloning.
Definition: afc.hpp:157
MeritMax(Space &home, const VarBranch &vb)
Constructor for initialization.
Definition: merit.hpp:58
Merit class for mimimum.
Definition: branch.hh:70
Merit class for size of float view.
Definition: branch.hh:102