Generated on Tue Jan 19 2021 06:15:49 for Gecode by doxygen 1.8.13
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  */
41  LinIntRel::LinIntRel(void) {}
42 
44  LinIntRel::LinIntRel(const LinIntExpr& l, IntRelType irt0, const LinIntExpr& r)
45  : e(l-r), irt(irt0) {}
46 
48  LinIntRel::LinIntRel(const LinIntExpr& l, IntRelType irt0, int r)
49  : e(l-r), irt(irt0) {}
50 
52  LinIntRel::LinIntRel(int l, IntRelType irt0, const LinIntExpr& r)
53  : e(l-r), irt(irt0) {}
54 
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, IntPropLevel ipl) const {
71  e.post(home,t ? irt : neg(irt),ipl);
72  }
73 
74  forceinline void
75  LinIntRel::post(Home home, const BoolVar& b, bool t, IntPropLevel ipl) const {
76  e.post(home,t ? irt : neg(irt),b,ipl);
77  }
78 
79 }
80 
81 // STATISTICS: minimodel-any
NodeType t
Type of node.
Definition: bool-expr.cpp:230
NNF * l
Left subtree.
Definition: bool-expr.cpp:240
Less or equal ( )
Definition: int.hh:928
Greater ( )
Definition: int.hh:931
#define forceinline
Definition: config.hpp:185
Greater or equal ( )
Definition: int.hh:930
Equality ( )
Definition: int.hh:926
IntRelType
Relation types for integers.
Definition: int.hh:925
struct Gecode::@593::NNF::@62::@63 b
For binary nodes (and, or, eqv)
void post(Home home, IntRelType irt, IntPropLevel ipl) const
Post propagator.
Definition: int-expr.cpp:156
Less ( )
Definition: int.hh:929
Boolean integer variables.
Definition: int.hh:512
Post propagator for SetVar SetOpType SetVar SetRelType r
Definition: set.hh:767
IntPropLevel
Propagation levels for integer propagators.
Definition: int.hh:974
Linear expressions over integer variables.
Definition: minimodel.hh:140
void post(Home home, bool t, IntPropLevel ipl) const
Post propagator for relation (if t is false for negated relation)
Definition: int-rel.hpp:70
Gecode toplevel namespace
Disequality ( )
Definition: int.hh:927
Home class for posting propagators
Definition: core.hpp:853
#define GECODE_NEVER
Assert that this command is never executed.
Definition: macros.hpp:56