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

bab.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: 2005-08-10 20:28:01 +0200 (Wed, 10 Aug 2005) $ by $Author: schulte $
00010  *     $Revision: 2202 $
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 "search/bab-copy.hh"
00023 #include "search/bab-reco.hh"
00024 
00025 namespace Gecode { namespace Search {
00026 
00027   BAB::BAB(Space* s, unsigned int c_d, unsigned int a_d, size_t sz) {
00028     unsigned int alt;
00029     unsigned long int p = 0;
00030     Space* c = (s->status(alt,p) == SS_FAILED) ? NULL : s->clone();
00031     if (c_d == 1) {
00032       e = new BabCopyEngine(c,sz);
00033     } else {
00034       e = new BabReCoEngine(c,c_d,a_d,sz);
00035     }
00036     e->propagate += p;
00037     e->current(s);
00038     e->current(NULL);
00039     e->current(c);
00040     if (c == NULL)
00041       e->fail += 1;
00042   }
00043 
00044   BAB::~BAB(void) {
00045     delete e;
00046   }
00047 
00048   Statistics
00049   BAB::statistics(void) const {
00050     Statistics s = *e;
00051     s.memory += e->stacksize();
00052     return s;
00053   }
00054 
00055 }}
00056 
00057 // STATISTICS: search-any