Generated on Sat Feb 7 2015 02:01:25 for Gecode by doxygen 1.8.9.1
sequence.hh
Go to the documentation of this file.
1 /* -*- mode: C++; c-basic-offset: 2; indent-tabs-mode: nil -*- */
2 /*
3  * Main authors:
4  * David Rijsman <David.Rijsman@quintiq.com>
5  *
6  * Copyright:
7  * David Rijsman, 2009
8  *
9  * Last modified:
10  * $Date: 2010-04-08 12:35:31 +0200 (Thu, 08 Apr 2010) $
11  * $Revision: 10684 $
12  *
13  * This file is part of Gecode, the generic constraint
14  * development environment:
15  * http://www.gecode.org
16  *
17  * Permission is hereby granted, free of charge, to any person obtaining
18  * a copy of this software and associated documentation files (the
19  * "Software"), to deal in the Software without restriction, including
20  * without limitation the rights to use, copy, modify, merge, publish,
21  * distribute, sublicense, and/or sell copies of the Software, and to
22  * permit persons to whom the Software is furnished to do so, subject to
23  * the following conditions:
24  *
25  * The above copyright notice and this permission notice shall be
26  * included in all copies or substantial portions of the Software.
27  *
28  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
29  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
30  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
31  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
32  * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
33  * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
34  * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
35  *
36  */
37 
38 #ifndef __GECODE_INT_SEQUENCE_HH__
39 #define __GECODE_INT_SEQUENCE_HH__
40 
41 #include <gecode/int.hh>
42 #include <gecode/int/rel.hh>
43 
44 namespace Gecode { namespace Int { namespace Sequence {
45 
58  template<class View>
59  class SupportAdvisor;
60 
61  template<class View,class Val,bool iss>
62  class ViewValSupport;
63 
68  template<class View, class Val,bool iss>
70  private:
74  int n;
75  public:
77  ViewValSupportArray(void);
81  ViewValSupportArray(Space& home, ViewArray<View>&, Val s, int q);
83  ViewValSupportArray(Space& home, int n);
85  int size(void) const;
89  const ViewValSupport<View,Val,iss>& operator [](int) const;
91  void update(Space& home, bool share, ViewValSupportArray<View,Val,iss>& x);
93  ExecStatus propagate(Space& home,ViewArray<View>& a,Val s,int q,int l,int u);
95  ExecStatus advise(Space& home,ViewArray<View>& a,Val s,int q,int j,const Delta& d);
96  };
97 
104  template<class View, class Val>
105  class Sequence : public Propagator {
106  protected:
108  Sequence(Space& home, bool shared, Sequence& p);
110  Sequence(Home home, ViewArray<View>& x, Val s, int q, int l, int u);
111  public:
113  virtual Actor* copy(Space& home, bool share);
115  ExecStatus advise(Space& home, Advisor& _a, const Delta& d);
117  virtual PropCost cost(const Space& home, const ModEventDelta& med) const;
119  virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
121  static ExecStatus post(Home home, ViewArray<View>& x, Val s, int q, int l, int u);
123  static ExecStatus check(Space& home, ViewArray<View>& x, Val s, int q, int l, int u);
125  virtual size_t dispose(Space& home);
126  private:
128  ViewArray<View> x;
130  Val s;
132  int q;
134  int l;
136  int u;
143  };
144 
145 }}}
146 
151 
152 #endif
153 
154 // STATISTICS: int-prop
virtual Actor * copy(Space &home, bool share)
Perform copying during cloning.
Definition: int.hpp:169
Council of advisors
Definition: core.hpp:226
NNF * l
Left subtree.
Definition: bool-expr.cpp:244
ExecStatus advise(Space &home, ViewArray< View > &a, Val s, int q, int j, const Delta &d)
Advise.
Definition: view.hpp:487
Base-class for propagators.
Definition: core.hpp:755
Base-class for advisors.
Definition: core.hpp:926
static ExecStatus post(Home home, ViewArray< View > &x, Val s, int q, int l, int u)
Post propagator for.
Definition: int.hpp:157
An array of ViewValSupport data structures.
Definition: sequence.hh:69
Sequence(Space &home, bool shared, Sequence &p)
Constructor for cloning p.
Definition: int.hpp:88
Computation spaces.
Definition: core.hpp:1362
Base-class for both propagators and branchers.
Definition: core.hpp:666
Class for view value support structure.
Definition: view.hpp:85
Gecode::IntSet d(v, 7)
ExecStatus propagate(Space &home, ViewArray< View > &a, Val s, int q, int l, int u)
Propagate.
Definition: view.hpp:478
Single _a(2, 3)
int p
Number of positive literals for node type.
Definition: bool-expr.cpp:236
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
Definition: int.hpp:181
Sequence propagator for array of integers
Definition: sequence.hh:105
ModEventDelta med
A set of modification events (used during propagation)
Definition: core.hpp:764
ExecStatus advise(Space &home, Advisor &_a, const Delta &d)
Advise function.
Definition: int.hpp:100
ViewValSupport< View, Val, iss > & operator[](int n)
Access element n.
Definition: view.hpp:452
View arrays.
Definition: array.hpp:234
union Gecode::@518::NNF::@57 u
Union depending on nodetype t.
virtual PropCost cost(const Space &home, const ModEventDelta &med) const
Cost function.
Definition: int.hpp:175
Node * x
Pointer to corresponding Boolean expression node.
Definition: bool-expr.cpp:253
Generic domain change information to be supplied to advisors.
Definition: core.hpp:275
Propagation cost.
Definition: core.hpp:537
ExecStatus
Definition: core.hpp:523
bool shared(const ConstView< ViewA > &, const ConstView< ViewB > &)
Test whether views share same variable.
Definition: view.hpp:662
Gecode toplevel namespace
virtual size_t dispose(Space &home)
Delete propagator and return its size.
Definition: int.hpp:123
int size(void) const
Return the current size.
Definition: view.hpp:446
int ModEventDelta
Modification event deltas.
Definition: core.hpp:173
Home class for posting propagators
Definition: core.hpp:717
struct Gecode::@518::NNF::@57::@59 a
For atomic nodes.
ViewValSupportArray(void)
Default constructor.
Definition: view.hpp:417
void update(Space &home, bool share, ViewValSupportArray< View, Val, iss > &x)
Cloning.
Definition: view.hpp:466
static ExecStatus check(Space &home, ViewArray< View > &x, Val s, int q, int l, int u)
Check for consistency.
Definition: int.hpp:133