Generated on Tue Feb 11 2025 17:33:26 for Gecode by doxygen 1.12.0
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 * This file is part of Gecode, the generic constraint
12 * development environment:
13 * http://www.gecode.org
14 *
15 * Permission is hereby granted, free of charge, to any person obtaining
16 * a copy of this software and associated documentation files (the
17 * "Software"), to deal in the Software without restriction, including
18 * without limitation the rights to use, copy, modify, merge, publish,
19 * distribute, sublicense, and/or sell copies of the Software, and to
20 * permit persons to whom the Software is furnished to do so, subject to
21 * the following conditions:
22 *
23 * The above copyright notice and this permission notice shall be
24 * included in all copies or substantial portions of the Software.
25 *
26 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
27 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
28 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
29 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
30 * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
31 * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
32 * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
33 *
34 */
35
36namespace Gecode {
37
42 template<class View>
43 class ViewAdvisor : public Advisor {
44 protected:
46 View x;
47 public:
49 template<class A>
50 ViewAdvisor(Space& home, Propagator& p, Council<A>& c, View x0);
54 View view(void) const;
56 void view(Space& home, View y);
58 template<class A>
59 void dispose(Space& home, Council<A>& c);
60 };
61
62
63 template<class View>
64 template<class A>
67 Council<A>& c, View x0)
68 : Advisor(home,p,c), x(x0) {
69 x.subscribe(home,*this);
70 }
71 template<class View>
74 : Advisor(home,a) {
75 x.update(home,a.x);
76 }
77 template<class View>
78 forceinline View
80 return x;
81 }
82 template<class View>
83 forceinline void
85 x.cancel(home,*this); x=y; x.subscribe(home,*this);
86 }
87 template<class View>
88 template<class A>
89 forceinline void
91 x.cancel(home,*this);
92 Advisor::dispose(home,c);
93 }
94
95}
96
97// STATISTICS: kernel-other
int p
Number of positive literals for node type.
struct Gecode::@603::NNF::@65::@67 a
For atomic nodes.
Base-class for advisors.
Definition core.hpp:1292
void dispose(Space &home, Council< A > &c)
Dispose the advisor.
Definition core.hpp:3864
Council of advisors
Definition core.hpp:1241
Base-class for propagators.
Definition core.hpp:1064
Computation spaces.
Definition core.hpp:1742
Advisor storing a single view
Definition advisor.hpp:43
ViewAdvisor(Space &home, Propagator &p, Council< A > &c, View x0)
Constructor for creation.
Definition advisor.hpp:66
void dispose(Space &home, Council< A > &c)
Delete advisor.
Definition advisor.hpp:90
View x
The single view.
Definition advisor.hpp:46
View view(void) const
Access view.
Definition advisor.hpp:79
Gecode toplevel namespace
Post propagator for SetVar SetOpType SetVar y
Definition set.hh:767
Post propagator for SetVar x
Definition set.hh:767
#define forceinline
Definition config.hpp:187