Generated on Tue Feb 11 2025 17:33:26 for Gecode by doxygen 1.12.0
member.hh
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 * Copyright:
7 * Christian Schulte, 2011
8 *
9 * This file is part of Gecode, the generic constraint
10 * development environment:
11 * http://www.gecode.org
12 *
13 * Permission is hereby granted, free of charge, to any person obtaining
14 * a copy of this software and associated documentation files (the
15 * "Software"), to deal in the Software without restriction, including
16 * without limitation the rights to use, copy, modify, merge, publish,
17 * distribute, sublicense, and/or sell copies of the Software, and to
18 * permit persons to whom the Software is furnished to do so, subject to
19 * the following conditions:
20 *
21 * The above copyright notice and this permission notice shall be
22 * included in all copies or substantial portions of the Software.
23 *
24 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
25 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
26 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
27 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
28 * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
29 * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
30 * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
31 *
32 */
33
34#ifndef __GECODE_INT_MEMBER_HH__
35#define __GECODE_INT_MEMBER_HH__
36
37#include <gecode/int.hh>
38#include <gecode/int/val-set.hh>
39
45namespace Gecode { namespace Int { namespace Member {
46
53 template<class View>
54 class Prop : public NaryOnePropagator<View,PC_INT_DOM> {
55 protected:
61 static void add(Space& home, ValSet& vs, ViewArray<View>& x);
63 void eliminate(Space& home);
65 Prop(Home home, ValSet& vs, ViewArray<View>& x, View y);
67 Prop(Space& home, Prop<View>& p);
68 public:
70 virtual PropCost cost(const Space&, const ModEventDelta& med) const;
72 virtual Propagator* copy(Space& home);
74 virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
76 static ExecStatus post(Home home, ViewArray<View>& x, View y);
78 static ExecStatus post(Home home, ValSet& vs, ViewArray<View>& x, View y);
80 virtual size_t dispose(Space& home);
81 };
82
89 template<class View, ReifyMode rm>
90 class ReProp : public Prop<View> {
91 protected:
92 using Prop<View>::x;
93 using Prop<View>::y;
94 using Prop<View>::vs;
95 using Prop<View>::add;
96 using Prop<View>::eliminate;
100 ReProp(Home home, ValSet& vs, ViewArray<View>& x, View y, BoolView b);
102 ReProp(Space& home, ReProp<View,rm>& p);
103 public:
105 virtual Propagator* copy(Space& home);
107 virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
109 static ExecStatus post(Home home, ViewArray<View>& x, View y, BoolView b);
111 virtual size_t dispose(Space& home);
112 };
113
114}}}
115
118
119#endif
120
121// STATISTICS: int-prop
int p
Number of positive literals for node type.
Home class for posting propagators
Definition core.hpp:856
Boolean view for Boolean variables.
Definition view.hpp:1380
Membership propagator.
Definition member.hh:54
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
Definition prop.hpp:133
virtual Propagator * copy(Space &home)
Copy propagator during cloning.
Definition prop.hpp:113
virtual PropCost cost(const Space &, const ModEventDelta &med) const
Cost function.
Definition prop.hpp:127
static void add(Space &home, ValSet &vs, ViewArray< View > &x)
Add values of assigned views in x to value set va.
Definition prop.hpp:46
Prop(Home home, ValSet &vs, ViewArray< View > &x, View y)
Constructor for posting.
Definition prop.hpp:40
ValSet vs
Value set storing the values of already assigned views.
Definition member.hh:59
void eliminate(Space &home)
Eliminate views from x that are not equal to y or ar subsumed by vs.
Definition prop.hpp:58
static ExecStatus post(Home home, ViewArray< View > &x, View y)
Post propagator for .
Definition prop.hpp:71
virtual size_t dispose(Space &home)
Delete propagator and return its size.
Definition prop.hpp:119
Reified membership propagator.
Definition member.hh:90
virtual Propagator * copy(Space &home)
Copy propagator during cloning.
Definition re-prop.hpp:101
ReProp(Home home, ValSet &vs, ViewArray< View > &x, View y, BoolView b)
Constructor for posting.
Definition re-prop.hpp:40
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
Definition re-prop.hpp:115
BoolView b
Boolean control variable.
Definition member.hh:98
virtual size_t dispose(Space &home)
Delete propagator and return its size.
Definition re-prop.hpp:107
static ExecStatus post(Home home, ViewArray< View > &x, View y, BoolView b)
Post propagator for .
Definition re-prop.hpp:48
Class for storing values of already assigned views.
Definition val-set.hh:44
(n+1)-ary propagator
Definition pattern.hpp:172
Propagation cost.
Definition core.hpp:486
Base-class for propagators.
Definition core.hpp:1064
ModEventDelta med
A set of modification events (used during propagation)
Definition core.hpp:1075
Computation spaces.
Definition core.hpp:1742
View arrays.
Definition array.hpp:253
int ModEventDelta
Modification event deltas.
Definition core.hpp:89
const Gecode::PropCond PC_INT_DOM
Propagate when domain changes.
Definition var-type.hpp:100
Gecode toplevel namespace
ExecStatus
Definition core.hpp:472