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
00030 #ifndef _CSP_KERNEL_OrderingHeuristic_H
00031 #define _CSP_KERNEL_OrderingHeuristic_H
00032
00033
00034 CSP_NAMESPACE_BEGIN(csp);
00035
00036
00041 class CSP_API OrderingHeuristic
00042 {
00043 public:
00053 OrderingHeuristic(
00054 const wstring& name,
00055 Decomposition& decomposition,
00056 const vector<pair<double, double> >& intervals,
00057 double quality = 1) :
00058 m_name(name),
00059 m_decomposition(decomposition),
00060 m_intervals(intervals),
00061 m_quality(quality),
00062 m_invocations(0) {}
00063
00064 virtual ~OrderingHeuristic() {}
00065
00067 const wstring& name() const { return m_name; }
00068
00074 bool inRange() const;
00075
00080 const vector<pair<double, double> > intervals() const
00081 {
00082 return m_intervals;
00083 }
00084
00086 double quality() const { return m_quality; }
00087
00089 void recordCall() { m_invocations++; }
00090
00092 ulonglong invocations() const { return m_invocations; }
00093
00099 virtual wostream& print(wostream& wos) const;
00100
00101 friend CSP_API wostream& operator<<(
00102 wostream& wos, const OrderingHeuristic& orderingHeuristic)
00103 {
00104 return orderingHeuristic.print(wos);
00105 }
00106
00107 private:
00109 const wstring m_name;
00110
00111 protected:
00113 Decomposition& m_decomposition;
00114
00123 vector<pair<double, double> > m_intervals;
00124
00126 double m_quality;
00127
00129 ulonglong m_invocations;
00130
00136 vector<ulonglong> m_selectionSizes;
00137
00138 private:
00140 OrderingHeuristic(const OrderingHeuristic&);
00141
00143 OrderingHeuristic& operator=(const OrderingHeuristic&);
00144 };
00145
00146
00147 CSP_NAMESPACE_END(csp);
00148
00149
00150 #endif // _CSP_KERNEL_OrderingHeuristic_H
00151
00152
00153
00154