Generated on Sat Feb 7 2015 02:01:27 for Gecode by doxygen 1.8.9.1
advisor.hpp
Go to the documentation of this file.
1 /* -*- mode: C++; c-basic-offset: 2; indent-tabs-mode: nil -*- */
2 /*
3  * Main authors:
4  * Mikael Lagerkvist <lagerkvist@gecode.org>
5  * Christian Schulte <schulte@gecode.org>
6  *
7  * Copyright:
8  * Mikael Lagerkvist, 2006
9  * Christian Schulte, 2007
10  *
11  * Last modified:
12  * $Date: 2010-04-08 12:35:31 +0200 (Thu, 08 Apr 2010) $ by $Author: schulte $
13  * $Revision: 10684 $
14  *
15  * This file is part of Gecode, the generic constraint
16  * development environment:
17  * http://www.gecode.org
18  *
19  * Permission is hereby granted, free of charge, to any person obtaining
20  * a copy of this software and associated documentation files (the
21  * "Software"), to deal in the Software without restriction, including
22  * without limitation the rights to use, copy, modify, merge, publish,
23  * distribute, sublicense, and/or sell copies of the Software, and to
24  * permit persons to whom the Software is furnished to do so, subject to
25  * the following conditions:
26  *
27  * The above copyright notice and this permission notice shall be
28  * included in all copies or substantial portions of the Software.
29  *
30  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
31  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
32  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
33  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
34  * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
35  * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
36  * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
37  *
38  */
39 
40 namespace Gecode {
41 
46  template<class View>
47  class ViewAdvisor : public Advisor {
48  protected:
50  View x;
51  public:
53  template<class A>
54  ViewAdvisor(Space& home, Propagator& p, Council<A>& c, View x0);
56  ViewAdvisor(Space& home, bool share, ViewAdvisor<View>& a);
58  View view(void) const;
60  void view(Space& home, View y);
62  template<class A>
63  void dispose(Space& home, Council<A>& c);
64  };
65 
66 
67  template<class View>
68  template<class A>
71  Council<A>& c, View x0)
72  : Advisor(home,p,c), x(x0) {
73  x.subscribe(home,*this);
74  }
75  template<class View>
79  : Advisor(home,share,a) {
80  x.update(home,share,a.x);
81  }
82  template<class View>
83  forceinline View
85  return x;
86  }
87  template<class View>
88  forceinline void
89  ViewAdvisor<View>::view(Space& home, View y) {
90  x.cancel(home,*this); x=y; x.subscribe(home,*this);
91  }
92  template<class View>
93  template<class A>
94  forceinline void
96  x.cancel(home,*this);
97  Advisor::dispose(home,c);
98  }
99 
100 }
101 
102 // STATISTICS: kernel-other
void dispose(Space &home, Council< A > &c)
Delete advisor.
Definition: advisor.hpp:95
Council of advisors
Definition: core.hpp:226
View x
The single view.
Definition: advisor.hpp:50
Base-class for propagators.
Definition: core.hpp:755
Base-class for advisors.
Definition: core.hpp:926
Computation spaces.
Definition: core.hpp:1362
Advisor storing a single view
Definition: advisor.hpp:47
Gecode::FloatVal c(-8, 8)
int p
Number of positive literals for node type.
Definition: bool-expr.cpp:236
View view(void) const
Access view.
Definition: advisor.hpp:84
Node * x
Pointer to corresponding Boolean expression node.
Definition: bool-expr.cpp:253
void dispose(Space &home, Council< A > &c)
Dispose the advisor.
Definition: core.hpp:3267
ViewAdvisor(Space &home, Propagator &p, Council< A > &c, View x0)
Constructor for creation.
Definition: advisor.hpp:70
#define forceinline
Definition: config.hpp:132
Gecode toplevel namespace
struct Gecode::@518::NNF::@57::@59 a
For atomic nodes.