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

seq.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 #include "gecode/set.hh"
00029 #include "gecode/set/sequence.hh"
00030 
00031 namespace Gecode { namespace Set { namespace Sequence {
00032 
00033   /*
00034    * "Sequence" propagator
00035    *
00036    */
00037 
00038   Actor*
00039   Seq::copy(Space* home, bool share) {
00040     return new (home) Seq(home,share,*this);
00041   }
00042 
00043   ExecStatus
00044   Seq::propagate(Space* home) {
00045     bool modified = false;
00046     bool assigned;
00047     do {
00048       assigned = false;
00049       GECODE_ES_CHECK(propagateSeq(home, modified, assigned, x));
00050     } while (assigned);
00051 
00052     for (int i=x.size(); i--;) {
00053       if (!x[i].assigned())
00054         return ES_FIX;
00055     }
00056     return ES_SUBSUMED;
00057   }
00058 
00059 }}}
00060 
00061 // STATISTICS: set-prop