Generated on Wed Nov 1 15:04:30 2006 for Gecode by doxygen 1.4.5

select-val.icc

Go to the documentation of this file.
00001 /*
00002  *  Main authors:
00003  *     Guido Tack <tack@gecode.org>
00004  *     Christian Schulte <schulte@gecode.org>
00005  *
00006  *  Contributing authors:
00007  *     Gabor Szokoli <szokoli@gecode.org>
00008  *
00009  *  Copyright:
00010  *     Guido Tack, 2004
00011  *     Christian Schulte, 2004
00012  *     Gabor Szokoli, 2004
00013  *
00014  *  Last modified:
00015  *     $Date: 2006-07-18 15:39:20 +0200 (Tue, 18 Jul 2006) $ by $Author: schulte $
00016  *     $Revision: 3390 $
00017  *
00018  *  This file is part of Gecode, the generic constraint
00019  *  development environment:
00020  *     http://www.gecode.org
00021  *
00022  *  See the file "LICENSE" for information on usage and
00023  *  redistribution of this file, and for a
00024  *     DISCLAIMER OF ALL WARRANTIES.
00025  *
00026  */
00027 
00028 namespace Gecode { namespace Set { namespace Branch {
00029 
00030   forceinline int
00031   ValMin::val(const Space*, SetView x) const {
00032     UnknownRanges<SetView> unknown(x);
00033     return unknown.min();
00034   }
00035   forceinline ModEvent
00036   ValMin::tell(Space* home, unsigned int a, SetView x, int v) {
00037     return (a == 0) ? x.include(home,v) : x.exclude(home,v);
00038   }
00039 
00040   forceinline int
00041   ValMax::val(const Space*, SetView x) const {
00042     int maxElem = 0;
00043     UnknownRanges<SetView> unknown(x);
00044     while (unknown()) {
00045       maxElem = unknown.max();
00046       ++unknown;
00047     }
00048     return maxElem;
00049   }
00050   forceinline ModEvent
00051   ValMax::tell(Space* home, unsigned int a, SetView x, int v) {
00052     return (a == 0) ? x.include(home,v) : x.exclude(home,v);
00053   }
00054 
00055   template <class SelView>
00056   static void
00057   create(Space* home, ViewArray<SetView>& x, SetBvalSel vals) {
00058     switch (vals) {
00059     case SETBVAL_MIN:
00060       (void) new (home) ViewValBranching<SetView,int,SelView,ValMin>(home,x);
00061       break;
00062     case SETBVAL_MAX:
00063       (void) new (home) ViewValBranching<SetView,int,SelView,ValMax>(home,x);
00064       break;
00065     default:
00066       throw UnknownBranching("Set::branch");
00067     }
00068   }
00069 
00070 }}}
00071 
00072 // STATISTICS: set-branch