LIBRCSC Docs
Documentation for HELIOS's BASE LIBRCSC library for RoboCup 2D Simulation League.
All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros
sirm.h
1// -*-c++-*-
2
3/*
4 *Copyright:
5
6 Copyright (C) Tomoharu NAKASHIMA
7
8 This code is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 3, or (at your option)
11 any later version.
12
13 This code 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 General Public License
19 along with this code; see the file COPYING. If not, write to
20 the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
21
22 *EndCopyright:
23 */
24
26
27#ifndef RCSC_ANN_SIRM_H
28#define RCSC_ANN_SIRM_H
29
30#include <vector>
31#include <string>
32
33namespace rcsc {
34
35class SIRM {
36private:
37 std::string M_module_name;
38
39 int M_num_partitions;
40
41 double M_max_domain;
42 double M_min_domain;
43 double M_max_range;
44 double M_min_range;
45 double M_weight;
46
47 std::vector< double > M_a;
48 std::vector< double > M_b;
49 std::vector< double > M_c;
50
51 // used for training the SIRM
52 double M_alpha;
53 double M_beta;
54 double M_gamma;
55 double M_eta;
56 std::vector< double > M_membership;
57 double M_denominator;
58 double M_output;
59 double M_input;
60
62 void generateFuzzyRules();
63
64public:
65
66 SIRM();
67
68 void setModuleName( const std::string & module_name );
69
71 double calculateOutput( const double x );
72
74 void trainSIRM( const double target,
75 const double actual );
76
78 bool saveParameters( const std::string & dirpath );
79
81 bool loadParameters( const std::string & dirpath );
82
85
86 void setAlpha( const double alpha );
87 void setBeta( const double beta );
88 void setGamma( const double gamma );
89 void setEta( const double eta );
90 void setDomain( const double min_domain,
91 const double max_domain );
92 void setRange( const double min_range,
93 const double max_range );
94 void setNumPartitions( const int num_partitions );
95 void setWeight( const double weight );
96
97 double weight();
98};
99
100}
101
102#endif
Definition: sirm.h:35
void trainSIRM(const double target, const double actual)
parameter tuning based on gradient decent
bool saveParameters(const std::string &dirpath)
save parameters
void showParameters()
show parameters on the screen
bool loadParameters(const std::string &dirpath)
load parameters
double calculateOutput(const double x)
calculate the output of the rule module for an input value