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

select.cc

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  *  Copyright:
00007  *     Guido Tack, 2004
00008  *     Christian Schulte, 2004
00009  *
00010  *  Last modified:
00011  *     $Date: 2006-04-25 17:01:15 +0200 (Tue, 25 Apr 2006) $ by $Author: tack $
00012  *     $Revision: 3215 $
00013  *
00014  *  This file is part of Gecode, the generic constraint
00015  *  development environment:
00016  *     http://www.gecode.org
00017  *
00018  *  See the file "LICENSE" for information on usage and
00019  *  redistribution of this file, and for a
00020  *     DISCLAIMER OF ALL WARRANTIES.
00021  *
00022  */
00023 
00024 #include "gecode/set/select.hh"
00025 
00026 using namespace Gecode::Set;
00027 
00028 namespace Gecode {
00029 
00030   void
00031   selectUnion(Space* home, const SetVarArgs& x, SetVar y, SetVar z) {
00032     if (home->failed()) return;
00033     Set::Select::IdxViewArray<ComplementView<SetView> > iv(home, x);
00034     IntSet universe(Limits::Set::int_min,
00035                     Limits::Set::int_max);
00036     SetView zv(z);
00037     ComplementView<SetView> cz(zv);
00038     GECODE_ES_FAIL(home,(Select::SelectIntersection<ComplementView<SetView>,
00039                          SetView>::post(home,cz,iv,y,universe)));
00040   }
00041 
00042   void
00043   selectInter(Space* home, const SetVarArgs& x, SetVar y, SetVar z) {
00044     if (home->failed()) return;
00045     Set::Select::IdxViewArray<SetView> iv(home, x);
00046     IntSet universe(Limits::Set::int_min,
00047                     Limits::Set::int_max);
00048     GECODE_ES_FAIL(home,
00049                    (Select::SelectIntersection<SetView,SetView>::
00050                     post(home,z,iv,y,universe)));
00051   }
00052 
00053   void
00054   selectInterIn(Space* home, const SetVarArgs& x, SetVar y, SetVar z,
00055                 const IntSet& universe) {
00056     if (home->failed()) return;
00057     Set::Select::IdxViewArray<SetView> iv(home, x);
00058     GECODE_ES_FAIL(home,
00059                    (Select::SelectIntersection<SetView,SetView>::
00060                     post(home,z,iv,y,universe)));
00061   }
00062 
00063   void
00064   selectSet(Space* home, const SetVarArgs& x, IntVar y, SetVar z) {
00065     if (home->failed()) return;
00066     Set::Select::IdxViewArray<ComplementView<SetView> > iv(home, x);
00067     Int::IntView yv(y);
00068     SingletonView single(yv);
00069     SetView zv(z);
00070     ComplementView<SetView> cz(zv);
00071     IntSet universe(Limits::Set::int_min,
00072                     Limits::Set::int_max);
00073     GECODE_ES_FAIL(home,(Select::SelectIntersection<ComplementView<SetView>,
00074                          SingletonView>::post(home, cz, iv,
00075                                               single, universe)));
00076   }
00077 
00078   void
00079   selectDisjoint(Space* home, const SetVarArgs& x, SetVar y) {
00080     if (home->failed()) return;
00081     Set::Select::IdxViewArray<SetView> iv(home, x);
00082     GECODE_ES_FAIL(home,Select::SelectDisjoint::post(home,iv,y));
00083   }
00084   
00085 }
00086 
00087 // STATISTICS: set-post
00088