Fuzzy Logic Tools  v1.0.5.1
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Macros Pages
system.hpp
Go to the documentation of this file.
1 /* Copyright (C) 2004-2015
2  ANTONIO JAVIER BARRAGAN, antonio.barragan@diesia.uhu.es
3  http://uhu.es/antonio.barragan
4 
5  Collaborators:
6  JOSE MANUEL ANDUJAR, andujar@diesia.uhu.es
7 
8  DPTO. DE ING. ELECTRONICA, DE SISTEMAS INFORMATICOS Y AUTOMATICA
9  ETSI, UNIVERSITY OF HUELVA (SPAIN)
10 
11  For more information, please contact with authors.
12 
13  This software is free software: you can redistribute it and/or modify
14  it under the terms of the GNU General Public License as published by
15  the Free Software Foundation, either version 3 of the License, or
16  (at your option) any later version.
17 
18  This software is distributed in the hope that it will be useful,
19  but WITHOUT ANY WARRANTY; without even the implied warranty of
20  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21  GNU General Public License for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with this program. If not, see <http://www.gnu.org/licenses/>.
25 */
26 
27 #ifndef _SYSTEM_HPP_
28 #define _SYSTEM_HPP_
29 
37 #include <flt/rule.hpp>
38 
39 namespace FLT // Use the FTL (Fuzzy Logic Tools) namespace
40 {
41  #define LOW_DEFAULT_LIMIT -100.0
42  #define HIGH_DEFAULT_LIMIT 100.0
43 
44 
52  class System
53  {
54  size_t in;
55  size_t out;
56  size_t *N;
57  double *low_in;
58  double *low_out;
59  double *high_in;
60  double *high_out;
61  Rule **R;
62  public:
63  size_t inputs(void) const;
64  size_t outputs(void) const;
65  size_t rules(size_t output) const;
66 
67  TNT::Array1D<size_t> rules(void) const;
68 
69  TNT::Array1D<double> in_low(void) const;
70  double in_low(size_t input) const;
71 
72  TNT::Array1D<double> in_high(void) const;
73  double in_high(size_t input) const;
74 
75  TNT::Array1D<double> out_low(void) const;
76  double out_low(size_t output) const;
77 
78  TNT::Array1D<double> out_high(void) const;
79  double out_high(size_t output) const;
80 
81  void in_low(double *limits);
82  void in_high(double *limits);
83  void out_low(double *limits);
84  void out_high(double *limits);
85 
92  int checkInputLimits(const double * const point);
93 
100  int checkOutputLimits(const double * const output);
101 
108  int test(void) const;
109 
116  int changeRule(const Rule &R,
117  size_t r,
118  size_t output);
119 
126  int readRule(Rule &R,
127  size_t output,
128  size_t r) const;
129 
135  Rule* readRule(size_t output,
136  size_t r);
137 
141  void initialize(size_t in,
142  size_t out,
143  size_t *N);
144 
148  size_t NumberOfAntecedents(void);
149 
157  int setAntecedents(const double *const parameters);
158 
164  TNT::Array1D<double> getAntecedents(void);
165 
169  size_t NumberOfConsequents(void);
170 
176  void setConsequents(const double *const parameters);
177 
183  TNT::Array1D<double> getConsequents(void);
184 
191  TNT::Array1D<double> evaluate(const double * const point);
192 
193  System & operator=(const System &S);
194  System();
195  System(const System &S);
196  System(size_t in,
197  size_t out,
198  size_t *N);
199  ~System();
200  };
201 } // FLT namespace
202 
203 #endif
int readRule(Rule &R, size_t output, size_t r) const
Reads a Rule from the System.
Definition: system.cpp:161
size_t inputs(void) const
Returns the number of inputs of the System.
Definition: system.cpp:7
double * low_in
Low limits for the inputs of the System.
Definition: system.hpp:57
TNT::Array1D< double > in_low(void) const
Returns the low limits of the System inputs.
Definition: system.cpp:32
TNT::Array1D< double > out_low(void) const
Returns the low limits of the System outputs.
Definition: system.cpp:62
TNT::Array1D< size_t > rules(void) const
Returns the number of rules for each output of the System.
Definition: system.cpp:24
This class contains methods and attributes common to fuzzy Rules.
Definition: rule.hpp:53
TNT::Array1D< double > in_high(void) const
Returns the high limits of the System inputs.
Definition: system.cpp:47
int checkOutputLimits(const double *const output)
Checks if output meets the output limits of the system.
Definition: system.cpp:124
size_t out
Number of outputs of the System.
Definition: system.hpp:55
TNT::Array1D< double > getAntecedents(void)
Gets all the parameters of the antecedents of the System.
Definition: system.cpp:256
Fuzzy Logic Tools (FLT) namespace.
Definition: derivatives.hpp:41
TNT::Array1D< double > evaluate(const double *const point)
Evaluates the System for input point.
Definition: system.cpp:311
size_t outputs(void) const
Returns the number of outputs of the System.
Definition: system.cpp:12
size_t in
Number of inputs of the System.
Definition: system.hpp:54
int setAntecedents(const double *const parameters)
Sets all the parameters of the antecedents of the System.
Definition: system.cpp:236
Defines a Takagi-Sugeno fuzzy Rule.
Rule ** R
System Rules.
Definition: system.hpp:61
void setConsequents(const double *const parameters)
Sets all the consequets of the System.
Definition: system.cpp:287
size_t NumberOfAntecedents(void)
Gets the number of parameters stored in the antecedents of the System.
Definition: system.cpp:224
double * high_in
High limits for the inputs of the System.
Definition: system.hpp:59
size_t * N
Number of rules of the System for each output.
Definition: system.hpp:56
TNT::Array1D< double > getConsequents(void)
Gets the consequets of the System.
Definition: system.cpp:298
int test(void) const
This function checks the parameters of all Membership functions of the System, and corrects them if p...
Definition: system.cpp:132
This class contains methods and attributes common to fuzzy Systems.
Definition: system.hpp:52
double * low_out
Low limits for the outputs of the System.
Definition: system.hpp:58
double * high_out
High limits for outputs of the System.
Definition: system.hpp:60
void initialize(size_t in, size_t out, size_t *N)
Initializes the System with in inputs, out outputs and N[out] rules for each output.
Definition: system.cpp:178
TNT::Array1D< double > out_high(void) const
Returns the high limits of the System outputs.
Definition: system.cpp:77
int checkInputLimits(const double *const point)
Checks if point meets the input limits of the system.
Definition: system.cpp:116
int changeRule(const Rule &R, size_t r, size_t output)
Changes a Rule in the System.
Definition: system.cpp:153
size_t NumberOfConsequents(void)
Gets the number of parameters stored in the consequents of the System.
Definition: system.cpp:278