Generated on Thu Jan 16 2025 00:00:00 for Gecode by doxygen 1.14.0
element.hh
Go to the documentation of this file.
1/* -*- mode: C++; c-basic-offset: 2; indent-tabs-mode: nil -*- */
2/*
3 * Main authors:
4 * Guido Tack <tack@gecode.org>
5 * Christian Schulte <schulte@gecode.org>
6 *
7 * Copyright:
8 * Guido Tack, 2004
9 * Christian Schulte, 2004
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
36#ifndef __GECODE_SET_SELECT_HH__
37#define __GECODE_SET_SELECT_HH__
38
39#include <gecode/set.hh>
40
42#include <gecode/int/element.hh>
43#include <gecode/set/rel.hh>
44#include <gecode/set/rel-op.hh>
45
46namespace Gecode { namespace Int {
47
49 template<>
51 public:
53 };
54
56 template<>
61
62}}
63
64namespace Gecode { namespace Set { namespace Element {
65
70
77 template<class View, class View0, class View1>
79 public:
81 protected:
84 View0 x0;
85 View1 x1;
86
90 ElementIntersection(Home home, IdxViewArray&,View0,View1,
91 const IntSet& universe);
92 public:
94 virtual Actor* copy(Space& home);
96 virtual PropCost cost(const Space& home, const ModEventDelta& med) const;
98 virtual void reschedule(Space& home);
100 virtual size_t dispose(Space& home);
102 virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
108 static ExecStatus post(Home home,IdxViewArray& x, View0 y,
109 View1 z, const IntSet& u);
110 };
111
118 template<class View, class View0, class View1>
119 class ElementUnion : public Propagator {
120 public:
122 protected:
124 View0 x0;
125 View1 x1;
126
130 ElementUnion(Home home,IdxViewArray&,View0,View1);
131 public:
133 virtual Actor* copy(Space& home);
135 virtual PropCost cost(const Space& home, const ModEventDelta& med) const;
137 virtual void reschedule(Space& home);
139 virtual size_t dispose(Space& home);
141 virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
147 static ExecStatus post(Home home,IdxViewArray& x,View0 y, View1 z);
148 };
149
156 template<class SView, class RView>
158 protected:
159 SView x0;
161 int n_iv;
162 RView x1;
163
167 ElementUnionConst(Home home, SView, const IntSetArgs&, RView);
168 public:
170 virtual Actor* copy(Space& home);
172 virtual PropCost cost(const Space& home, const ModEventDelta& med) const;
174 virtual void reschedule(Space& home);
176 virtual size_t dispose(Space& home);
178 virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
184 static ExecStatus post(Home home,SView z,const IntSetArgs& x,RView y);
185 };
186
193 template<class SView, class RView>
195 public:
197 protected:
199 RView x1;
200
204 ElementDisjoint(Home home,IdxViewArray&,RView);
205 public:
207 virtual Actor* copy(Space& home);
209 virtual PropCost cost(const Space& home, const ModEventDelta& med) const;
211 virtual void reschedule(Space& home);
213 virtual size_t dispose(Space& home);
215 virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
217 static ExecStatus post(Home home,IdxViewArray& x,RView y);
218 };
219
220}}}
221
226
227#endif
228
229// STATISTICS: set-prop
230
Home class for posting propagators
Definition core.hpp:856
Integer sets.
Definition int.hh:174
Passing integer variables.
Definition int.hh:662
An array of IdxView pairs.
Definition idx-view.hh:67
Class to map VarArg type to view.
Definition idx-view.hh:60
Propagation cost.
Definition core.hpp:486
friend class Space
Definition core.hpp:1068
ModEventDelta med
A set of modification events (used during propagation)
Definition core.hpp:1077
Propagator(Home home)
Constructor for posting.
Definition core.hpp:3505
Passing set variables.
Definition set.hh:491
virtual PropCost cost(const Space &home, const ModEventDelta &med) const
Cost function.
Definition disjoint.hpp:74
Gecode::Int::IdxViewArray< SView > IdxViewArray
Definition element.hh:196
ElementDisjoint(Space &home, ElementDisjoint &p)
Constructor for cloning p.
Definition disjoint.hpp:51
static ExecStatus post(Home home, IdxViewArray &x, RView y)
Post propagator for .
Definition disjoint.hpp:60
virtual Actor * copy(Space &home)
Copy propagator during cloning.
Definition disjoint.hpp:96
virtual void reschedule(Space &home)
Schedule function.
Definition disjoint.hpp:80
virtual size_t dispose(Space &home)
Delete propagator and return its size.
Definition disjoint.hpp:87
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
Definition disjoint.hpp:102
ElementIntersection(Space &home, ElementIntersection &p)
Constructor for cloning p.
Gecode::Int::IdxViewArray< View > IdxViewArray
Definition element.hh:80
virtual Actor * copy(Space &home)
Copy propagator during cloning.
Definition inter.hpp:106
virtual size_t dispose(Space &home)
Delete propagator and return its size.
Definition inter.hpp:77
virtual PropCost cost(const Space &home, const ModEventDelta &med) const
Cost function.
Definition inter.hpp:62
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
Definition inter.hpp:112
virtual void reschedule(Space &home)
Schedule function.
Definition inter.hpp:69
static ExecStatus post(Home home, IdxViewArray &x, View0 y, View1 z, const IntSet &u)
Definition inter.hpp:92
ElementUnionConst(Space &home, ElementUnionConst &p)
Constructor for cloning p.
static ExecStatus post(Home home, SView z, const IntSetArgs &x, RView y)
virtual void reschedule(Space &home)
Schedule function.
virtual size_t dispose(Space &home)
Delete propagator and return its size.
virtual Actor * copy(Space &home)
Copy propagator during cloning.
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
virtual PropCost cost(const Space &home, const ModEventDelta &med) const
Cost function.
virtual void reschedule(Space &home)
Schedule function.
Definition union.hpp:68
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
Definition union.hpp:109
virtual size_t dispose(Space &home)
Delete propagator and return its size.
Definition union.hpp:76
static ExecStatus post(Home home, IdxViewArray &x, View0 y, View1 z)
Definition union.hpp:90
virtual PropCost cost(const Space &home, const ModEventDelta &med) const
Cost function.
Definition union.hpp:61
ElementUnion(Space &home, ElementUnion &p)
Constructor for cloning p.
Gecode::Int::IdxViewArray< View > IdxViewArray
Definition element.hh:121
virtual Actor * copy(Space &home)
Copy propagator during cloning.
Definition union.hpp:103
Set view for set variables
Definition view.hpp:56
Singleton set view.
Definition view.hpp:594
int ModEventDelta
Modification event deltas.
Definition core.hpp:89
Element propagators
Finite domain integers.
Finite integer sets.
Definition var-imp.hpp:137
Gecode toplevel namespace
ArgArray< IntSet > IntSetArgs
Passing set arguments.
Definition int.hh:625
Post propagator for SetVar SetOpType SetVar SetRelType SetVar z
Definition set.hh:773
Post propagator for SetVar SetOpType SetVar y
Definition set.hh:773
ExecStatus
Definition core.hpp:472
Post propagator for SetVar x
Definition set.hh:773