Sha256: b7b8b3589743e14c2fe7617070349804f377a319e5b816ca5579dfd4fd44f8d9
Contents?: true
Size: 1.87 KB
Versions: 1
Compression:
Stored size: 1.87 KB
Contents
/* * Main authors: * Christian Schulte <schulte@gecode.org> * * Contributing authors: * Guido Tack <tack@gecode.org> * * Copyright: * Christian Schulte, 2004 * Guido Tack, 2004 * * Last modified: * $Date: 2006-08-04 16:03:17 +0200 (Fri, 04 Aug 2006) $ by $Author: schulte $ * $Revision: 3511 $ * * This file is part of Gecode, the generic constraint * development environment: * http://www.gecode.org * * See the file "LICENSE" for information on usage and * redistribution of this file, and for a * DISCLAIMER OF ALL WARRANTIES. * */ namespace Gecode { /* * BAB search engine * */ namespace Search { forceinline BabEngine::BabEngine(unsigned int c_d0, unsigned int a_d, Stop* st, size_t sz) : EngineCtrl(st,sz), rcs(a_d), cur(NULL), mark(0), es(ES_SOLUTION), best(NULL), c_d(c_d0), d(0) {} forceinline void BabEngine::init(Space* s) { cur = s; } forceinline size_t BabEngine::stacksize(void) const { return rcs.stacksize(); } forceinline BabEngine::~BabEngine(void) { rcs.reset(); delete best; delete cur; } } /* * Control for bab search engine * */ template <class T> forceinline BAB<T>::BAB(T* s, unsigned int c_d, unsigned int a_d, Search::Stop* st) : Search::BAB(s,c_d,a_d,st,sizeof(T)) {} template <class T> forceinline T* BAB<T>::next(void) { Space *s1, *s2; while (e.explore(s1,s2) == Search::BabEngine::ES_CONSTRAIN) static_cast<T*>(s1)->constrain(static_cast<T*>(s2)); return static_cast<T*>(s1); } /* * BAB convenience * */ template <class T> T* bab(T* s, unsigned int c_d, unsigned int a_d, Search::Stop* st) { BAB<T> b(s,c_d,a_d,st); T* l = NULL; while (T* n = b.next()) { delete l; l = n; } return l; } } // STATISTICS: search-any
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
gecoder-with-gecode-0.7.1 | ext/gecode-1.3.1/gecode/search/bab.icc |