OpenCog Framework  Branch: master, revision 6f0b7fc776b08468cf1b74aa9db028f387b4f0c0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
GenericTruthValue.h
Go to the documentation of this file.
1 /*
2  * GenericTruthValue.h
3  *
4  * Copyright (C) 2015 OpenCog Foundation
5  *
6  * Author: Leung Man Hin <https://github.com/leungmanhin>
7  *
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU Affero General Public License v3 as
10  * published by the Free Software Foundation and including the exceptions
11  * at http://opencog.org/wiki/Licenses
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU Affero General Public License
19  * along with this program; if not, write to:
20  * Free Software Foundation, Inc.,
21  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
22  */
23 
24 #ifndef _OPENCOG_GENERIC_TRUTH_VALUE_H
25 #define _OPENCOG_GENERIC_TRUTH_VALUE_H
26 
27 #include <string>
28 #include <memory>
29 
30 #include <opencog/util/exceptions.h>
31 
32 namespace opencog
33 {
34 
35 typedef float strength_t;
36 typedef float confidence_t;
37 typedef double count_t;
38 typedef double entropy_t;
39 
41 typedef std::shared_ptr<GenericTruthValue> GenericTruthValuePtr;
42 
44  : public std::enable_shared_from_this<GenericTruthValue>
45 {
46  // Truth values are immutable
48  throw RuntimeException(TRACE_INFO, "Cannot modify truth values!");
49  }
50 
51  public:
56 
59 
60  count_t getTotalEvidence() const;
62 
63  strength_t getFrequency() const;
65 
68 
71 
72  entropy_t getEntropy() const;
73 
75 
77  {
78  return std::make_shared<GenericTruthValue>(*this);
79  }
80 
82  {
83  return new GenericTruthValue(*this);
84  }
85 
86  virtual bool operator==(const GenericTruthValue& rhs) const;
87  std::string toString() const;
88 
89  protected:
91 
92  // PLN count
94 
95  // Probabilistic strength
97 
98  // Fuzzy set membership strength
100 
102 
104 
105 };
106 } // namespace opencog
107 
108 #endif // _OPENCOG_GENERIC_TRUTH_VALUE_H
GenericTruthValuePtr clone() const
strength_t getFrequency() const
GenericTruthValue & operator=(const GenericTruthValue &rhs)
std::shared_ptr< GenericTruthValue > GenericTruthValuePtr
confidence_t getConfidence() const
float strength_t
count_t getPositiveEvidence() const
float confidence_t
double count_t
GenericTruthValue * rawclone() const
count_t getTotalEvidence() const
GenericTruthValuePtr merge(GenericTruthValuePtr) const
virtual bool operator==(const GenericTruthValue &rhs) const
std::string toString() const
strength_t getLogFuzzyStrength() const
strength_t getFuzzyStrength() const
count_t getLogTotalEvidence() const
confidence_t getLogConfidence() const
count_t getLogPositiveEvidence() const
strength_t getLogFrequency() const
double entropy_t
GenericTruthValue(count_t, count_t, strength_t, strength_t, confidence_t, entropy_t)