00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029 #ifndef _CSP_KERNEL_Solution_H
00030 #define _CSP_KERNEL_Solution_H
00031
00032
00033 CSP_NAMESPACE_BEGIN(csp);
00034
00035
00039 class CSP_API Solution
00040 {
00041 public:
00047 Solution(const vector<pair<const Variable*, const Value*> >& assignments);
00048
00050 virtual ~Solution() {}
00051
00053 id_t id() const { return m_id; }
00054
00056 void setId(id_t id) { m_id = id; }
00057
00065 const Value* lookup(const Variable& variable) const;
00066
00068 virtual wostream& print(wostream& wos) const;
00069
00071 friend CSP_API wostream& operator<<(
00072 wostream& wos, const Solution& solution)
00073 {
00074 return solution.print(wos);
00075 }
00076
00077 friend CSP_API bool operator==(
00078 const Solution& solution0,
00079 const Solution& solution1);
00080
00081 private:
00086 bool subsetOf(const Solution& solution) const;
00087
00089 typedef hash_map<const Variable*, const Value*> vv_type;
00090
00092 vv_type m_assignments;
00093
00095 id_t m_id;
00096 };
00097
00098
00099 CSP_NAMESPACE_END(csp);
00100
00101
00102 #endif // _CSP_KERNEL_Solution_H
00103
00104
00105
00106