69 static const int n_ops = 8 * 1024;
71 static const int n = 16;
75 while (s[i] ==
nullptr)
97 for (
int o=
n_ops; o--; )
103 if ((s[i] !=
nullptr)) {
105 delete s[i]; s[i]=
nullptr; n_s--;
111 (void) s[j]->status();
120 delete s[i]; s[i]=
nullptr; n_s--;
144 TestSpace(
void) : x(*
this,0,10), y(*
this,0,10), b(*
this,0,1) {}
145 TestSpace(TestSpace& s) :
Space(s) {
146 x.
update(*
this,s.x); y.
update(*
this,s.y); b.update(*
this,s.b);
148 virtual Space*
copy(
void) {
return new TestSpace(*
this); }
152 if (ps.propagator().id() ==
id)
153 return &ps.propagator();
162 if ((
p ==
nullptr) || (ps.propagator().id() >
p->id()))
163 p = &ps.propagator();
172 if (s.post().
afc() != 1.0)
176 if ((s.post().
afc() != 0.0) || (other.post().
afc() != 1.0))
180 if (s.post().
afc() != 0.0)
184 if (s.post().
afc() != 0.0)
188 if (s.post().
afc() != 1.0)
192 if (s.post().
afc() != 0.0)
195 if (s.post().
afc() != 1.0)
198 if (s.post().
afc() != 0.0)
202 if (s.post().
afc() != 1.0)
206 if (s.post().
afc() != 0.0)
209 std::unique_ptr<TestSpace> c(
static_cast<TestSpace*
>(s.
clone()));
210 if (c->post().afc() != 1.0)
217 return s.post().
afc() == 1.0;
221 bool lifetime(
void) {
223 std::unique_ptr<TestSpace> s(
new TestSpace);
230 if ((p.
group() != a) || (s->post().id() ==
id))
235 std::unique_ptr<TestSpace> c(
static_cast<TestSpace*
>(s->clone()));
243 if ((p->
group() != b) || (s->find(
id)->group() != a))
250 return (c->find(
id) ==
nullptr) && (b.
size(*c) == 0);
254 bool failure(
bool local) {
265 std::unique_ptr<TestSpace> c(
static_cast<TestSpace*
>(s.
clone()));
270 if (!q || (q->
afc() != (local ? 0.0 : 1.0)))
276 return local ? ((q->
afc() == 0.0) && (p->
afc() == 0.0)) :
277 ((q->
afc() > 1.0) && (p->
afc() < 1.0));
281 bool rewrite(
bool local) {
303 if (!p || (p->
group() != g) ||
304 (p->
afc() != (local ? 0.0 : 1.0)))
313 return scopes() && lifetime() && failure(
false) && failure(
true) &&
314 rewrite(
false) && rewrite(
true);
Boolean integer variables.
FloatNum size(void) const
Return size of float value (distance between maximum and minimum).
Recording AFC information for integer variables.
Passing integer variables.
int val(void) const
Return assigned value.
static PropagatorGroup def
Group of propagators not in any user-defined group.
static PropagatorGroup all
Group of all propagators.
Base-class for propagators.
double afc(void) const
Return the accumulated failure count.
unsigned int id(void) const
Return propagator id.
PropagatorGroup group(void) const
Return group propagator belongs to.
bool disabled(void) const
Whether propagator is currently disabled.
Class to iterate over propagators in a group.
const Propagator & propagator(void) const
Return propagator.
Reification specification.
Suppress global propagator information during scoped posting.
Enable global propagator information during scoped posting.
struct Gecode::Space::@055132133326276162005044145100211202071356247106::@275070317317120154232063063134255170030071110047 p
Data only available during propagation or branching.
void update(Space &home, VarImpVar< VarImp > &y)
Update this variable to be a clone of variable y.
bool assigned(void) const
Test whether view is assigned.
void post(void)
Post arbitrary propagator.
TestSpace(TestSpace &s)
Constructor for cloning s.
TestSpace(void)
Constructor for creation.
virtual Space * copy(void)
Copy during cloning.
Gecode::IntVar x
Two integer variables.
Test for AFC infrastructure
AFC(void)
Initialize test.
static const int n
How many spaces to maintain.
bool run(void)
Perform actual tests.
static const int n_ops
How many test operations to be performed.
int index(void)
Return random index.
int space(TestSpace *s[])
Return random index of non-null space.
Base class for all tests to be run
Gecode::Support::RandomGenerator _rand
Random number generator.
Base(std::string s)
Create and register a standard test with name s.
Scoped suppression of global propagator information.
virtual bool run(void)
Run test.
void rel(Home home, FloatVar x0, FloatRelType frt, FloatVar x1)
Post propagator for .
Space(void)
Default constructor.
virtual Space * copy(void)=0
Copying member function.
Space * clone(void) const
Clone space.
SpaceStatus status(StatusStatistics &stat)
Query space status.
@ SS_SOLVED
Space is solved (no brancher left)
@ SS_FAILED
Space is failed
Gecode toplevel namespace
#define GECODE_NEVER
Assert that this command is never executed.