/* -*- mode: C++; c-basic-offset: 2; indent-tabs-mode: nil -*- */ /* * Main authors: * Christian Schulte * * Copyright: * Christian Schulte, 2013 * * 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 Gecode { namespace Int { namespace Branch { template forceinline EqNGL::EqNGL(Space& home, View x, int n) : ViewValNGL(home,x,n) {} template forceinline EqNGL::EqNGL(Space& home, EqNGL& ngl) : ViewValNGL(home,ngl) {} template NGL* EqNGL::copy(Space& home) { return new (home) EqNGL(home,*this); } template NGL::Status EqNGL::status(const Space&) const { if (x.assigned()) return (x.val() == n) ? NGL::SUBSUMED : NGL::FAILED; else return x.in(n) ? NGL::NONE : NGL::FAILED; } template ExecStatus EqNGL::prune(Space& home) { return me_failed(x.nq(home,n)) ? ES_FAILED : ES_OK; } template forceinline NqNGL::NqNGL(Space& home, View x, int n) : ViewValNGL(home,x,n) {} template forceinline NqNGL::NqNGL(Space& home, NqNGL& ngl) : ViewValNGL(home,ngl) {} template NGL* NqNGL::copy(Space& home) { return new (home) NqNGL(home,*this); } template NGL::Status NqNGL::status(const Space&) const { if (x.assigned()) return (x.val() == n) ? NGL::FAILED : NGL::SUBSUMED; else return x.in(n) ? NGL::NONE : NGL::SUBSUMED; } template ExecStatus NqNGL::prune(Space& home) { return me_failed(x.eq(home,n)) ? ES_FAILED : ES_OK; } template forceinline LqNGL::LqNGL(Space& home, View x, int n) : ViewValNGL(home,x,n) {} template forceinline LqNGL::LqNGL(Space& home, LqNGL& ngl) : ViewValNGL(home,ngl) {} template NGL* LqNGL::copy(Space& home) { return new (home) LqNGL(home,*this); } template NGL::Status LqNGL::status(const Space&) const { if (x.max() <= n) return NGL::SUBSUMED; else if (x.min() > n) return NGL::FAILED; else return NGL::NONE; } template ExecStatus LqNGL::prune(Space& home) { return me_failed(x.gr(home,n)) ? ES_FAILED : ES_OK; } template forceinline GqNGL::GqNGL(Space& home, View x, int n) : ViewValNGL(home,x,n) {} template forceinline GqNGL::GqNGL(Space& home, GqNGL& ngl) : ViewValNGL(home,ngl) {} template NGL* GqNGL::copy(Space& home) { return new (home) GqNGL(home,*this); } template NGL::Status GqNGL::status(const Space&) const { if (x.min() >= n) return NGL::SUBSUMED; else if (x.max() < n) return NGL::FAILED; else return NGL::NONE; } template ExecStatus GqNGL::prune(Space& home) { return me_failed(x.le(home,n)) ? ES_FAILED : ES_OK; } }}} // STATISTICS: int-branch