Generated on Wed Jan 4 17:49:14 2006 for Gecode by doxygen 1.4.6

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: 2005-11-11 18:26:30 +0100 (Fri, 11 Nov 2005) $ by $Author: tack $
00012  *     $Revision: 2544 $
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 "set/select.hh"
00025 
00026 using namespace Gecode::Set;
00027 
00028 namespace Gecode {
00029 
00030   void
00031   selectUnion(Space* home, const SetVarArgs& sn, SetVar s2, SetVar s1) {
00032     if (home->failed()) return;
00033     Set::Select::IdxViewArray<ComplementView<SetView> > iv(home, sn);
00034     IntSet universe(Limits::Set::int_min,
00035                      Limits::Set::int_max);
00036     SetView s1v(s1);
00037     ComplementView<SetView> cs1(s1v);
00038     GECODE_ES_FAIL(home,(Select::SelectIntersection<ComplementView<SetView>,
00039                          SetView>::post(home,cs1,iv,s2,universe)));
00040   }
00041 
00042   void
00043   selectInter(Space* home, const SetVarArgs& sn, SetVar s2, SetVar s1) {
00044     if (home->failed()) return;
00045     Set::Select::IdxViewArray<SetView> iv(home, sn);
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,s1,iv,s2,universe)));
00051   }
00052 
00053   void
00054   selectInterIn(Space* home, const SetVarArgs& sn, SetVar s2, SetVar s1,
00055                 const IntSet& universe) {
00056     if (home->failed()) return;
00057     Set::Select::IdxViewArray<SetView> iv(home, sn);
00058     GECODE_ES_FAIL(home,
00059                    (Select::SelectIntersection<SetView,SetView>::
00060                     post(home,s1,iv,s2,universe)));
00061   }
00062 
00063   void
00064   selectSets(Space* home, const SetVarArgs& sn, IntVar i, SetVar s) {
00065     if (home->failed()) return;
00066     Set::Select::IdxViewArray<ComplementView<SetView> > iv(home, sn);
00067     Int::IntView ii(i);
00068     SingletonView single(ii);
00069     SetView sv(s);
00070     ComplementView<SetView> cs(sv);
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, cs, iv, single, universe)));
00075   }
00076 
00077   void
00078   selectDisjoint(Space* home, const SetVarArgs& sn, SetVar s) {
00079     if (home->failed()) return;
00080     Set::Select::IdxViewArray<SetView> iv(home, sn);
00081     GECODE_ES_FAIL(home,Select::SelectDisjoint::post(home,iv,s));
00082   }
00083   
00084 }
00085 
00086 // STATISTICS: set-post
00087