Generated on Thu Jul 6 07:06:48 2006 for Gecode by doxygen 1.4.7

dfs.cc

Go to the documentation of this file.
00001 /*
00002  *  Main authors:
00003  *     Christian Schulte <schulte@gecode.org>
00004  *
00005  *  Copyright:
00006  *     Christian Schulte, 2003
00007  *
00008  *  Last modified:
00009  *     $Date: 2006-05-17 16:00:08 +0200 (Wed, 17 May 2006) $ by $Author: schulte $
00010  *     $Revision: 3226 $
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/search.hh"
00023 
00024 namespace Gecode { namespace Search {
00025 
00026   /*
00027    * Control for DFS
00028    *
00029    */
00030 
00031   DFS::DFS(Space* s, unsigned int c_d, unsigned int a_d, Stop* st, size_t sz) 
00032     : e(c_d,a_d,st,sz) {
00033     unsigned int alt;
00034     unsigned long int p = 0;
00035     Space* c = (s->status(alt,p) == SS_FAILED) ? NULL : s->clone();
00036     e.init(c);
00037     e.propagate += p;
00038     e.current(s);
00039     e.current(NULL);
00040     e.current(c);
00041     if (c == NULL)
00042       e.fail += 1;
00043   }
00044   
00045   Space*
00046   DFS::next(void) {
00047     return e.explore();
00048   }
00049 
00050   bool
00051   DFS::stopped(void) const {
00052     return e.stopped();
00053   }
00054 
00055   Statistics
00056   DFS::statistics(void) const {
00057     Statistics s = e;
00058     s.memory += e.stacksize();
00059     return s;
00060   }
00061 
00062 }}
00063 
00064 // STATISTICS: search-any