/* -*- mode: C++; c-basic-offset: 2; indent-tabs-mode: nil -*- */ /* * Main authors: * Christian Schulte * * Copyright: * Christian Schulte, 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. * */ namespace Gecode { namespace Int { namespace Branch { template forceinline ValCommitEq::ValCommitEq (Space& home, const ValBranch::Var>& vb) : ValCommit(home,vb) {} template forceinline ValCommitEq::ValCommitEq(Space& home, ValCommitEq& vc) : ValCommit(home,vc) {} template forceinline ModEvent ValCommitEq::commit(Space& home, unsigned int a, View x, int, int n) { return (a == 0) ? x.eq(home,n) : x.nq(home,n); } template forceinline NGL* ValCommitEq::ngl(Space& home, unsigned int a, View x, int n) const { if (a == 0) return new (home) EqNGL(home,x,n); else return nullptr; } template forceinline void ValCommitEq::print(const Space&, unsigned int a, View, int i, int n, std::ostream& o) const { o << "var[" << i << "] " << ((a == 0) ? "=" : "!=") << " " << n; } template forceinline ValCommitLq::ValCommitLq (Space& home, const ValBranch::Var>& vb) : ValCommit(home,vb) {} template forceinline ValCommitLq::ValCommitLq(Space& home, ValCommitLq& vc) : ValCommit(home,vc) {} template forceinline ModEvent ValCommitLq::commit(Space& home, unsigned int a, View x, int, int n) { return (a == 0) ? x.lq(home,n) : x.gr(home,n); } template forceinline NGL* ValCommitLq::ngl(Space& home, unsigned int a, View x, int n) const { if (a == 0) return new (home) LqNGL(home,x,n); else return nullptr; } template forceinline void ValCommitLq::print(const Space&, unsigned int a, View, int i, int n, std::ostream& o) const { o << "var[" << i << "] " << ((a == 0) ? "<=" : ">") << " " << n; } template forceinline ValCommitGq::ValCommitGq (Space& home, const ValBranch::Var>& vb) : ValCommit(home,vb) {} template forceinline ValCommitGq::ValCommitGq(Space& home, ValCommitGq& vc) : ValCommit(home,vc) {} template forceinline ModEvent ValCommitGq::commit(Space& home, unsigned int a, View x, int, int n) { return (a == 0) ? x.gq(home,n) : x.le(home,n); } template forceinline NGL* ValCommitGq::ngl(Space& home, unsigned int a, View x, int n) const { if (a == 0) return new (home) GqNGL(home,x,n); else return nullptr; } template forceinline void ValCommitGq::print(const Space&, unsigned int a, View, int i, int n, std::ostream& o) const { o << "var[" << i << "] " << ((a == 0) ? ">=" : "<") << " " << n; } template forceinline ValCommitGr::ValCommitGr (Space& home, const ValBranch::Var>& vb) : ValCommit(home,vb) {} template forceinline ValCommitGr::ValCommitGr(Space& home, ValCommitGr& vc) : ValCommit(home,vc) {} template forceinline ModEvent ValCommitGr::commit(Space& home, unsigned int a, View x, int, int n) { return (a == 0) ? x.gr(home,n) : x.lq(home,n); } template forceinline NGL* ValCommitGr::ngl(Space& home, unsigned int a, View x, int n) const { if (a == 0) return new (home) GqNGL(home,x,n+1); else return nullptr; } template forceinline void ValCommitGr::print(const Space&, unsigned int a, View, int i, int n, std::ostream& o) const { o << "var[" << i << "] " << ((a == 0) ? ">" : "<=") << " " << n; } }}} // STATISTICS: int-branch