Generated on Sat Jan 12 2019 20:58:51 for Gecode by doxygen 1.8.13
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  * 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_SEQUENCE_HH__
35 #define __GECODE_INT_SEQUENCE_HH__
36 
37 #include <gecode/int.hh>
38 #include <gecode/int/rel.hh>
39 
40 namespace Gecode { namespace Int { namespace Sequence {
41 
54  template<class View>
55  class SupportAdvisor;
56 
57  template<class View,class Val,bool iss>
58  class ViewValSupport;
59 
64  template<class View, class Val,bool iss>
66  private:
70  int n;
71  public:
73  ViewValSupportArray(void);
77  ViewValSupportArray(Space& home, ViewArray<View>&, Val s, int q);
79  ViewValSupportArray(Space& home, int n);
81  int size(void) const;
85  const ViewValSupport<View,Val,iss>& operator [](int) const;
89  ExecStatus propagate(Space& home,ViewArray<View>& a,Val s,int q,int l,int u);
91  ExecStatus advise(Space& home,ViewArray<View>& a,Val s,int q,int j,const Delta& d);
92  };
93 
100  template<class View, class Val>
101  class Sequence : public Propagator {
102  protected:
104  Sequence(Space& home, Sequence& p);
106  Sequence(Home home, ViewArray<View>& x, Val s, int q, int l, int u);
107  public:
109  virtual Actor* copy(Space& home);
111  ExecStatus advise(Space& home, Advisor& _a, const Delta& d);
113  virtual PropCost cost(const Space& home, const ModEventDelta& med) const;
115  virtual void reschedule(Space& home);
117  virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
119  static ExecStatus post(Home home, ViewArray<View>& x, Val s, int q, int l, int u);
121  static ExecStatus check(ViewArray<View>& x, Val s, int q, int l, int u);
123  virtual size_t dispose(Space& home);
124  private:
128  Val s;
130  int q;
132  int l;
134  int u;
142  bool tofail;
143  };
144 
145 }}}
146 
151 
152 #endif
153 
154 // STATISTICS: int-prop
Council of advisors
Definition: core.hpp:154
NNF * l
Left subtree.
Definition: bool-expr.cpp:240
ExecStatus advise(Space &home, ViewArray< View > &a, Val s, int q, int j, const Delta &d)
Advise.
Definition: view.hpp:482
Base-class for propagators.
Definition: core.hpp:1023
Base-class for advisors.
Definition: core.hpp:1251
An array of ViewValSupport data structures.
Definition: sequence.hh:65
void update(Space &home, ViewValSupportArray< View, Val, iss > &x)
Cloning.
Definition: view.hpp:461
Computation spaces.
Definition: core.hpp:1701
Base-class for both propagators and branchers.
Definition: core.hpp:627
Class for view value support structure.
Definition: view.hpp:80
Gecode::IntSet d(v, 7)
ExecStatus propagate(Space &home, ViewArray< View > &a, Val s, int q, int l, int u)
Propagate.
Definition: view.hpp:473
Single _a(2, 3)
int p
Number of positive literals for node type.
Definition: bool-expr.cpp:232
Sequence propagator for array of integers
Definition: sequence.hh:101
ViewValSupport< View, Val, iss > & operator[](int n)
Access element n.
Definition: view.hpp:447
View arrays.
Definition: array.hpp:235
union Gecode::@593::NNF::@62 u
Union depending on nodetype t.
void check(const FloatVal &n, const char *l)
Check whether float n is a valid number, otherwise throw out of limits exception with information l...
Definition: limits.hpp:44
Generic domain change information to be supplied to advisors.
Definition: core.hpp:203
Propagation cost.
Definition: core.hpp:485
ExecStatus
Definition: core.hpp:471
Post propagator for SetVar x
Definition: set.hh:767
Gecode toplevel namespace
void reschedule(Space &home, Propagator &p, IntSet &y)
Definition: rel.hpp:92
int ModEventDelta
Modification event deltas.
Definition: core.hpp:89
Home class for posting propagators
Definition: core.hpp:853
struct Gecode::@593::NNF::@62::@64 a
For atomic nodes.
ViewValSupportArray(void)
Default constructor.
Definition: view.hpp:412
int size(void) const
Return the current size.
Definition: view.hpp:441
TFE post(PropagatorGroup g)
Only post functions (but not propagators) from g are considered.
Definition: filter.cpp:138