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>
* Vincent Barichard <Vincent.Barichard@univ-angers.fr>
*
* Copyright:
* Christian Schulte, 2005
* Vincent Barichard, 2012
*
* 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/float.hh"
namespace Test { namespace Float {
namespace Basic {
class Basic : public Test {
public:
Basic(Gecode::FloatNum n, Gecode::FloatNum s)
: Test("Basic",3,-n,n,s,CPLT_ASSIGNMENT,true) {}
Basic(Gecode::FloatVal v, Gecode::FloatNum s)
: Test("Basic",3,v,s,CPLT_ASSIGNMENT,true) {}
virtual MaybeType solution(const Assignment&) const {
return MT_TRUE;
}
virtual void post(Gecode::Space&, Gecode::FloatVarArray&) {
}
virtual void post(Gecode::Space& home, Gecode::FloatVarArray&,
Gecode::Reify r) {
Gecode::rel(home, r.var(), Gecode::IRT_EQ, 1);
}
};
namespace {
Basic b1(3,1.5);
Basic b2(Gecode::FloatVal(-2,10),1.5);
}
}
}}
// STATISTICS: test-float
Gecode::FloatVal
Float value type.
Definition float.hh:334
Gecode::FloatVarArray
Float variable array.
Definition float.hh:1030
Gecode::Reify
Reification specification.
Definition int.hh:876
Gecode::Space
Computation spaces.
Definition core.hpp:1742
Test::Float::Assignment
Base class for assignments
Definition float.hh:80
Test::Float::Basic::Basic
Test whether testing infrastructure for float variables works
Definition basic.cpp:50
Test::Float::Basic::Basic::post
virtual void post(Gecode::Space &, Gecode::FloatVarArray &)
Post constraint on x.
Definition basic.cpp:63
Test::Float::Basic::Basic::post
virtual void post(Gecode::Space &home, Gecode::FloatVarArray &, Gecode::Reify r)
Post reified constraint on x for r.
Definition basic.cpp:66
Test::Float::Basic::Basic::Basic
Basic(Gecode::FloatNum n, Gecode::FloatNum s)
Initialize test.
Definition basic.cpp:53
Test::Float::Basic::Basic::Basic
Basic(Gecode::FloatVal v, Gecode::FloatNum s)
Initialize test.
Definition basic.cpp:56
Test::Float::Basic::Basic::solution
virtual MaybeType solution(const Assignment &) const
Check whether x is a solution.
Definition basic.cpp:59
Gecode::rel
void rel(Home home, FloatVar x0, FloatRelType frt, FloatVar x1)
Post propagator for .
Definition rel.cpp:68
Gecode::FloatNum
double FloatNum
Floating point number base type.
Definition float.hh:106
Gecode::IRT_EQ
@ IRT_EQ
Equality ( ).
Definition int.hh:926
Test::Float::Basic
Tests for basic setup
Definition basic.cpp:41
Test::Float
Testing domain floats.
Definition float.cpp:43
Test::Float::CPLT_ASSIGNMENT
@ CPLT_ASSIGNMENT
Definition float.hh:62
Test::Float::MaybeType
MaybeType
Type for comparisons and solutions.
Definition float.hh:51
Test::Float::MT_TRUE
@ MT_TRUE
Definition float.hh:53
Test
General test support.
Definition afc.cpp:39
Test::r
Region r
Definition region.cpp:65
float.hh