main page
modules
namespaces
classes
files
Gecode home
Generated on Sat Nov 9 2013 19:18:26 for Gecode by
doxygen
1.8.4
gecode
float
linear.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
* Guido Tack <tack@gecode.org>
6
* Vincent Barichard <Vincent.Barichard@univ-angers.fr>
7
*
8
* Copyright:
9
* Christian Schulte, 2002
10
* Guido Tack, 2004
11
* Vincent Barichard, 2012
12
*
13
* Last modified:
14
* $Date: 2013-01-24 19:28:06 +0100 (Thu, 24 Jan 2013) $ by $Author: schulte $
15
* $Revision: 13235 $
16
*
17
* This file is part of Gecode, the generic constraint
18
* development environment:
19
* http://www.gecode.org
20
*
21
* Permission is hereby granted, free of charge, to any person obtaining
22
* a copy of this software and associated documentation files (the
23
* "Software"), to deal in the Software without restriction, including
24
* without limitation the rights to use, copy, modify, merge, publish,
25
* distribute, sublicense, and/or sell copies of the Software, and to
26
* permit persons to whom the Software is furnished to do so, subject to
27
* the following conditions:
28
*
29
* The above copyright notice and this permission notice shall be
30
* included in all copies or substantial portions of the Software.
31
*
32
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
33
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
34
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
35
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
36
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
37
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
38
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
39
*
40
*/
41
42
#ifndef __GECODE_FLOAT_LINEAR_HH__
43
#define __GECODE_FLOAT_LINEAR_HH__
44
45
#include <
gecode/int.hh
>
46
#include <
gecode/float.hh
>
47
53
namespace
Gecode {
namespace
Float {
namespace
Linear {
54
60
template
<
class
P,
class
N, PropCond pc>
61
class
Lin
:
public
Propagator
{
62
protected
:
64
ViewArray<P>
x
;
66
ViewArray<N>
y
;
68
FloatVal
c
;
69
71
Lin
(
Space
& home,
bool
share,
Lin<P,N,pc>
&
p
);
73
Lin
(
Home
home,
ViewArray<P>
&
x
,
ViewArray<N>
&
y
,
FloatVal
c
);
74
public
:
76
virtual
PropCost
cost
(
const
Space
& home,
const
ModEventDelta
&
med
)
const
;
78
virtual
size_t
dispose
(
Space
& home);
79
};
80
86
template
<
class
View>
87
void
bounds_p
(
ModEventDelta
med,
ViewArray<View>
&
x
,
88
FloatVal
&
c
,
FloatNum
& sl,
FloatNum
& su);
89
95
template
<
class
View>
96
void
bounds_n
(
ModEventDelta
med,
ViewArray<View>
& y,
97
FloatVal
&
c
,
FloatNum
& sl,
FloatNum
& su);
98
107
template
<
class
P,
class
N>
108
class
Eq
:
public
Lin
<P,N,PC_FLOAT_BND> {
109
protected
:
110
using
Lin<P,N,PC_FLOAT_BND>::x
;
111
using
Lin<P,N,PC_FLOAT_BND>::y
;
112
using
Lin<P,N,PC_FLOAT_BND>::c
;
113
115
Eq
(
Space
& home,
bool
share,
Eq
&
p
);
116
public
:
118
Eq
(
Home
home,
ViewArray<P>
&
x
,
ViewArray<N>
&
y
,
FloatVal
c
);
120
virtual
Actor
*
copy
(
Space
& home,
bool
share);
122
virtual
ExecStatus
propagate
(
Space
& home,
const
ModEventDelta
&
med
);
124
static
ExecStatus
125
post
(
Home
home,
ViewArray<P>
& x,
ViewArray<N>
& y,
FloatVal
c);
126
};
127
128
137
template
<
class
P,
class
N>
138
class
Lq
:
public
Lin
<P,N,PC_FLOAT_BND> {
139
protected
:
140
using
Lin<P,N,PC_FLOAT_BND>::x
;
141
using
Lin<P,N,PC_FLOAT_BND>::y
;
142
using
Lin<P,N,PC_FLOAT_BND>::c
;
143
145
Lq
(
Space
& home,
bool
share,
Lq
&
p
);
146
public
:
148
Lq
(
Home
home,
ViewArray<P>
&
x
,
ViewArray<N>
&
y
,
FloatVal
c
);
150
virtual
Actor
*
copy
(
Space
& home,
bool
share);
152
virtual
ExecStatus
propagate
(
Space
& home,
const
ModEventDelta
&
med
);
154
static
ExecStatus
155
post
(
Home
home,
ViewArray<P>
& x,
ViewArray<N>
& y,
FloatVal
c);
156
};
157
158
}}}
159
160
#include <
gecode/float/linear/nary.hpp
>
161
162
namespace
Gecode {
namespace
Float {
namespace
Linear {
163
168
class
Term
{
169
public
:
171
FloatVal
a
;
173
FloatView
x
;
174
};
175
190
GECODE_FLOAT_EXPORT
void
191
estimate
(
Term
*
t
,
int
n
,
FloatVal
c
,
FloatNum
&
l
,
FloatNum
&
u
);
192
209
GECODE_FLOAT_EXPORT
void
210
post
(
Home
home,
Term
*
t
,
int
n
,
FloatRelType
frt,
FloatVal
c
);
211
229
GECODE_FLOAT_EXPORT
void
230
post
(
Home
home,
Term
*
t
,
int
n
,
FloatRelType
frt,
FloatVal
c
,
Reify
r
);
231
232
}}}
233
234
#endif
235
236
// STATISTICS: float-prop