Skip to content

Latest commit

 

History

History
202 lines (177 loc) · 5.7 KB

README.md

File metadata and controls

202 lines (177 loc) · 5.7 KB

Fuzzy Logic using Golang

Description

Fuzzy logic is an approach to computing based on degrees of truth rather than the usual true or false (1 or 0) Boolean logic on which the modern computer is based.

Visualization

NB: The bigger the circle, the bigger the value

Fuzzy Rule

Income/Debt Low Middle High
Low Accepted Accepted Accepted
Middle Considered Considered Considered
High Considered Rejected Rejected

Fuzzy Input

Income :

  1. Low
  2. Middle
  3. High

Debt 1. Low 2. Middle 3. High

BLT :

  1. Accepted
  2. Considered
  3. Rejected

Membership Function

I am using Linier function as the membership function.

Income

Low : Middle : High :

Debt

Low : Middle : High :

Defuzification

Takagi-Sugeno Defuzzification Functions

ci :

    AcceptedValue = 100
    ConsideredValue = 70
    RejectedValue = 50

Result

No Income Debt Result
73 158 1472 100.000000
23 112 26202 100.000000
83 219 11550 100.000000
21 155 29496 100.000000
15 428 38739 98.343141
34 515 41771 94.250000
49 516 43660 94.200000
64 588 35480 90.600000
19 599 45566 90.050000
74 600 80864 90.000000
42 507 16331 87.463225
53 473 28740 87.258182
6 664 63226 86.800000
80 664 39692 86.800000
66 666 60245 86.022070
59 493 27813 84.592552
89 754 37883 82.300000
60 765 36031 81.750000
93 557 29517 81.329467
47 780 78054 81.000000

Data

No Income Debt
1 1.632 39.375
2 0.825 39.236
3 1.273 80.701
4 1.534 73.641
5 1.596 37.319
6 0.664 63.226
7 1.680 37.761
8 0.925 0.000
9 0.806 69.192
10 1.178 26.359
11 1.548 53.764
12 1.617 55.544
13 0.890 41.718
14 1.354 61.333
15 0.428 38.739
16 1.319 41.201
17 0.859 26.266
18 1.345 76.343
19 0.599 45.566
20 1.763 55.289
21 0.155 29.496
22 0.828 56.747
23 0.112 26.202
24 0.819 60.764
25 1.723 33.533
26 1.410 25.133
27 1.255 27.166
28 1.369 50.779
29 1.684 45.068
30 1.794 24.110
31 0.632 20.042
32 1.352 55.861
33 0.923 37.382
34 0.515 41.771
35 1.325 70.009
36 0.946 98.000
37 1.755 42.045
38 0.747 25.471
39 1.332 68.795
40 1.263 45.986
41 1.159 68.120
42 0.507 16.331
43 1.353 61.466
44 0.902 68.021
45 1.736 27.340
46 1.714 36.429
47 0.780 78.054
48 1.433 78.028
49 0.516 43.660
50 1.818 49.628
51 0.689 2.032
52 1.551 51.746
53 0.473 28.740
54 0.756 11.764
55 1.623 41.850
56 1.251 48.798
57 1.336 62.094
58 0.748 23.649
59 0.493 27.813
60 0.765 36.031
61 0.880 79.878
62 1.159 87.871
63 1.423 27.672
64 0.588 35.480
65 1.282 29.854
66 0.666 60.245
67 1.385 61.661
68 1.306 52.933
69 1.218 17.396
70 1.025 29.924
71 1.046 13.541
72 1.641 46.775
73 0.158 1.472
74 0.600 80.864
75 0.894 22.836
76 0.791 39.781
77 1.217 82.991
78 1.900 32.769
79 1.227 20.851
80 0.664 39.692
81 1.164 18.112
82 1.804 27.693
83 0.219 11.550
84 1.643 57.308
85 1.030 25.246
86 1.531 21.480
87 1.593 41.325
88 1.209 67.625
89 0.754 37.883
90 1.586 38.999
91 0.793 11.302
92 0.817 62.427
93 0.557 29.517
94 1.474 56.534
95 1.329 71.308
96 0.910 43.769
97 0.950 23.790
98 1.406 46.838
99 0.816 18.123
100 1.183 28.061