Generated on Sat Feb 7 2015 02:01:18 for Gecode by doxygen 1.8.9.1
minus.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  * Vincent Barichard <Vincent.Barichard@univ-angers.fr>
6  *
7  * Copyright:
8  * Christian Schulte, 2003
9  * Vincent Barichard, 2012
10  *
11  * Last modified:
12  * $Date: 2012-04-06 13:04:47 +0200 (Fri, 06 Apr 2012) $ by $Author: schulte $
13  * $Revision: 12711 $
14  *
15  * This file is part of Gecode, the generic constraint
16  * development environment:
17  * http://www.gecode.org
18  *
19  * Permission is hereby granted, free of charge, to any person obtaining
20  * a copy of this software and associated documentation files (the
21  * "Software"), to deal in the Software without restriction, including
22  * without limitation the rights to use, copy, modify, merge, publish,
23  * distribute, sublicense, and/or sell copies of the Software, and to
24  * permit persons to whom the Software is furnished to do so, subject to
25  * the following conditions:
26  *
27  * The above copyright notice and this permission notice shall be
28  * included in all copies or substantial portions of the Software.
29  *
30  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
31  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
32  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
33  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
34  * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
35  * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
36  * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
37  *
38  */
39 
40 namespace Gecode { namespace Float {
41 
42  /*
43  * Constructors and initialization
44  *
45  */
50  : DerivedView<FloatView>(y) {}
51 
52  /*
53  * Value access
54  *
55  */
57  MinusView::domain(void) const {
58  return -x.domain();
59  }
61  MinusView::min(void) const {
62  return -x.max();
63  }
65  MinusView::max(void) const {
66  return -x.min();
67  }
69  MinusView::med(void) const {
70  return -x.med();
71  }
73  MinusView::val(void) const {
74  return -x.val();
75  }
76 
78  MinusView::size(void) const {
79  return x.size();
80  }
81 
82 
83  /*
84  * Domain tests
85  *
86  */
87  forceinline bool
88  MinusView::zero_in(void) const {
89  return x.zero_in();
90  }
91  forceinline bool
93  return x.in(-n);
94  }
95  forceinline bool
96  MinusView::in(const FloatVal& n) const {
97  return x.in(-n);
98  }
99 
100 
101  /*
102  * Domain update by value
103  *
104  */
106  MinusView::lq(Space& home, int n) {
107  return x.gq(home,-n);
108  }
111  return x.gq(home,-n);
112  }
115  return x.gq(home,-n);
116  }
117 
119  MinusView::gq(Space& home, int n) {
120  return x.lq(home,-n);
121  }
124  return x.lq(home,-n);
125  }
128  return x.lq(home,-n);
129  }
130 
132  MinusView::eq(Space& home, int n) {
133  return x.eq(home,-n);
134  }
137  return x.eq(home,-n);
138  }
140  MinusView::eq(Space& home, const FloatVal& n) {
141  return x.eq(home,-n);
142  }
143 
144 
145  /*
146  * Delta information for advisors
147  *
148  */
150  MinusView::min(const Delta& d) const {
151  return -x.max(d);
152  }
154  MinusView::max(const Delta& d) const {
155  return -x.min(d);
156  }
157 
158 
161  return VarImpView<FloatVar>::med(me);
162  }
163 
164 }}
165 
166 // STATISTICS: float-var
167 
static ModEventDelta med(ModEvent me)
Translate modification event me to modification event delta for view.
Definition: view.hpp:484
FloatNum size(void) const
Return size of domain (distance between maximum and minimum)
Definition: minus.hpp:78
FloatVal domain(void) const
Return domain.
Definition: minus.hpp:57
int ModEvent
Type for modification events.
Definition: core.hpp:146
FloatNum max(void) const
Return maximum of domain.
Definition: minus.hpp:65
Computation spaces.
Definition: core.hpp:1362
Base-class for derived views.
Definition: view.hpp:208
bool zero_in(void) const
Test whether 0 is contained in domain.
Definition: minus.hpp:88
ModEvent eq(Space &home, int n)
Restrict domain values to be equal to n.
Definition: minus.hpp:132
Gecode::IntSet d(v, 7)
int n
Number of negative literals for node type.
Definition: bool-expr.cpp:238
MinusView(void)
Default constructor.
Definition: minus.hpp:47
FloatNum med(void) const
Return median of domain (closest representation)
Definition: minus.hpp:69
ModEvent gq(Space &home, int n)
Restrict domain values to be greater or equal than n.
Definition: minus.hpp:119
Float view for float variables.
Definition: view.hpp:56
ModEvent lq(Space &home, int n)
Restrict domain values to be less or equal than n.
Definition: minus.hpp:106
Float value type.
Definition: float.hh:321
FloatVal val(void) const
Return assigned value.
Definition: minus.hpp:73
Generic domain change information to be supplied to advisors.
Definition: core.hpp:275
#define forceinline
Definition: config.hpp:132
FloatView x
View from which this view is derived.
Definition: view.hpp:216
bool in(FloatNum n) const
Test whether n is contained in domain.
Definition: minus.hpp:92
Gecode toplevel namespace
int ModEventDelta
Modification event deltas.
Definition: core.hpp:173
double FloatNum
Floating point number base type.
Definition: float.hh:108
FloatNum min(void) const
Return minimum of domain.
Definition: minus.hpp:61