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

branch.cc

Go to the documentation of this file.
00001 /*
00002  *  Main authors:
00003  *     Christian Schulte <schulte@gecode.org>
00004  *
00005  *  Copyright:
00006  *     Christian Schulte, 2002
00007  *
00008  *  Last modified:
00009  *     $Date: 2006-04-11 15:58:37 +0200 (Tue, 11 Apr 2006) $ by $Author: tack $
00010  *     $Revision: 3188 $
00011  *
00012  *  This file is part of Gecode, the generic constraint
00013  *  development environment:
00014  *     http://www.gecode.org
00015  *
00016  *  See the file "LICENSE" for information on usage and
00017  *  redistribution of this file, and for a
00018  *     DISCLAIMER OF ALL WARRANTIES.
00019  *
00020  */
00021 
00022 #include "gecode/int/branch.hh"
00023 
00024 namespace Gecode {
00025 
00026   using namespace Int;
00027 
00028   void
00029   branch(Space* home, const IntVarArgs& x, BvarSel vars, BvalSel vals) {
00030     if (home->failed()) return;
00031     ViewArray<IntView> xv(home,x);
00032     switch (vars) {
00033     case BVAR_NONE:
00034       Branch::create<Branch::ByNone>(home,xv,vals); break;
00035     case BVAR_MIN_MIN:
00036       Branch::create<Branch::ByMinMin>(home,xv,vals); break;
00037     case BVAR_MIN_MAX:
00038       Branch::create<Branch::ByMinMax>(home,xv,vals); break;
00039     case BVAR_MAX_MIN:
00040       Branch::create<Branch::ByMaxMin>(home,xv,vals); break;
00041     case BVAR_MAX_MAX:
00042       Branch::create<Branch::ByMaxMax>(home,xv,vals); break;
00043     case BVAR_SIZE_MIN:
00044       Branch::create<Branch::BySizeMin>(home,xv,vals); break;
00045     case BVAR_SIZE_MAX:
00046       Branch::create<Branch::BySizeMax>(home,xv,vals); break;
00047     case BVAR_DEGREE_MIN:
00048       Branch::create<Branch::ByDegreeMin>(home,xv,vals); break;
00049     case BVAR_DEGREE_MAX:
00050       Branch::create<Branch::ByDegreeMax>(home,xv,vals); break;
00051     case BVAR_REGRET_MIN_MIN:
00052       Branch::create<Branch::ByRegretMinMin>(home,xv,vals); break;
00053     case BVAR_REGRET_MIN_MAX:
00054       Branch::create<Branch::ByRegretMinMax>(home,xv,vals); break;
00055     case BVAR_REGRET_MAX_MIN:
00056       Branch::create<Branch::ByRegretMaxMin>(home,xv,vals); break;
00057     case BVAR_REGRET_MAX_MAX:
00058       Branch::create<Branch::ByRegretMaxMax>(home,xv,vals); break;
00059     default:
00060       throw UnknownBranching("Int::branch");
00061     }
00062   }
00063 
00064   void
00065   assign(Space* home, const IntVarArgs& x, AvalSel vals) {
00066     if (home->failed()) return;
00067     ViewArray<IntView> xv(home,x);
00068     switch (vals) {
00069     case AVAL_MIN: (void) new (home) Branch::AssignMin(home,xv); break;
00070     case AVAL_MED: (void) new (home) Branch::AssignMed(home,xv); break;
00071     case AVAL_MAX: (void) new (home) Branch::AssignMax(home,xv); break;
00072     default:
00073       throw UnknownBranching("Int::assign");
00074     }
00075   }
00076 
00077 }
00078 
00079 
00080 // STATISTICS: int-post
00081