00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef _CSP_HEURISTICS_VALUE_Lexical_H
00025 #define _CSP_HEURISTICS_VALUE_Lexical_H
00026
00027
00028 CSP_NAMESPACE_BEGIN(csp);
00029 CSP_NAMESPACE_BEGIN(heuristics);
00030 CSP_NAMESPACE_BEGIN(values);
00031
00032
00033 class LexicalIndexLT :
00034 public StrictWeakValueOrdering
00035 {
00036 public:
00037 LexicalIndexLT() {}
00038
00039 bool operator()(const Value* value0, const Value* value1)
00040 {
00041 return value0->id() < value1->id();
00042 }
00043 };
00044
00045
00046 class LexicalIndexGT :
00047 public StrictWeakValueOrdering
00048 {
00049 public:
00050 LexicalIndexGT() {}
00051
00052 bool operator()(const Value* value0, const Value* value1)
00053 {
00054 return value0->id() > value1->id();
00055 }
00056 };
00057
00058
00059 class LexicalIndexEQ :
00060 public StrictWeakValueOrdering
00061 {
00062 public:
00063 LexicalIndexEQ() {}
00064
00065 bool operator()(const Value* value0, const Value* value1)
00066 {
00067 return value0->id() == value1->id();
00068 }
00069 };
00070
00071
00076 class CSP_API Lexical :
00077 public ValueOH
00078 {
00079 public:
00089 Lexical(
00090 Decomposition& decomposition,
00091 const vector<pair<double, double> >& intervals,
00092 double quality = 1,
00093 bool analysis = false);
00094
00103 virtual void select(
00104 Domain& selectable,
00105 Domain& selected,
00106 Variable& variable);
00107
00116 virtual bool better(const Value& value0, const Value& value1);
00117
00125 virtual bool equal(const Value& value0, const Value& value1);
00126
00131 virtual void sort(
00132 Domain& original,
00133 Domain& sorted,
00134 Variable& variable);
00135
00147 virtual long double score(Variable& variable, const Value& value);
00148
00149 private:
00151 Lexical(const Lexical&);
00152
00154 Lexical& operator=(const Lexical&);
00155
00158 LexicalIndexLT m_compareLT;
00159
00162 LexicalIndexGT m_compareGT;
00163
00165 LexicalIndexEQ m_compareEQ;
00166 };
00167
00168
00169 CSP_NAMESPACE_END(values);
00170 CSP_NAMESPACE_END(heuristics);
00171 CSP_NAMESPACE_END(csp);
00172
00173
00174 #endif // _CSP_HEURISTICS_VALUE_Lexical_H
00175
00176
00177
00178