main page
modules
namespaces
classes
files
Gecode home
Generated on Fri Jan 10 2020 11:38:25 for Gecode by
doxygen
1.8.16
gecode
minimodel
int-rel.hpp
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
*
6
* Copyright:
7
* Christian Schulte, 2005
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
namespace
Gecode
{
35
36
/*
37
* Operations for linear expressions
38
*
39
*/
40
forceinline
41
LinIntRel::LinIntRel(
void
) {}
42
43
forceinline
44
LinIntRel::LinIntRel(
const
LinIntExpr
&
l
,
IntRelType
irt0,
const
LinIntExpr
&
r
)
45
: e(
l
-
r
), irt(irt0) {}
46
47
forceinline
48
LinIntRel::LinIntRel(
const
LinIntExpr
&
l
,
IntRelType
irt0,
int
r
)
49
: e(
l
-
r
), irt(irt0) {}
50
51
forceinline
52
LinIntRel::LinIntRel(
int
l
,
IntRelType
irt0,
const
LinIntExpr
&
r
)
53
: e(
l
-
r
), irt(irt0) {}
54
55
forceinline
IntRelType
56
LinIntRel::neg(
IntRelType
irt) {
57
switch
(irt) {
58
case
IRT_EQ
:
return
IRT_NQ
;
59
case
IRT_NQ
:
return
IRT_EQ
;
60
case
IRT_LQ
:
return
IRT_GR
;
61
case
IRT_LE
:
return
IRT_GQ
;
62
case
IRT_GQ
:
return
IRT_LE
;
63
case
IRT_GR
:
return
IRT_LQ
;
64
default
:
GECODE_NEVER
;
65
}
66
return
IRT_LQ
;
67
}
68
69
forceinline
void
70
LinIntRel::post
(
Home
home,
bool
t
,
71
const
IntPropLevels
& ipls)
const
{
72
e.
post
(home,
t
? irt : neg(irt),ipls);
73
}
74
75
forceinline
void
76
LinIntRel::post
(
Home
home,
const
BoolVar
&
b
,
bool
t
,
77
const
IntPropLevels
& ipls)
const
{
78
e.
post
(home,
t
? irt : neg(irt),
b
,ipls);
79
}
80
81
}
82
83
// STATISTICS: minimodel-any
b
struct Gecode::@602::NNF::@65::@66 b
For binary nodes (and, or, eqv)
Gecode::IntRelType
IntRelType
Relation types for integers.
Definition:
int.hh:925
Gecode::IRT_GQ
Greater or equal ( )
Definition:
int.hh:930
Gecode::IRT_LE
Less ( )
Definition:
int.hh:929
t
NodeType t
Type of node.
Definition:
bool-expr.cpp:230
Gecode::LinIntExpr
Linear expressions over integer variables.
Definition:
minimodel.hh:245
Gecode::LinIntExpr::post
void post(Home home, IntRelType irt, const IntPropLevels &ipls) const
Post propagator.
Definition:
int-expr.cpp:156
Gecode::IntPropLevels
Class for specifying integer propagation levels used by minimodel.
Definition:
minimodel.hh:101
Gecode
Gecode toplevel namespace
Gecode::Home
Home class for posting propagators
Definition:
core.hpp:856
Gecode::r
Post propagator for SetVar SetOpType SetVar SetRelType r
Definition:
set.hh:767
Gecode::BoolVar
Boolean integer variables.
Definition:
int.hh:512
GECODE_NEVER
#define GECODE_NEVER
Assert that this command is never executed.
Definition:
macros.hpp:56
Gecode::LinIntRel::post
void post(Home home, bool t, const IntPropLevels &ipls) const
Post propagator for relation (if t is false for negated relation)
Definition:
int-rel.hpp:70
l
NNF * l
Left subtree.
Definition:
bool-expr.cpp:240
forceinline
#define forceinline
Definition:
config.hpp:185
Gecode::IRT_EQ
Equality ( )
Definition:
int.hh:926
Gecode::IRT_NQ
Disequality ( )
Definition:
int.hh:927
Gecode::IRT_GR
Greater ( )
Definition:
int.hh:931
Gecode::IRT_LQ
Less or equal ( )
Definition:
int.hh:928