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

AC8.h

00001 // AC8.h -- The AC-8 filter interface.
00002 
00003 /*
00004  * Copyright (C) 2003-2004 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: AC8_8h-source.html,v 1.1 2005/05/25 12:37:18 tudor Exp $
00023 
00024 #ifndef _CSP_FILTERS_AC8_H
00025 #define _CSP_FILTERS_AC8_H
00026 
00027 
00028 CSP_NAMESPACE_BEGIN(csp);
00029 CSP_NAMESPACE_BEGIN(filters);
00030 
00031 
00038 class CSP_API AC8 :
00039     public Filter
00040 {
00041   public:
00042     AC8(Problem& problem, Retraction& retraction) :
00043         Filter(L"Arc Consistency 8", L"AC-8", problem, retraction) {}
00044     ~AC8() {}
00045 
00046     virtual bool init(
00047         const vlist_type& uninstantiatedVariables,
00048         bool propagate = true);
00049     virtual void done() { Filter::done(); }
00050 
00051     virtual bool restoresArcConsistency() const { return true; }
00052 
00053     virtual bool propagate(
00054         const vlist_type& uninstantiatedVariables,
00055         const vlist_type& modifiedVariables,
00056         const bool keepChanges = true);
00057 
00058   private:
00060     AC8(const AC8&);
00061 
00063     AC8& operator=(const AC8&);
00064 
00070     void insertInQueue(Variable& variable);
00071 
00077     void removeFromQueue(Variable& variable);
00078 
00085     bool isInQueue(const Variable& variable);
00086 
00088     Domain m_diffs;
00089 
00091     deque<Variable*> m_queue;
00092 
00094     hash_set<const Variable*> m_inQueue;
00095 };
00096 
00097 
00098 CSP_NAMESPACE_END(filters);
00099 CSP_NAMESPACE_END(csp);
00100 
00101 
00102 #endif // _CSP_FILTERS_AC8_H
00103 
00104 // Local Variables:
00105 // mode: C++
00106 // End:

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