00001 /************************************************************************** 00002 * Copyright (c) 2007 Clifford Conley Owens III * 00003 * * 00004 * This file is part of Biorithm. * 00005 * * 00006 * Biorithm is free software: you can redistribute it and/or modify * 00007 * it under the terms of the GNU General Public License as published by * 00008 * the Free Software Foundation, either version 3 of the License, or * 00009 * (at your option) any later version. * 00010 * * 00011 * Biorithm 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 General Public License for more details. * 00015 * * 00016 * You should have received a copy of the GNU General Public License * 00017 * along with Biorithm. If not, see <http://www.gnu.org/licenses/>. * 00018 * * 00019 **************************************************************************/ 00020 00032 #ifndef LATTICEFILTER_H 00033 #define LATTICEFILTER_H 00034 00035 // ---------------------------- Internal Headers ---------------------------- // 00036 00037 #include "Filter.h" 00038 00039 // ---------------------------- External Headers ---------------------------- // 00040 00041 #include "graph.h" 00042 // conley, you will have to check out src/c++/apriori from svn for this file. 00043 #include "dag.h" 00044 00045 struct DummyClass 00046 { 00047 string id; 00048 DummyClass(string i) 00049 : id(i) 00050 {} 00051 virtual ~DummyClass() 00052 {} 00053 00054 string getId() 00055 { 00056 return(id); 00057 } 00058 00059 }; 00060 00061 00062 typedef DAGNode< DummyClass > LatticeNode; 00063 typedef DAG< LatticeNode > ItemsetLattice; 00064 00065 00079 class LatticeFilter: public Filter 00080 { 00081 protected: 00082 // The graph representing a subset of the lattice. 00083 MyGraph graph; 00084 // all the itemsets i have seen so far, mapped from the name. 00085 // map< string, ItemSet > itemsets; 00086 // sets representing columns in the itemsets seen so far, also mapped from the name. 00087 map< string, set< string > > columnSets; 00088 00089 unsigned int numNonMaximalItemsets; 00090 00091 00092 public: 00093 LatticeFilter(); 00094 LatticeFilter(const LatticeFilter& src); 00095 virtual ~LatticeFilter(); 00096 virtual LatticeFilter& operator =(const LatticeFilter& rhs); 00097 virtual bool filter(const ItemSet& is, TruthMatrix& tm, string& msg); 00098 }; 00099 00100 #endif