Generated on Tue Feb 11 2025 17:33:26 for Gecode by doxygen 1.12.0
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
40namespace 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:
77 ViewValSupportArray(Space& home, ViewArray<View>&, Val s, int q);
79 ViewValSupportArray(Space& home, int n);
81 int size(void) 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
NNF * l
Left subtree.
union Gecode::@603::NNF::@65 u
Union depending on nodetype t.
int p
Number of positive literals for node type.
int n
Number of negative literals for node type.
struct Gecode::@603::NNF::@65::@67 a
For atomic nodes.
Node * x
Pointer to corresponding Boolean expression node.
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
Sequence propagator for array of integers
Definition sequence.hh:101
virtual void reschedule(Space &home)
Schedule function.
Definition int.hpp:157
ExecStatus advise(Space &home, Advisor &_a, const Delta &d)
Advise function.
Definition int.hpp:71
static ExecStatus post(Home home, ViewArray< View > &x, Val s, int q, int l, int u)
Post propagator for.
Definition int.hpp:133
virtual Actor * copy(Space &home)
Perform copying during cloning.
Definition int.hpp:145
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
Definition int.hpp:167
static ExecStatus check(ViewArray< View > &x, Val s, int q, int l, int u)
Check for consistency.
Definition int.hpp:109
virtual size_t dispose(Space &home)
Delete propagator and return its size.
Definition int.hpp:99
virtual PropCost cost(const Space &home, const ModEventDelta &med) const
Cost function.
Definition int.hpp:151
Class for advising the propagator.
Definition view.hpp:44
An array of ViewValSupport data structures.
Definition sequence.hh:65
ViewValSupportArray(void)
Default constructor.
Definition view.hpp:412
void update(Space &home, ViewValSupportArray< View, Val, iss > &x)
Cloning.
Definition view.hpp:461
ExecStatus advise(Space &home, ViewArray< View > &a, Val s, int q, int j, const Delta &d)
Advise.
Definition view.hpp:482
ExecStatus propagate(Space &home, ViewArray< View > &a, Val s, int q, int l, int u)
Propagate.
Definition view.hpp:473
int size(void) const
Return the current size.
Definition view.hpp:441
ViewValSupport< View, Val, iss > & operator[](int n)
Access element n.
Definition view.hpp:447
Class for view value support structure.
Definition view.hpp:80
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
Gecode toplevel namespace
ExecStatus
Definition core.hpp:472
Post propagator for SetVar x
Definition set.hh:767