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 * Copyright: 7 * Christian Schulte, 2016 8 * 9 * This file is part of Gecode, the generic constraint 10 * development environment: 11 * http://www.gecode.org 12 * 13 * Permission is hereby granted, free of charge, to any person obtaining 14 * a copy of this software and associated documentation files (the 15 * "Software"), to deal in the Software without restriction, including 16 * without limitation the rights to use, copy, modify, merge, publish, 17 * distribute, sublicense, and/or sell copies of the Software, and to 18 * permit persons to whom the Software is furnished to do so, subject to 19 * the following conditions: 20 * 21 * The above copyright notice and this permission notice shall be 22 * included in all copies or substantial portions of the Software. 23 * 24 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 25 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 26 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 27 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 28 * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 29 * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 30 * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 31 * 32 */ 33 34#ifndef GECODE_FLOAT_BOOL_HH 35#define GECODE_FLOAT_BOOL_HH 36 37#include <gecode/float.hh> 38 39/** 40 * \namespace Gecode::Float::Bool 41 * \brief Boolean propagators 42 */ 43 44namespace Gecode { namespace Float { namespace Bool { 45 46 /** 47 * \brief If-then-else propagator 48 * 49 * Requires \code #include <gecode/float/bool.hh> \endcode 50 * \ingroup FuncFloatProp 51 */ 52 template<class View> 53 class Ite : public Propagator { 54 protected: 55 /// View for condition 56 Int::BoolView b; 57 /// Views 58 View x0, x1, x2; 59 /// Constructor for cloning \a p 60 Ite(Space& home, Ite& p); 61 /// Constructor for creation 62 Ite(Home home, Int::BoolView b, View x0, View x1, View x2); 63 public: 64 /// Cost function (defined as low ternary) 65 virtual PropCost cost(const Space& home, const ModEventDelta& med) const; 66 /// Schedule function 67 virtual void reschedule(Space& home); 68 /// Copy propagator during cloning 69 virtual Actor* copy(Space& home); 70 /// Perform propagation 71 virtual ExecStatus propagate(Space& home, const ModEventDelta& med); 72 /// Post if-then-else propagator 73 static ExecStatus post(Home home, Int::BoolView b, 74 View x0, View x1, View x2); 75 /// Delete propagator and return its size 76 virtual size_t dispose(Space& home); 77 }; 78 79}}} 80 81#include <gecode/float/bool/ite.hpp> 82 83#endif 84 85// STATISTICS: float-prop 86