diff options
author | Johannes 'josch' Schauer <josch@mister-muffin.de> | 2020-10-23 08:27:38 +0200 |
---|---|---|
committer | Johannes 'josch' Schauer <josch@mister-muffin.de> | 2020-10-23 08:27:38 +0200 |
commit | 3b91637afd9716881bec3a34c3ace369c82ef61c (patch) | |
tree | 2445bd2a7aadd1fd90bc76e5ab7491a8403d6f75 /examples/mamdani/octave/investment_portfolio.fcl | |
parent | 2b00fcb77bb6e7b769ee34a114679838e00156d1 (diff) |
New upstream version 6.0+dfsg
Diffstat (limited to 'examples/mamdani/octave/investment_portfolio.fcl')
-rw-r--r-- | examples/mamdani/octave/investment_portfolio.fcl | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/examples/mamdani/octave/investment_portfolio.fcl b/examples/mamdani/octave/investment_portfolio.fcl new file mode 100644 index 0000000..ec837a7 --- /dev/null +++ b/examples/mamdani/octave/investment_portfolio.fcl @@ -0,0 +1,46 @@ +//Code automatically generated with fuzzylite 6.0. + +FUNCTION_BLOCK investment_portfolio + +VAR_INPUT + Age: REAL; + RiskTolerance: REAL; +END_VAR + +VAR_OUTPUT + PercentageInStocks: REAL; +END_VAR + +FUZZIFY Age + RANGE := (20.000 .. 100.000); + TERM Young := ZShape 30.000 90.000; + TERM Old := SShape 30.000 90.000; +END_FUZZIFY + +FUZZIFY RiskTolerance + RANGE := (0.000 .. 10.000); + TERM Low := ZShape 2.000 8.000; + TERM High := SShape 2.000 8.000; +END_FUZZIFY + +DEFUZZIFY PercentageInStocks + RANGE := (0.000 .. 100.000); + TERM AboutFifteen := Gaussian 15.000 10.000; + TERM AboutFifty := Gaussian 50.000 10.000; + TERM AboutEightyFive := Gaussian 85.000 10.000; + METHOD : COG; + ACCU : ESUM; + DEFAULT := nan; +END_DEFUZZIFY + +RULEBLOCK + AND : EPROD; + OR : ESUM; + ACT : EPROD; + RULE 1 : if Age is Young or RiskTolerance is High then PercentageInStocks is AboutEightyFive + RULE 2 : if Age is Old or RiskTolerance is Low then PercentageInStocks is AboutFifteen + RULE 3 : if Age is not extremely Old and RiskTolerance is not extremely Low then PercentageInStocks is AboutFifty with 0.500 + RULE 4 : if Age is not extremely Young and RiskTolerance is not extremely High then PercentageInStocks is AboutFifty with 0.500 +END_RULEBLOCK + +END_FUNCTION_BLOCK |