/* * Main authors: * Christian Schulte * * Copyright: * Christian Schulte, 2002 * * Last modified: * $Date: 2006-08-04 16:03:26 +0200 (Fri, 04 Aug 2006) $ by $Author: schulte $ * $Revision: 3512 $ * * This file is part of Gecode, the generic constraint * development environment: * http://www.gecode.org * * See the file "LICENSE" for information on usage and * redistribution of this file, and for a * DISCLAIMER OF ALL WARRANTIES. * */ namespace Gecode { namespace Int { namespace Branch { forceinline int ValMin::val(const Space*, IntView x) const { return x.min(); } forceinline ModEvent ValMin::tell(Space* home, unsigned int a, IntView x, int n) { return (a == 0) ? x.eq(home,n) : x.gr(home,n); } forceinline int ValMed::val(const Space*, IntView x) const { return x.med(); } forceinline ModEvent ValMed::tell(Space* home, unsigned int a, IntView x, int n) { return (a == 0) ? x.eq(home,n) : x.nq(home,n); } forceinline int ValMax::val(const Space*, IntView x) const { return x.max(); } forceinline ModEvent ValMax::tell(Space* home, unsigned int a, IntView x, int n) { return (a == 0) ? x.eq(home,n) : x.le(home,n); } forceinline int ValSplitMin::val(const Space*, IntView x) const { return (x.width() == 2) ? x.min() : ((x.min()+x.max()) / 2); } forceinline ModEvent ValSplitMin::tell(Space* home, unsigned int a, IntView x, int n) { return (a == 0) ? x.lq(home,n) : x.gr(home,n); } forceinline int ValSplitMax::val(const Space*, IntView x) const { return (x.width() == 2) ? x.min() : ((x.min()+x.max()) / 2); } forceinline ModEvent ValSplitMax::tell(Space* home, unsigned int a, IntView x, int n) { return (a == 0) ? x.gr(home,n) : x.lq(home,n); } template void create(Space* home, ViewArray& x, BvalSel vals) { switch (vals) { case BVAL_MIN: (void) new (home) ViewValBranching(home,x); break; case BVAL_MED: (void) new (home) ViewValBranching(home,x); break; case BVAL_MAX: (void) new (home) ViewValBranching(home,x); break; case BVAL_SPLIT_MIN: (void) new (home) ViewValBranching(home,x); break; case BVAL_SPLIT_MAX: (void) new (home) ViewValBranching(home,x); break; default: throw UnknownBranching("Int::branch"); } } }}} // STATISTICS: int-branch