Main Page | Class Hierarchy | Class List | File List | Class Members

AC1.h

00001 // AC1.h -- The AC-1 filter interface.
00002 
00003 /*
00004  * Copyright (C) 1998 Tudor Hulubei <tudor@hulubei.net>.
00005  *
00006  * This library is free software; you can redistribute it and/or modify
00007  * it under the terms of the GNU Lesser General Public License as
00008  * published by the Free Software Foundation; either version 2, or (at
00009  * your option) any later version.
00010  *
00011  * This library is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  * GNU Lesser General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU Lesser General Public
00017  * License along with this library; if not, write to the Free Software
00018  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA,
00019  * 02111-1307, USA.
00020  */
00021 
00022 // $Id: AC1_8h-source.html,v 1.1 2005/05/25 12:37:17 tudor Exp $
00023 
00024 #ifndef _CSP_FILTERS_AC1_H
00025 #define _CSP_FILTERS_AC1_H
00026 
00027 
00028 CSP_NAMESPACE_BEGIN(csp);
00029 CSP_NAMESPACE_BEGIN(filters);
00030 
00031 
00035 class CSP_API AC1 :
00036     public Filter
00037 {
00038   public:
00039     AC1(Problem& problem, Retraction& retraction) :
00040         Filter(L"Arc Consistency 1", L"AC-1", problem, retraction) {}
00041     ~AC1() {}
00042 
00043     virtual bool init(
00044         const vlist_type& uninstantiatedVariables,
00045         bool propagate = true);
00046     virtual void done() { Filter::done(); }
00047 
00048     virtual bool restoresArcConsistency() const { return true; }
00049 
00050     virtual bool propagate(
00051         const vlist_type& uninstantiatedVariables,
00052         const vlist_type& modifiedVariables,
00053         const bool keepChanges = true);
00054 
00055   private:
00057     AC1(const AC1&);
00058 
00060     AC1& operator=(const AC1&);
00061 
00069     bool prune(Constraint& constraint, Variable& variable);
00070 
00077     bool pruneVariablesInList(const vlist_type& vl);
00078 
00080     Domain m_diffs;
00081 
00083     bool m_changed;
00084 };
00085 
00086 
00087 CSP_NAMESPACE_END(filters);
00088 CSP_NAMESPACE_END(csp);
00089 
00090 
00091 #endif // _CSP_FILTERS_AC1_H
00092 
00093 // Local Variables:
00094 // mode: C++
00095 // End:

Generated on Wed May 25 12:21:13 2005 for csp.kdevelop by  doxygen 1.3.9.1