Generated on Tue Jan 19 2021 06:15:49 for Gecode by doxygen 1.8.13
support-values.hh
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, 2008
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 #ifndef __GECODE_INT_SUPPORT_VALUES_HH__
35 #define __GECODE_INT_SUPPORT_VALUES_HH__
36 
37 #include <gecode/int.hh>
38 
39 namespace Gecode { namespace Int {
40 
47  template<class View, class A>
48  class SupportValues {
49  private:
51  A& a;
53  class RangePos {
54  public:
55  int min;
56  unsigned int pos;
57  };
59  class Unsupported {
60  private:
62  RangePos* rp;
64  unsigned int p;
66  SupportValues& sv;
68  void find(void);
69  public:
71 
72  Unsupported(SupportValues& sv0);
75 
77 
78  bool operator ()(void) const;
81  void operator ++(void);
83 
85 
86  int val(void) const;
89  };
90 
92  View x;
96  RangePos* rp_fst;
98  RangePos* rp_lst;
100  RangePos* rp;
102  int v;
104  int max;
105 
107  bool _support(int n);
108  public:
110  SupportValues(A& a, View x);
112  ~SupportValues(void);
113 
115 
116  void reset(void);
119  bool operator ()(void) const;
121  void operator ++(void);
123 
125 
126  int val(void) const;
129 
131 
132  void support(void);
135  bool support(int n);
137  bool support(long long int n);
139  ModEvent tell(Space& home);
141  };
142 
143 }}
144 
146 
147 #endif
148 
149 // STATISTICS: int-prop
150 
ModEvent tell(Space &home)
Remove all unsupported values.
bool pos(const View &x)
Test whether x is postive.
Definition: mult.hpp:41
~SupportValues(void)
Destructor.
Basic bitset support.
void operator++(void)
Move iterator to next value (if possible)
int ModEvent
Type for modification events.
Definition: core.hpp:62
SupportValues(A &a, View x)
Initialize for view x.
Computation spaces.
Definition: core.hpp:1701
bool operator()(void) const
Test whether iterator is still at a value or done.
int p
Number of positive literals for node type.
Definition: bool-expr.cpp:232
int n
Number of negative literals for node type.
Definition: bool-expr.cpp:234
void reset(void)
Reset iterator.
void min(Home home, FloatVar x0, FloatVar x1, FloatVar x2)
Post propagator for .
Definition: arithmetic.cpp:67
void support(void)
Mark current (iterator) value as supported.
Node * x
Pointer to corresponding Boolean expression node.
Definition: bool-expr.cpp:249
int val(void) const
Return current value.
Gecode toplevel namespace
Support value iterator and recorder