this repo has no description
1/* -*- mode: C++; c-basic-offset: 2; indent-tabs-mode: nil -*- */ 2/* 3 * Main authors: 4 * Christian Schulte <schulte@gecode.org> 5 * 6 * Contributing authors: 7 * Vincent Barichard <Vincent.Barichard@univ-angers.fr> 8 * 9 * Copyright: 10 * Christian Schulte, 2008 11 * Vincent Barichard, 2012 12 * 13 * This file is part of Gecode, the generic constraint 14 * development environment: 15 * http://www.gecode.org 16 * 17 * Permission is hereby granted, free of charge, to any person obtaining 18 * a copy of this software and associated documentation files (the 19 * "Software"), to deal in the Software without restriction, including 20 * without limitation the rights to use, copy, modify, merge, publish, 21 * distribute, sublicense, and/or sell copies of the Software, and to 22 * permit persons to whom the Software is furnished to do so, subject to 23 * the following conditions: 24 * 25 * The above copyright notice and this permission notice shall be 26 * included in all copies or substantial portions of the Software. 27 * 28 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 29 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 30 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 31 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 32 * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 33 * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 34 * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 35 * 36 */ 37 38#ifndef GECODE_TEST_ASSIGN_HH 39#define GECODE_TEST_ASSIGN_HH 40 41#include <gecode/kernel.hh> 42#include <gecode/int.hh> 43#ifdef GECODE_HAS_SET_VARS 44#include <gecode/set.hh> 45#endif 46#ifdef GECODE_HAS_FLOAT_VARS 47#include <gecode/float.hh> 48#endif 49 50#include "test/test.hh" 51 52namespace Test { 53 54 /// Tests for assignments 55 namespace Assign { 56 57 /** 58 * \brief %Base class for tests for assigning integer variables 59 * 60 */ 61 class IntTest : public Base { 62 protected: 63 /// Number of variables 64 int arity; 65 /// Domain of variables 66 Gecode::IntSet dom; 67 public: 68 /// Construct and register test 69 IntTest(const std::string& s, int a, const Gecode::IntSet& d); 70 /// Perform test 71 virtual bool run(void); 72 /// Post assignment on variables \a x 73 virtual void post(Gecode::Space& home, Gecode::IntVarArray& x) = 0; 74 }; 75 76 /** 77 * \brief %Base class for tests for branching on Boolean variables 78 * 79 */ 80 class BoolTest : public Base { 81 protected: 82 /// Number of variables 83 int arity; 84 public: 85 /// Construct and register test 86 BoolTest(const std::string& s, int a); 87 /// Perform test 88 virtual bool run(void); 89 /// Post assignment on variables \a x 90 virtual void post(Gecode::Space& home, Gecode::BoolVarArray& x) = 0; 91 }; 92 93#ifdef GECODE_HAS_SET_VARS 94 95 /** 96 * \brief %Base class for tests for branching on set variables 97 * 98 */ 99 class SetTest : public Base { 100 protected: 101 /// Number of variables 102 int arity; 103 /// Upper bound of variable domains 104 Gecode::IntSet dom; 105 public: 106 /// Construct and register test 107 SetTest(const std::string& s, int a, const Gecode::IntSet& d); 108 /// Perform test 109 virtual bool run(void); 110 /// Post assignment on variables \a x 111 virtual void post(Gecode::Space& home, Gecode::SetVarArray& x) = 0; 112 }; 113 114#endif 115 116#ifdef GECODE_HAS_FLOAT_VARS 117 118 /** 119 * \brief %Base class for tests for branching on float variables 120 * 121 */ 122 class FloatTest : public Base { 123 protected: 124 /// Number of variables 125 int arity; 126 /// Domain of variables 127 Gecode::FloatVal dom; 128 public: 129 /// Construct and register test 130 FloatTest(const std::string& s, int a, const Gecode::FloatVal& d); 131 /// Perform test 132 virtual bool run(void); 133 /// Post assignment on variables \a x 134 virtual void post(Gecode::Space& home, Gecode::FloatVarArray& x) = 0; 135 }; 136 137#endif 138 139 } 140 141} 142 143#endif 144 145// STATISTICS: test-branch