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

projectors.cc

Go to the documentation of this file.
00001 /*
00002  *  Main authors:
00003  *     Guido Tack <tack@gecode.org>
00004  *
00005  *  Copyright:
00006  *     Guido Tack, 2006
00007  *
00008  *  Last modified:
00009  *     $Date: 2006-07-12 15:53:12 +0200 (Wed, 12 Jul 2006) $ by $Author: tack $
00010  *     $Revision: 3349 $
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/set/projectors/propagator.hh"
00023 
00024 using namespace Gecode::Set;
00025 
00026 namespace Gecode {
00027 
00028   void projector(Space* home, const SetVar& xa, const SetVar& ya,
00029                  ProjectorSet& ps, bool negated) {
00030     if (home->failed()) return;
00031     ViewArray<SetView> x(home, 2);
00032     x[0] = xa; x[1] = ya;
00033     if (negated) {
00034       GECODE_ES_FAIL(home,
00035                      (Projection::NaryProjection<true>::post(home, 
00036                                                              x, ps)));
00037     } else {
00038       GECODE_ES_FAIL(home,
00039                      (Projection::NaryProjection<false>::post(home, 
00040                                                               x, ps)));
00041     }
00042     
00043   }
00044 
00045   void projector(Space* home, const SetVar& xa, const SetVar& ya,
00046                  const BoolVar& bv, ProjectorSet& ps) {
00047     if (home->failed()) return;
00048     ViewArray<SetView> x(home, 2);
00049     x[0] = xa; x[1] = ya;
00050     Gecode::Int::BoolView b(bv);
00051     GECODE_ES_FAIL(home,
00052                    (Projection::ReNaryProjection::post(home, 
00053                                                        x, b, ps)));
00054   }
00055 
00056   void projector(Space* home,
00057                  const SetVar& xa, const SetVar& ya, const SetVar& za,
00058                  ProjectorSet& ps, bool negated) {
00059     if (home->failed()) return;
00060     ViewArray<SetView> x(home, 3);
00061     x[0] = xa; x[1] = ya; x[2] = za;
00062     if (negated) {
00063       GECODE_ES_FAIL(home,
00064                      (Projection::NaryProjection<true>::post(home, 
00065                                                              x, ps)));
00066     } else {
00067       GECODE_ES_FAIL(home,
00068                      (Projection::NaryProjection<false>::post(home, 
00069                                                               x, ps)));
00070     }
00071     
00072   }
00073 
00074   void projector(Space* home,
00075                  const SetVar& xa, const SetVar& ya, const SetVar& za,
00076                  const BoolVar& bv, ProjectorSet& ps) {
00077     if (home->failed()) return;
00078     ViewArray<SetView> x(home, 3);
00079     x[0] = xa; x[1] = ya; x[2] = za;
00080     Gecode::Int::BoolView b(bv);
00081     GECODE_ES_FAIL(home,
00082                    (Projection::ReNaryProjection::post(home, 
00083                                                           x, b, ps)));
00084   }
00085 
00086   void projector(Space* home, const SetVar& xa, const SetVar& ya,
00087                  const IntVar& i, Projector& p) {
00088     if (home->failed()) return;
00089     ViewArray<SetView> x(home, 2);
00090     x[0] = xa; x[1] = ya;
00091     Gecode::Int::IntView iv(i);
00092     GECODE_ES_FAIL(home,
00093                    (Projection::CardProjection::post(home,x,i,p)));
00094   }
00095 
00096   void projector(Space* home, const SetVar& xa, const SetVar& ya,
00097                  const SetVar& za, const IntVar& i, Projector& p) {
00098     if (home->failed()) return;
00099     ViewArray<SetView> x(home, 3);
00100     x[0] = xa; x[1] = ya; x[2] = za;
00101     Gecode::Int::IntView iv(i);
00102     GECODE_ES_FAIL(home,
00103                    (Projection::CardProjection::post(home,x,i,p)));
00104   }
00105   
00106 
00107 }
00108 
00109 // STATISTICS: set-post