[Plugin] Fuzzy

Post your completed addons to share with the community

Post » Tue Mar 12, 2013 12:04 am

Fuzzy
(Update: 2013/05/18)

This plugin need to understand what is fuzzy, sorry I could not explain too much.
"Fuzzy logic is a form of many-valued logic or probabilistic logic; it deals with reasoning that is approximate rather than fixed and exact."

Anyway, it is used in some AI cases.

Exampe, using fuzzy logic to simulate the behavior of fish.
- touch screen to put feed
Capx

Basic example of this sim-fish.
- Edit the value of each input parameter, then press "execute" to see the value of outputs.
Capx

The steps of using this fuzzy plugin are -
1. Define memberships. This plugin provide 3 kinds of levels (3,5,7).
2. Define fuzzy logic (rule). Put memberships for parameters of this action. For example,
- "-hp" = N(negative) membership of variable of "hp"
- "hp" = ZO(zero) membership of variable of "hp"
- "+hp" = P(Positive) membership of variable of "hp"
And expression:AND/OR/NOT for and/or/not logic.



"-hp" : blue
"hp": green
"+hp" : red

3. Set input variables by "action:Set variable value"
4. Run rules by "action:Execute rules"
5. Then the grade of each rule could be picked by "expression:OutputGrade" , user could pick the rule with maximum degree by "expression:MaxOutput".
(In sim-fish example, I use "expression:MaxOutput" to be the command of the fish)


----
Dependency of sim-fish capx
[Plugin]
timeline


[Behavior]
timer
fps monitorrexrainbow2014-02-15 16:31:06
B
97
S
22
G
176
Posts: 4,109
Reputation: 103,021

Post » Tue Mar 12, 2013 3:36 pm

Do you read minds? I was literally going to start working on a fish simulator today, and now a ton of the work is already started and functional. Thank you!
B
37
S
6
G
6
Posts: 45
Reputation: 4,502

Post » Wed Mar 13, 2013 3:37 pm

damn!
B
18
S
5
G
4
Posts: 568
Reputation: 5,079

Post » Thu Mar 14, 2013 6:36 pm

The plug-in Sounds great, but can you check the download links for the samples, they seem to be broken...
B
82
S
11
G
8
Posts: 153
Reputation: 10,215

Post » Fri Mar 15, 2013 12:44 am

@Animate

Ooopps, the server had broken again. I had changed the download link, please download them again.
B
97
S
22
G
176
Posts: 4,109
Reputation: 103,021

Post » Fri Apr 12, 2013 8:51 am

@rexrainbow

hello, I'm back again...
I don't understand what the method "add rule" means... I know it's a logic, but I don't know the two parameters of it( Rule, Expression).

Such as this rule: Add rule "eat" <- Fuzzy.AND("stomach",Fuzzy.OR("hp","-hp"))
"eat" is a rule and "<- Fuzzy.AND("stomach",Fuzzy.OR("hp","-hp"))" is a expression.
Both Fuzzy.AND(...) and Fuzzy.OR(...) return a value, right? But who receives this value? Is it "eat"? Is "eat" a variable, too? ...
I'm completely confused...
B
5
Posts: 21
Reputation: 498

Post » Fri Apr 12, 2013 9:14 am

@MelonGuns

Fuzzy.AND(...) or Fuzzy.OR(...) will return a string (a rule) which is an expression about how to calculate the output variable (the rule name is also an output value).

In these expressions,
- an AND operation is to get the minimum value, an OR operation is to get the maximum value
- the expression "-hp"/"hp"/"+hp" is the degree (the value is 0~1) mapping from input value. The mapping rules is defined at "action:define membership" , shown as first post.

rexrainbow2013-04-12 09:16:39
B
97
S
22
G
176
Posts: 4,109
Reputation: 103,021

Post » Fri Apr 12, 2013 9:29 am

@rexrainbow

oh!~I see..."eat" is both a rule name and a output value !!! THX!!!
B
5
Posts: 21
Reputation: 498

Post » Sat May 18, 2013 4:02 am

Update

Support official save/load.
B
97
S
22
G
176
Posts: 4,109
Reputation: 103,021

Post » Sun Jun 02, 2013 12:19 am

Wow.... I had some hard time understanding how it worked, mostly because I didn't know how to use fuzzy logic.
Great plugin !


EDIT :
[QUOTE=MelonGuns] @rexrainbow

oh!~I see..."eat" is both a rule name and a output value !!! THX!!! [/QUOTE]
The output values seems to be directly the fuzzy evaluation of the rules of the same name, with the parameters applied.

@rexrainbow :
The only thing I don't understand now is how you mix multiple rules in 1 output. Do you sum the different output of the rules (could be logic as each rules correspond to P,Zo or N of a value, could be complementary), or ponderate each output value to calculate the final output ? Maybe the max of every rule ?
For example, if I take the "eat" rules :
- if the stomach is positive, always want to eat
- if the stomach is neutral, want to eat if hp is neutral or negative
- if the stomach is negative, want to eat only if hp is negative too
So in this case, if the stomach is 30% positive and 70% neutral, you should ponderate the result of the 2 first rules by their respective %, am I wrong ? (this question is more about checking I understand your plugin right)
Last thing, could we, in this same example, mix all 3 rules in a "Fuzzy.OR" statement ? Something like
OR(
"+Stomach",
AND("stomach",OR("hp","-hp")),
AND("-stomach","-hp")
)

(Just realised this last question is basicaly the same as the previous one...)Guizmus2013-06-02 13:09:15
B
17
S
7
G
4
Posts: 461
Reputation: 5,907

Next

Return to Completed Addons

Who is online

Users browsing this forum: No registered users and 2 guests