main page
modules
namespaces
classes
files
Gecode home
Generated on Wed Sep 5 2012 18:51:57 for Gecode by
doxygen
1.8.1.1
gecode
int
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 20:35:31 +1000 (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>
69
class
ViewValSupportArray
{
70
private
:
72
ViewValSupport<View,Val,iss>
* xs;
74
int
n;
75
public
:
77
ViewValSupportArray
(
void
);
79
ViewValSupportArray
(
const
ViewValSupportArray<View,Val,iss>
&);
81
ViewValSupportArray
(
Space
& home,
ViewArray<View>
&, Val s,
int
q);
83
ViewValSupportArray
(
Space
& home,
int
n);
85
int
size
(
void
)
const
;
87
ViewValSupport<View,Val,iss>
&
operator []
(
int
n);
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;
138
ViewValSupportArray<View,Val,true>
vvsamax;
140
ViewValSupportArray<View,Val,false>
vvsamin;
142
Council<SupportAdvisor<View>
> ac;
143
};
144
145
}}}
146
147
#include <
gecode/int/sequence/set-op.hpp
>
148
#include <
gecode/int/sequence/violations.hpp
>
149
#include <
gecode/int/sequence/int.hpp
>
150
#include <
gecode/int/sequence/view.hpp
>
151
152
#endif
153
154
// STATISTICS: int-prop