Generated on Tue Jan 26 2021 00:00:00 for Gecode by doxygen 1.9.1
circuit.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_CIRCUIT_HH__
35 #define __GECODE_INT_CIRCUIT_HH__
36 
37 #include <gecode/int.hh>
38 #include <gecode/int/distinct.hh>
39 
45 namespace Gecode { namespace Int { namespace Circuit {
46 
54  template<class View, class Offset>
55  class Base : public NaryPropagator<View,Int::PC_INT_DOM> {
56  protected:
59  int start;
65  Base(Space& home, Base& p);
67  Base(Home home, ViewArray<View>& x, Offset& o);
69  ExecStatus connected(Space& home);
71  ExecStatus path(Space& home);
72  public:
74  virtual size_t dispose(Space& home);
75  };
76 
87  template<class View, class Offset>
88  class Val : public Base<View,Offset> {
89  protected:
96  Val(Space& home, Val& p);
98  Val(Home home, ViewArray<View>& x, Offset& o);
99  public:
101  virtual Actor* copy(Space& home);
103  virtual PropCost cost(const Space& home, const ModEventDelta& med) const;
105  virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
107  static ExecStatus post(Home home, ViewArray<View>& x, Offset& o);
108  };
109 
120  template<class View, class Offset>
121  class Dom : public Base<View,Offset> {
122  protected:
123  using Base<View,Offset>::x;
124  using Base<View,Offset>::y;
127  using Base<View,Offset>::o;
131  Dom(Space& home, Dom& p);
133  Dom(Home home, ViewArray<View>& x, Offset& o);
134  public:
136  virtual Actor* copy(Space& home);
143  virtual PropCost cost(const Space& home, const ModEventDelta& med) const;
145  virtual void reschedule(Space& home);
147  virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
149  static ExecStatus post(Home home, ViewArray<View>& x, Offset& o);
150  };
151 
152 }}}
153 
157 
158 #endif
159 
160 // STATISTICS: int-prop
int p
Number of positive literals for node type.
Definition: bool-expr.cpp:232
Base-class for both propagators and branchers.
Definition: core.hpp:628
Home class for posting propagators
Definition: core.hpp:856
Base-class for circuit propagator.
Definition: circuit.hh:55
ExecStatus connected(Space &home)
Check whether the view value graph is strongly connected.
Definition: base.hpp:69
ViewArray< View > y
Array for performing value propagation for distinct.
Definition: circuit.hh:61
Offset o
Offset transformation.
Definition: circuit.hh:63
virtual size_t dispose(Space &home)
Delete propagator and return its size.
Definition: base.hpp:290
int start
Remember where to start the next time the propagator runs.
Definition: circuit.hh:59
ExecStatus path(Space &home)
Ensure path property: prune edges that could give too small cycles.
Definition: base.hpp:236
Base(Space &home, Base &p)
Constructor for cloning p.
"Domain consistent" circuit propagator
Definition: circuit.hh:121
Dom(Space &home, Dom &p)
Constructor for cloning p.
static ExecStatus post(Home home, ViewArray< View > &x, Offset &o)
Post propagator for circuit on x.
Definition: dom.hpp:114
virtual PropCost cost(const Space &home, const ModEventDelta &med) const
Cost function.
Definition: dom.hpp:58
Int::Distinct::DomCtrl< View > dc
Propagation controller for propagating distinct.
Definition: circuit.hh:129
virtual void reschedule(Space &home)
Schedule function.
Definition: dom.hpp:67
virtual Actor * copy(Space &home)
Copy propagator during cloning.
Definition: dom.hpp:52
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
Definition: dom.hpp:78
"Value-consistent" circuit propagator
Definition: circuit.hh:88
static ExecStatus post(Home home, ViewArray< View > &x, Offset &o)
Post propagator for circuit on x.
Definition: val.hpp:80
virtual Actor * copy(Space &home)
Copy propagator during cloning.
Definition: val.hpp:52
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
Definition: val.hpp:64
virtual PropCost cost(const Space &home, const ModEventDelta &med) const
Cost function (returns high linear)
Definition: val.hpp:58
Val(Space &home, Val &p)
Constructor for cloning p.
Propagation controller for domain consistent distinct.
Definition: distinct.hh:250
Converter with fixed offset.
Definition: view.hpp:650
n-ary propagator
Definition: pattern.hpp:142
ViewArray< View > x
Array of views.
Definition: pattern.hpp:145
Propagation cost.
Definition: core.hpp:486
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
ExecStatus
Definition: core.hpp:472
int ModEventDelta
Modification event deltas.
Definition: core.hpp:89