basic.cpp
Go to the documentation of this file.
/* -*- mode: C++; c-basic-offset: 2; indent-tabs-mode: nil -*- */
/*
* Main authors:
* Christian Schulte <schulte@gecode.org>
*
* Copyright:
* Christian Schulte, 2005
*
* This file is part of Gecode, the generic constraint
* development environment:
* http://www.gecode.org
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
*/
#include "test/int.hh"
namespace Test { namespace Int {
namespace Basic {
class Basic : public Test {
public:
Basic(int n)
: Test("Basic::A",3,-n,n,true) {}
Basic(Gecode::IntArgs& i)
: Test("Basic::B",3,Gecode::IntSet(i),true) {}
virtual bool solution(const Assignment&) const {
return true;
}
virtual void post(Gecode::Space&, Gecode::IntVarArray&) {
}
virtual void post(Gecode::Space& home, Gecode::IntVarArray&,
Gecode::Reify r) {
if (r.mode() != Gecode::RM_IMP)
Gecode::rel(home, r.var(), Gecode::IRT_EQ, 1);
}
};
Gecode::IntArgs i({1,2,3,4});
Basic b1(3);
Basic b2(i);
}
}}
// STATISTICS: test-int
Gecode::IntArgs
Passing integer arguments.
Definition int.hh:628
Gecode::IntVarArray
Integer variable array.
Definition int.hh:763
Gecode::Reify
Reification specification.
Definition int.hh:876
Gecode::Space
Computation spaces.
Definition core.hpp:1742
Test::Int::Assignment
Base class for assignments
Definition int.hh:59
Test::Int::Basic::Basic
Test whether testing infrastructure for integer variables works
Definition basic.cpp:48
Test::Int::Basic::Basic::post
virtual void post(Gecode::Space &, Gecode::IntVarArray &)
Post constraint on x.
Definition basic.cpp:61
Test::Int::Basic::Basic::post
virtual void post(Gecode::Space &home, Gecode::IntVarArray &, Gecode::Reify r)
Post reified constraint on x for r.
Definition basic.cpp:64
Test::Int::Basic::Basic::Basic
Basic(int n)
Initialize test.
Definition basic.cpp:51
Test::Int::Basic::Basic::Basic
Basic(Gecode::IntArgs &i)
Initialize test.
Definition basic.cpp:54
Test::Int::Basic::Basic::solution
virtual bool solution(const Assignment &) const
Check whether x is a solution.
Definition basic.cpp:57
Gecode::rel
void rel(Home home, FloatVar x0, FloatRelType frt, FloatVar x1)
Post propagator for .
Definition rel.cpp:68
Gecode::IRT_EQ
@ IRT_EQ
Equality ( ).
Definition int.hh:926
Gecode::RM_IMP
@ RM_IMP
Implication for reification.
Definition int.hh:862
Gecode
Gecode toplevel namespace
Test::Int::Basic::b2
Basic b2(i)
Test::Int::Basic::b1
Basic b1(3)
Test::Int::Basic::i
Gecode::IntArgs i({1, 2, 3, 4})
Test::Int
Testing finite domain integers.
Definition int.cpp:40
Test
General test support.
Definition afc.cpp:39
Test::r
Region r
Definition region.cpp:65
int.hh