float.cpp
Go to the documentation of this file.
/* -*- mode: C++; c-basic-offset: 2; indent-tabs-mode: nil -*- */
/*
* Main authors:
* Mikael Lagerkvist <lagerkvist@gecode.org>
* Vincent Barichard <Vincent.Barichard@univ-angers.fr>
*
* Copyright:
* Mikael Lagerkvist, 2006
* 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/branch.hh"
#ifdef GECODE_HAS_FLOAT_VARS
namespace Test { namespace Branch {
class Float : public FloatTest {
public:
Float(const std::string& s, const Gecode::FloatVal& d, int n, int nbSols)
: FloatTest(s,n,d,nbSols) {}
virtual void post(Gecode::Space& home, Gecode::FloatVarArray& x) {
for (int i=0; i<x.size()-1; i++)
Gecode::rel(home, x[i], Gecode::FRT_LQ, x[i+1]);
}
};
namespace {
Gecode::FloatVal d_dense(-2,2);
Gecode::FloatVal d_large(-2,10);
Float d_3("Dense::3",d_dense,3,10);
Float d_5("Dense::5",d_dense,5,10);
Float l_2("Large::2",d_large,2,10);
Float l_3("Large::3",d_large,3,10);
}
}}
#endif
// STATISTICS: test-branch
Gecode::FloatVal
Float value type.
Definition float.hh:334
Gecode::FloatVarArray
Float variable array.
Definition float.hh:1030
Gecode::Space
Computation spaces.
Definition core.hpp:1742
Gecode::VarArray::size
int size(void) const
Return size of array (number of elements).
Definition array.hpp:926
Test::Branch::FloatTest::nbSols
int nbSols
Maximum number of solutions searched during solving.
Definition branch.hh:131
Test::Branch::FloatTest::FloatTest
FloatTest(const std::string &s, int a, const Gecode::FloatVal &d, int nbs)
Construct and register test.
Definition branch.cpp:898
Test::Branch::Float::Float
Float(const std::string &s, const Gecode::FloatVal &d, int n, int nbSols)
Create and register test.
Definition float.cpp:46
Test::Branch::Float::post
virtual void post(Gecode::Space &home, Gecode::FloatVarArray &x)
Post propagators on variables x.
Definition float.cpp:49
Gecode::rel
void rel(Home home, FloatVar x0, FloatRelType frt, FloatVar x1)
Post propagator for .
Definition rel.cpp:68
Gecode::FRT_LQ
@ FRT_LQ
Less or equal ( ).
Definition float.hh:1071
Test::Branch
Tests for branchings.
Definition branch.cpp:58
Test::Branch::d_5
Int d_5("Dense::5", d_dense, 5)
Test::Branch::d_large
Gecode::IntSet d_large(-2, 10)
Test::Branch::l_3
Int l_3("Large::3", d_large, 3)
Test::Branch::d_3
Int d_3("Dense::3", d_dense, 3)
Test::Branch::d_dense
Gecode::IntSet d_dense(-2, 2)
Test::Branch::l_2
Int l_2("Large::2", d_large, 2)
Test::Float
Testing domain floats.
Definition float.cpp:43
Test
General test support.
Definition afc.cpp:39
branch.hh