00001 /************************************************************************************************** 00002 Software License Agreement (BSD License) 00003 00004 Copyright (c) 2011-2013, LAR toolkit developers - University of Aveiro - http://lars.mec.ua.pt 00005 All rights reserved. 00006 00007 Redistribution and use in source and binary forms, with or without modification, are permitted 00008 provided that the following conditions are met: 00009 00010 *Redistributions of source code must retain the above copyright notice, this list of 00011 conditions and the following disclaimer. 00012 *Redistributions in binary form must reproduce the above copyright notice, this list of 00013 conditions and the following disclaimer in the documentation and/or other materials provided 00014 with the distribution. 00015 *Neither the name of the University of Aveiro nor the names of its contributors may be used to 00016 endorse or promote products derived from this software without specific prior written permission. 00017 00018 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR 00019 IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 00020 FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 00021 CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 00022 DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 00023 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 00024 IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 00025 OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00026 ***************************************************************************************************/ 00032 #ifndef _HYPOTHESIS_H_ 00033 #define _HYPOTHESIS_H_ 00034 00035 #include <mtt/target.h> 00036 00037 class Target; 00039 typedef boost::shared_ptr<Target> TargetPtr; 00040 00042 enum hypotheses_status {NORMAL=0, MOVED, FORCED_PARENT, PARENT, DEAD, DEAD_FORCED_PARENT,ERROR}; 00043 00050 class Hypothesis 00051 { 00052 public: 00054 int _aux1; 00056 int _cluster; 00058 int _iteration; 00060 long _id; 00062 int _status; 00064 static long _euid;//extremely unique id 00066 long _uid; 00068 double _probability; 00070 int _n_det; 00072 int _n_occ; 00074 int _n_del; 00076 int _n_new; 00078 int _n_fal; 00080 double _prod; 00081 00082 friend ostream& operator<<(ostream& o,Hypothesis& h); 00083 00085 long _parent_uid; 00086 00088 vector<string> _attribute_names; 00090 vector<string> _attribute_values; 00091 00093 vector<TargetPtr> _targets; 00094 00100 string nameUI(); 00101 00107 string name(); 00108 00115 void setAttribute(string name,string value); 00116 00120 Hypothesis(); 00121 00129 Hypothesis(int iteration, int cluster, int status); 00130 00134 ~Hypothesis(); 00135 }; 00136 00138 typedef boost::shared_ptr<Hypothesis> HypothesisPtr; 00139 00140 00149 bool compareHypotheses(HypothesisPtr h1,HypothesisPtr h2); 00150 00159 bool compareHypothesesByProbability(HypothesisPtr h1,HypothesisPtr h2); 00160 00169 bool compareHypothesesByProbabilityDescending(HypothesisPtr h1,HypothesisPtr h2); 00170 00171 #endif