/* -*- mode: C++; c-basic-offset: 2; indent-tabs-mode: nil -*- */ /* * Main authors: * Christian Schulte * Mikael Lagerkvist * * Copyright: * Christian Schulte, 2005 * Mikael Lagerkvist, 2006 * * Last modified: * $Date: 2008-02-26 10:40:46 +0100 (Tue, 26 Feb 2008) $ by $Author: schulte $ * $Revision: 6311 $ * * 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. * */ namespace Test { namespace Int { /* * Assignments * */ inline Assignment::Assignment(int n0, const Gecode::IntSet& d0) : n(n0), d(d0) {} inline int Assignment::size(void) const { return n; } inline Assignment::~Assignment(void) {} inline CpltAssignment::CpltAssignment(int n, const Gecode::IntSet& d) : Assignment(n,d), dsv(new Gecode::IntSetValues[static_cast(n)]) { for (int i=n; i--; ) dsv[i].init(d); } inline bool CpltAssignment::operator()(void) const { return dsv[0](); } inline int CpltAssignment::operator[](int i) const { assert((i>=0) && (i skip) return it.min() + static_cast(skip); skip -= it.width(); } GECODE_NEVER; return 0; } inline RandomAssignment::RandomAssignment(int n, const Gecode::IntSet& d, int a0) : Assignment(n,d), vals(new int[n]), a(a0) { for (int i=n; i--; ) vals[i] = randval(); } inline bool RandomAssignment::operator()(void) const { return a>0; } inline int RandomAssignment::operator[](int i) const { assert((i>=0) && (i inline bool Test::cmp(T x, Gecode::IntRelType r, T y) { using namespace Gecode; switch (r) { case IRT_EQ: return x == y; case IRT_NQ: return x != y; case IRT_LQ: return x <= y; case IRT_LE: return x < y; case IRT_GR: return x > y; case IRT_GQ: return x >= y; default: ; } return false; } inline IntConLevels::IntConLevels(void) : i(sizeof(icls)/sizeof(Gecode::IntConLevel)-1) {} inline bool IntConLevels::operator()(void) const { return i>=0; } inline void IntConLevels::operator++(void) { i--; } inline Gecode::IntConLevel IntConLevels::icl(void) const { return icls[i]; } inline IntRelTypes::IntRelTypes(void) : i(sizeof(irts)/sizeof(Gecode::IntRelType)-1) {} inline void IntRelTypes::reset(void) { i = sizeof(irts)/sizeof(Gecode::IntRelType)-1; } inline bool IntRelTypes::operator()(void) const { return i>=0; } inline void IntRelTypes::operator++(void) { i--; } inline Gecode::IntRelType IntRelTypes::irt(void) const { return irts[i]; } inline BoolOpTypes::BoolOpTypes(void) : i(sizeof(bots)/sizeof(Gecode::BoolOpType)-1) {} inline bool BoolOpTypes::operator()(void) const { return i>=0; } inline void BoolOpTypes::operator++(void) { i--; } inline Gecode::BoolOpType BoolOpTypes::bot(void) const { return bots[i]; } }} // STATISTICS: test-int