Generated on Wed Jan 1 2020 10:37:59 for Gecode by doxygen 1.8.16
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,
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
struct Gecode::@602::NNF::@65::@66 b
For binary nodes (and, or, eqv)
IntRelType
Relation types for integers.
Definition: int.hh:925
Greater or equal ( )
Definition: int.hh:930
Less ( )
Definition: int.hh:929
NodeType t
Type of node.
Definition: bool-expr.cpp:230
Linear expressions over integer variables.
Definition: minimodel.hh:245
void post(Home home, IntRelType irt, const IntPropLevels &ipls) const
Post propagator.
Definition: int-expr.cpp:156
Class for specifying integer propagation levels used by minimodel.
Definition: minimodel.hh:101
Gecode toplevel namespace
Home class for posting propagators
Definition: core.hpp:856
Post propagator for SetVar SetOpType SetVar SetRelType r
Definition: set.hh:767
Boolean integer variables.
Definition: int.hh:512
#define GECODE_NEVER
Assert that this command is never executed.
Definition: macros.hpp:56
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
NNF * l
Left subtree.
Definition: bool-expr.cpp:240
#define forceinline
Definition: config.hpp:185
Equality ( )
Definition: int.hh:926
Disequality ( )
Definition: int.hh:927
Greater ( )
Definition: int.hh:931
Less or equal ( )
Definition: int.hh:928