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

MinDomainSizes.h

00001 // MinDomainSizes.h -- The interface to a cache of post-propagation
00002 // minimum domain sizes.
00003 
00004 /*
00005  * Copyright (C) 2004 Tudor Hulubei <tudor@hulubei.net>.
00006  *
00007  * This library is free software; you can redistribute it and/or modify
00008  * it under the terms of the GNU Lesser General Public License as
00009  * published by the Free Software Foundation; either version 2, or (at
00010  * your option) any later version.
00011  *
00012  * This library is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015  * GNU Lesser General Public License for more details.
00016  *
00017  * You should have received a copy of the GNU Lesser General Public
00018  * License along with this library; if not, write to the Free Software
00019  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA,
00020  * 02111-1307, USA.
00021  */
00022 
00023 /*
00024  * NOTE: This is an interal header file.
00025  * You should not attempt to use it directly.
00026  */
00027 
00028 // $Id: MinDomainSizes_8h-source.html,v 1.1 2005/05/25 12:37:18 tudor Exp $
00029 
00030 #ifndef _CSP_CACHES_MinDomainSizes_H
00031 #define _CSP_CACHES_MinDomainSizes_H
00032 
00033 
00034 CSP_NAMESPACE_BEGIN(csp);
00035 CSP_NAMESPACE_BEGIN(caches);
00036 
00037 
00042 class CSP_API MinDomainSizes
00043 {
00044   public:
00046     MinDomainSizes(Decomposition& decomposition) :
00047         m_decomposition(decomposition),
00048         m_variable(0) {}
00049 
00052     void init(const vlist_type& uninstantiatedVariables);
00053 
00062     void init(Variable& variable, Domain& domain);
00063 
00065     void done();
00066 
00072     void setVariable(const Variable& variable)
00073     {
00074         m_variable = &variable;
00075     }
00076 
00086     size_t minDomainSize(const Value& value) const;
00087 
00095     const hash_map<const Value*, size_t>& minDomainSizes(
00096         const Variable& variable) const;
00097 
00106     bool contains(const Variable& variable) const
00107     {
00108         return m_minDomainSizes.find(&variable) != m_minDomainSizes.end();
00109     }
00110 
00112     void clear() { m_minDomainSizes.clear(); }
00113 
00115     bool empty() { return m_minDomainSizes.empty(); }
00116 
00117   private:
00119     MinDomainSizes(const MinDomainSizes&);
00120 
00122     MinDomainSizes& operator=(const MinDomainSizes&);
00123 
00126     typedef hash_map<const Variable*, hash_map<const Value*, size_t> > mds_type;
00127 
00129     Decomposition& m_decomposition;
00130 
00132     mds_type m_minDomainSizes;
00133 
00135     const Variable* m_variable;
00136 };
00137 
00138 
00139 CSP_NAMESPACE_END(caches);
00140 CSP_NAMESPACE_END(csp);
00141 
00142 
00143 #endif // _CSP_KERNEL_MinDomainSizes_H
00144 
00145 // Local Variables:
00146 // mode: C++
00147 // End:

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