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

values/Lexical.h

00001 // Lexical.h -- The `lexical' value ordering heuristic interface.
00002 
00003 /*
00004  * Copyright (C) 1998,2003,2004 Tudor Hulubei <tudor@hulubei.net>.
00005  *
00006  * This library is free software; you can redistribute it and/or modify
00007  * it under the terms of the GNU Lesser General Public License as
00008  * published by the Free Software Foundation; either version 2, or (at
00009  * your option) any later version.
00010  *
00011  * This library is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  * GNU Lesser General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU Lesser General Public
00017  * License along with this library; if not, write to the Free Software
00018  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA,
00019  * 02111-1307, USA.
00020  */
00021 
00022 // $Id: values_2Lexical_8h-source.html,v 1.1 2005/05/25 12:37:18 tudor Exp $
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 // Local Variables:
00177 // mode: C++
00178 // End:

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