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

card.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  *  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-04-11 15:58:37 +0200 (Tue, 11 Apr 2006) $ by $Author: tack $
00016  *     $Revision: 3188 $
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 
00029 
00030 #include "gecode/set/int.hh"
00031 
00032 #include "gecode/iter.hh"
00033 
00034 #include "gecode/set/rel.hh"
00035 
00036 namespace Gecode { namespace Set { namespace Int {
00037 
00038   Actor*
00039   Card::copy(Space* home, bool share) {
00040     return new (home) Card(home,share,*this);
00041   }
00042 
00043   ExecStatus
00044   Card::propagate(Space* home) {
00045     int x1min, x1max;
00046     do {
00047       x1min = x1.min();
00048       x1max = x1.max();
00049       GECODE_ME_CHECK(x0.cardMin(home,x1min));
00050       GECODE_ME_CHECK(x0.cardMax(home,x1max));
00051       GECODE_ME_CHECK(x1.gq(home,(int)x0.cardMin()));
00052       GECODE_ME_CHECK(x1.lq(home,(int)x0.cardMax()));
00053     } while (x1.min() > x1min || x1.max() < x1max);
00054     if (x1.assigned())
00055       return ES_SUBSUMED;
00056     return ES_FIX;
00057   }
00058 
00059 }}}
00060 
00061 // STATISTICS: set-prop