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

OrderingHeuristic.h

00001 // OrderingHeuristic.h -- The interface to the super class of all CSP
00002 // ordering heuristics.
00003 
00004 /*
00005  * Copyright (C) 1998 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: OrderingHeuristic_8h-source.html,v 1.1 2005/05/25 12:37:18 tudor Exp $
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 // Local Variables:
00153 // mode: C++
00154 // End:

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