Generated on Tue Feb 11 2025 17:33:26 for Gecode by doxygen 1.12.0
channel.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, 2006
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_CHANNEL_HH__
35#define __GECODE_INT_CHANNEL_HH__
36
37#include <gecode/int.hh>
39
45namespace Gecode { namespace Int { namespace Channel {
46
49
54 template<class Info, class Offset, PropCond pc>
55 class Base : public Propagator {
56 protected:
58 int n;
60 int n_na;
66 Info* xy;
70 Base(Home home, int n, Info* xy, Offset& ox, Offset& oy);
71 public:
73 virtual PropCost cost(const Space& home, const ModEventDelta& med) const;
75 virtual void reschedule(Space& home);
77 virtual size_t dispose(Space& home);
78 };
79
80
85 template<class View> class ValInfo;
86
96 template<class View, class Offset, bool shared>
97 class Val : public Base<ValInfo<View>,Offset,PC_INT_VAL> {
98 protected:
105 Val(Space& home, Val& p);
107 Val(Home home, int n, ValInfo<View>* xy, Offset& ox, Offset& oy);
108 public:
110 virtual Actor* copy(Space& home);
112 virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
114 static ExecStatus post(Home home, int n, ValInfo<View>* xy,
115 Offset& ox, Offset& oy);
116 };
117
122 template<class View, class Offset> class DomInfo;
123
133 template<class View, class Offset, bool shared>
134 class Dom : public Base<DomInfo<View,Offset>,Offset,PC_INT_DOM> {
135 protected:
144 Dom(Space& home, Dom& p);
146 Dom(Home home, int n, DomInfo<View,Offset>* xy, Offset& ox, Offset& oy);
147 public:
149 virtual Actor* copy(Space& home);
156 virtual PropCost cost(const Space& home, const ModEventDelta& med) const;
158 virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
160 static ExecStatus post(Home home, int n, DomInfo<View,Offset>* xy,
161 Offset& ox, Offset& oy);
162 };
163
171 public MixBinaryPropagator<BoolView,PC_BOOL_VAL,IntView,PC_INT_VAL> {
172 private:
175
177 LinkSingle(Space& home, LinkSingle& p);
180 public:
182 virtual Actor* copy(Space& home);
184 virtual PropCost cost(const Space& home, const ModEventDelta& med) const;
186 virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
188 static ExecStatus post(Home home, BoolView x0, IntView x1);
189 };
190
197 class LinkMulti :
198 public MixNaryOnePropagator<BoolView,PC_BOOL_NONE,IntView,PC_INT_DOM> {
199 private:
205 static const int S_NONE = 0;
207 static const int S_ONE = 1;
209 static const int S_RUN = 2;
211 int status;
213 int o;
215 LinkMulti(Space& home, LinkMulti& p);
217 LinkMulti(Home home, ViewArray<BoolView>& x, IntView y, int o0);
218 public:
221 virtual Actor* copy(Space& home);
224 virtual PropCost cost(const Space& home, const ModEventDelta& med) const;
227 virtual void reschedule(Space& home);
230 virtual ExecStatus advise(Space& home, Advisor& a, const Delta& d);
233 virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
235 static ExecStatus post(Home home,
236 ViewArray<BoolView>& x, IntView y, int o);
239 virtual size_t dispose(Space& home);
240 };
241
242}}}
243
247
250
251#endif
252
253// STATISTICS: int-prop
254
int p
Number of positive literals for node type.
struct Gecode::@603::NNF::@65::@67 a
For atomic nodes.
Base-class for both propagators and branchers.
Definition core.hpp:628
Base-class for advisors.
Definition core.hpp:1292
Council of advisors
Definition core.hpp:1241
Generic domain change information to be supplied to advisors.
Definition core.hpp:204
Home class for posting propagators
Definition core.hpp:856
Boolean view for Boolean variables.
Definition view.hpp:1380
Base-class for channel propagators.
Definition channel.hh:55
Base(Space &home, Base< Info, Offset, pc > &p)
Constructor for cloning p.
Definition base.hpp:47
Offset oy
Offset transformation for y variables.
Definition channel.hh:64
int n
Number of views (actually twice as many for both x and y)
Definition channel.hh:58
Offset ox
Offset transformation for x variables.
Definition channel.hh:62
int n_na
Total number of not assigned views (not known to be assigned)
Definition channel.hh:60
virtual size_t dispose(Space &home)
Delete propagator and return its size.
Definition base.hpp:71
virtual PropCost cost(const Space &home, const ModEventDelta &med) const
Propagation cost (defined as low quadratic)
Definition base.hpp:58
Info * xy
View and information for both x and y.
Definition channel.hh:66
virtual void reschedule(Space &home)
Schedule function.
Definition base.hpp:64
Combine view with information for domain propagation.
Definition dom.hpp:45
Domain consistent channel propagator.
Definition channel.hh:134
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
Definition dom.hpp:196
static ExecStatus post(Home home, int n, DomInfo< View, Offset > *xy, Offset &ox, Offset &oy)
Post propagator for channeling on xy.
Definition dom.hpp:307
Dom(Space &home, Dom &p)
Constructor for cloning p.
virtual Actor * copy(Space &home)
Copy propagator during cloning.
Definition dom.hpp:180
Distinct::DomCtrl< View > dc
Propagation controller for propagating distinct.
Definition channel.hh:142
virtual PropCost cost(const Space &home, const ModEventDelta &med) const
Cost function.
Definition dom.hpp:186
Link propagator for multiple Boolean views.
Definition channel.hh:198
virtual PropCost cost(const Space &home, const ModEventDelta &med) const
Cost function (low unary if y is assigned, low linear otherwise)
static ExecStatus post(Home home, ViewArray< BoolView > &x, IntView y, int o)
Post propagator for .
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
virtual ExecStatus advise(Space &home, Advisor &a, const Delta &d)
Give advice to propagator.
virtual Actor * copy(Space &home)
Copy propagator during cloning.
virtual size_t dispose(Space &home)
Delete propagator and return its size.
virtual void reschedule(Space &home)
Schedule function.
Link propagator for a single Boolean view.
Definition channel.hh:171
virtual PropCost cost(const Space &home, const ModEventDelta &med) const
Cost function (defined as low unary)
static ExecStatus post(Home home, BoolView x0, IntView x1)
Post propagator for .
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
virtual Actor * copy(Space &home)
Copy propagator during cloning.
Combine view with information for value propagation.
Definition val.hpp:45
Naive channel propagator.
Definition channel.hh:97
virtual Actor * copy(Space &home)
Copy propagator during cloning.
Definition val.hpp:193
static ExecStatus post(Home home, int n, ValInfo< View > *xy, Offset &ox, Offset &oy)
Post propagator for channeling.
Definition val.hpp:230
Val(Space &home, Val &p)
Constructor for cloning p.
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
Definition val.hpp:199
Propagation controller for domain consistent distinct.
Definition distinct.hh:250
Integer view for integer variables.
Definition view.hpp:129
Converter with fixed offset.
Definition view.hpp:650
Mixed binary propagator.
Definition pattern.hpp:204
Mixed (n+1)-ary propagator.
Definition pattern.hpp:272
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
Stack with fixed number of elements.
View arrays.
Definition array.hpp:253
#define GECODE_INT_EXPORT
Definition int.hh:81
Offset(int off)
Integer-precision integer scale view.
Definition view.hpp:667
int ModEventDelta
Modification event deltas.
Definition core.hpp:89
Support::StaticStack< int, Region > ProcessStack
Processing stack.
Definition channel.hh:48
const Gecode::PropCond PC_INT_VAL
Propagate when a view becomes assigned (single value)
Definition var-type.hpp:82
const Gecode::PropCond PC_BOOL_NONE
Propagation condition to be ignored (convenience)
Definition var-type.hpp:118
const Gecode::PropCond PC_BOOL_VAL
Propagate when a view becomes assigned (single value)
Definition var-type.hpp:126
const Gecode::PropCond PC_INT_DOM
Propagate when domain changes.
Definition var-type.hpp:100
Gecode toplevel namespace
ExecStatus
Definition core.hpp:472