Generated on Sat Feb 7 2015 02:01:17 for Gecode by doxygen 1.8.9.1
view.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, 2005
9  * Vincent Barichard, 2012
10  *
11  * Last modified:
12  * $Date: 2013-02-04 17:54:05 +0100 (Mon, 04 Feb 2013) $ by $Author: schulte $
13  * $Revision: 13260 $
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 #include <iostream>
41 
42 namespace Gecode { namespace Float {
43 
56  class FloatView : public VarImpView<FloatVar> {
57  protected:
59  public:
61 
62  FloatView(void);
65  FloatView(const FloatVar& y);
69 
71 
72  FloatVal domain(void) const;
75  FloatNum min(void) const;
77  FloatNum max(void) const;
79  FloatNum med(void) const;
87  FloatVal val(void) const;
88 
90  FloatNum size(void) const;
92 
94 
95  bool zero_in(void) const;
98  bool in(FloatNum n) const;
100  bool in(const FloatVal& n) const;
102 
104 
105  ModEvent lq(Space& home, int n);
108  ModEvent lq(Space& home, FloatNum n);
110  ModEvent lq(Space& home, FloatVal n);
111 
113  ModEvent gq(Space& home, int n);
115  ModEvent gq(Space& home, FloatNum n);
117  ModEvent gq(Space& home, FloatVal n);
118 
120  ModEvent eq(Space& home, int n);
122  ModEvent eq(Space& home, FloatNum n);
124  ModEvent eq(Space& home, const FloatVal& n);
125 
127 
129 
130  FloatNum min(const Delta& d) const;
133  FloatNum max(const Delta& d) const;
135 
137 
138  static ModEventDelta med(ModEvent me);
141  };
142 
147  template<class Char, class Traits>
148  std::basic_ostream<Char,Traits>&
149  operator <<(std::basic_ostream<Char,Traits>& os, const FloatView& x);
150 
158  class MinusView : public DerivedView<FloatView> {
159  protected:
161  public:
163 
164  MinusView(void);
167  explicit MinusView(const FloatView& y);
169 
171 
172  FloatVal domain(void) const;
175  FloatNum min(void) const;
177  FloatNum max(void) const;
179  FloatNum med(void) const;
187  FloatVal val(void) const;
188 
190  FloatNum size(void) const;
192 
194 
195  bool zero_in(void) const;
198  bool in(FloatNum n) const;
200  bool in(const FloatVal& n) const;
202 
204 
205  ModEvent lq(Space& home, int n);
208  ModEvent lq(Space& home, FloatNum n);
210  ModEvent lq(Space& home, FloatVal n);
211 
213  ModEvent gq(Space& home, int n);
215  ModEvent gq(Space& home, FloatNum n);
217  ModEvent gq(Space& home, FloatVal n);
218 
220  ModEvent eq(Space& home, int n);
222  ModEvent eq(Space& home, FloatNum n);
224  ModEvent eq(Space& home, const FloatVal& n);
225 
227 
229 
230  FloatNum min(const Delta& d) const;
233  FloatNum max(const Delta& d) const;
235 
237 
238  static ModEventDelta med(ModEvent me);
241  };
242 
247  template<class Char, class Traits>
248  std::basic_ostream<Char,Traits>&
249  operator <<(std::basic_ostream<Char,Traits>& os, const MinusView& x);
250 
251 
260  class OffsetView : public DerivedView<FloatView> {
261  protected:
265  public:
267 
268  OffsetView(void);
271  explicit OffsetView(const FloatView& y, FloatNum c);
273 
275 
276  FloatNum offset(void) const;
279  void offset(FloatNum n);
281  FloatVal domain(void) const;
283  FloatNum min(void) const;
285  FloatNum max(void) const;
287  FloatNum med(void) const;
295  FloatVal val(void) const;
296 
298  FloatNum size(void) const;
300 
302 
303  bool zero_in(void) const;
306  bool in(FloatNum n) const;
308  bool in(const FloatVal& n) const;
310 
312 
313  ModEvent lq(Space& home, int n);
316  ModEvent lq(Space& home, FloatNum n);
318  ModEvent lq(Space& home, FloatVal n);
319 
321  ModEvent gq(Space& home, int n);
323  ModEvent gq(Space& home, FloatNum n);
325  ModEvent gq(Space& home, FloatVal n);
326 
328  ModEvent eq(Space& home, int n);
330  ModEvent eq(Space& home, FloatNum n);
332  ModEvent eq(Space& home, const FloatVal& n);
333 
335 
337 
338  FloatNum min(const Delta& d) const;
341  FloatNum max(const Delta& d) const;
343 
345 
346  static ModEventDelta med(ModEvent me);
349 
351 
352  void update(Space& home, bool share, OffsetView& y);
354  };
355 
360  template<class Char, class Traits>
361  std::basic_ostream<Char,Traits>&
362  operator <<(std::basic_ostream<Char,Traits>& os, const OffsetView& x);
363 
373  class ScaleView : public DerivedView<FloatView> {
374  protected:
378 
379  public:
381 
382  ScaleView(void);
385  ScaleView(FloatVal b, const FloatView& y);
387 
389 
390  FloatVal domain(void) const;
393  FloatVal scale(void) const;
395  FloatNum min(void) const;
397  FloatNum max(void) const;
399  FloatNum med(void) const;
400 
408  FloatVal val(void) const;
409 
411  FloatNum size(void) const;
413 
415 
416  bool zero_in(void) const;
419  bool in(FloatNum n) const;
421  bool in(const FloatVal& n) const;
423 
425 
426  ModEvent lq(Space& home, int n);
429  ModEvent lq(Space& home, FloatNum n);
431  ModEvent lq(Space& home, FloatVal n);
432 
434  ModEvent gq(Space& home, int n);
436  ModEvent gq(Space& home, FloatNum n);
438  ModEvent gq(Space& home, FloatVal n);
439 
441  ModEvent eq(Space& home, int n);
443  ModEvent eq(Space& home, FloatNum n);
445  ModEvent eq(Space& home, const FloatVal& n);
446 
448 
450 
451  FloatNum min(const Delta& d) const;
454  FloatNum max(const Delta& d) const;
456 
458 
459  static ModEventDelta med(ModEvent me);
462 
464 
465  void update(Space& home, bool share, ScaleView& y);
467  };
468 
473  template<class Char, class Traits>
474  std::basic_ostream<Char,Traits>&
475  operator <<(std::basic_ostream<Char,Traits>& os, const ScaleView& x);
476 
477 } }
478 
486 
487 namespace Gecode { namespace Float {
494  enum RelTest {
496  RT_FALSE = 0,
497  RT_MAYBE = 1,
498  RT_TRUE = 2
499  };
500 
502  template<class View> RelTest rtest_eq(View x, View y);
504  template<class View> RelTest rtest_eq(View x, FloatVal n);
505 
507  template<class View> RelTest rtest_lq(View x, View y);
509  template<class View> RelTest rtest_lq(View x, FloatVal n);
510 
512  template<class View> RelTest rtest_le(View x, View y);
514  template<class View> RelTest rtest_le(View x, FloatVal n);
515 
517 
518 }}
519 
521 
522 // STATISTICS: float-var
RelTest rtest_lq(View x, View y)
Test whether view x is less or equal than view y.
Definition: rel-test.hpp:58
FloatVal scale(void) const
Return scale factor of scale view.
Definition: scale.hpp:58
FloatNum size(void) const
Return size of domain (distance between maximum and minimum)
Definition: float.hpp:81
FloatNum min(void) const
Return minimum of domain.
Definition: offset.hpp:70
FloatVal val(void) const
Return assigned value.
Definition: float.hpp:76
FloatNum med(void) const
Return median of domain (closest representation)
Definition: scale.hpp:74
ModEvent gq(Space &home, int n)
Restrict domain values to be greater or equal than n.
Definition: offset.hpp:128
FloatNum med(void) const
Return median of domain (closest representation)
Definition: offset.hpp:78
RelTest
Result of testing relation.
Definition: view.hpp:495
ModEvent lq(Space &home, int n)
Restrict domain values to be less or equal than n.
Definition: scale.hpp:111
FloatNum min(void) const
Return minimum of domain.
Definition: float.hpp:64
ModEvent gq(Space &home, int n)
Restrict domain values to be greater or equal than n.
Definition: float.hpp:122
FloatVal domain(void) const
Return domain.
Definition: scale.hpp:62
FloatNum size(void) const
Return size of domain (distance between maximum and minimum)
Definition: minus.hpp:78
FloatVal domain(void) const
Return domain.
Definition: offset.hpp:66
FloatNum offset(void) const
Return offset.
Definition: offset.hpp:58
OffsetView float view.
Definition: view.hpp:260
FloatNum size(void) const
Return size of domain (distance between maximum and minimum)
Definition: offset.hpp:87
Relation does hold.
Definition: view.hpp:498
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
Relation does not hold.
Definition: view.hpp:496
void update(Space &home, bool share, OffsetView &y)
Definition: offset.hpp:178
bool zero_in(void) const
Test whether 0 is contained in domain.
Definition: float.hpp:91
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: float.hpp:135
ModEvent eq(Space &home, int n)
Restrict domain values to be equal to n.
Definition: minus.hpp:132
bool in(FloatNum n) const
Test whether n is contained in domain.
Definition: offset.hpp:101
Gecode::IntSet d(v, 7)
FloatView(void)
Default constructor.
Definition: float.hpp:47
int n
Number of negative literals for node type.
Definition: bool-expr.cpp:238
ModEvent eq(Space &home, int n)
Restrict domain values to be equal to n.
Definition: offset.hpp:141
Float variable implementation.
Definition: var-imp.hpp:80
RelTest
Result of testing relation.
Definition: view.hpp:1614
OffsetView(void)
Default constructor.
Definition: offset.hpp:47
MinusView(void)
Default constructor.
Definition: minus.hpp:47
bool zero_in(void) const
Test whether 0 is contained in domain.
Definition: offset.hpp:97
bool in(FloatNum n) const
Test whether n is contained in domain.
Definition: float.hpp:95
ScaleView(void)
Default constructor.
Definition: scale.hpp:47
ModEvent gq(Space &home, int n)
Restrict domain values to be greater or equal than n.
Definition: scale.hpp:127
Base-class for variable implementation views.
Definition: view.hpp:117
FloatNum med(void) const
Return median of domain (closest representation)
Definition: minus.hpp:69
FloatVal val(void) const
Return assigned value.
Definition: offset.hpp:82
FloatVal a
Scale factor.
Definition: view.hpp:377
ModEvent gq(Space &home, int n)
Restrict domain values to be greater or equal than n.
Definition: minus.hpp:119
FloatNum size(void) const
Return size of domain (distance between maximum and minimum)
Definition: scale.hpp:83
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
FloatVal domain(void) const
Return domain.
Definition: float.hpp:60
FloatVal val(void) const
Return assigned value.
Definition: scale.hpp:78
Float value type.
Definition: float.hh:321
FloatVal val(void) const
Return assigned value.
Definition: minus.hpp:73
FloatNum min(void) const
Return minimum of domain.
Definition: scale.hpp:66
RelTest rtest_eq(View x, View y)
Test whether views x and y are equal.
Definition: rel-test.hpp:44
Node * x
Pointer to corresponding Boolean expression node.
Definition: bool-expr.cpp:253
Generic domain change information to be supplied to advisors.
Definition: core.hpp:275
FloatNum max(void) const
Return maximum of domain.
Definition: offset.hpp:74
Minus float view.
Definition: view.hpp:158
void update(Space &home, bool share, ScaleView &y)
Definition: scale.hpp:183
ModEvent lq(Space &home, int n)
Restrict domain values to be less or equal than n.
Definition: offset.hpp:115
static ModEvent me(const ModEventDelta &med)
Return modification event for view type in med.
FloatNum med(void) const
Return median of domain (closest representation)
Definition: float.hpp:72
FloatNum max(void) const
Return maximum of domain.
Definition: scale.hpp:70
bool in(FloatNum n) const
Test whether n is contained in domain.
Definition: scale.hpp:97
static ModEvent me(const ModEventDelta &med)
Return modification event for view type in med.
Float variables.
Definition: float.hh:857
RelTest rtest_le(View x, View y)
Test whether view x is less than view y.
Definition: rel-test.hpp:74
FloatNum max(void) const
Return maximum of domain.
Definition: float.hpp:68
bool zero_in(void) const
Test whether 0 is contained in domain.
Definition: scale.hpp:93
bool in(FloatNum n) const
Test whether n is contained in domain.
Definition: minus.hpp:92
struct Gecode::@518::NNF::@57::@58 b
For binary nodes (and, or, eqv)
Gecode toplevel namespace
Relation may hold or not.
Definition: view.hpp:497
int ModEventDelta
Modification event deltas.
Definition: core.hpp:173
double FloatNum
Floating point number base type.
Definition: float.hh:108
ModEvent lq(Space &home, int n)
Restrict domain values to be less or equal than n.
Definition: float.hpp:109
FloatNum min(void) const
Return minimum of domain.
Definition: minus.hpp:61
Scale float view.
Definition: view.hpp:373
ModEvent eq(Space &home, int n)
Restrict domain values to be equal to n.
Definition: scale.hpp:143
FloatNum c
Offset.
Definition: view.hpp:263