Forum Replies Created
April 18, 2014 at 20:10 in reply to: Unhandled exception at 0x76212c1a in FuzzyLiteTest.exe #1052
I have managed to build your example from console in Windows by modifying the file
fuzzylite/CMakeLists.txtline 106 to
add_executable(fl-bin Test.cpp)such that building using cmake will produce
fuzzylite.exeusing the exact code of your engine. As expected, the library worked just fine and did not throw any exception. I am afraid your exception might caused be somewhere else, but it is not in fuzzylite 4.0. Let me know if I can help you further.
JuanApril 18, 2014 at 18:50 in reply to: Unhandled exception at 0x76212c1a in FuzzyLiteTest.exe #1048
thank you for your email.
I have added a
FL_LOG(Power->defuzzify());at the end to produce an output value from the application. I have revised your code and could not find any problem. I have compiled it under Linux using:
g++ Test.cpp -Ifuzzylite -Lfuzzylite/bin -lfuzzyliteand I have found no issues either, the result from executing the application is an output value of 0.75.
Could you try cleaning and building your application again? Have you modified fuzzylite’s source code? Perhaps try to compile from console such a small example just to ensure you have the right settings in VS.
I will try within minutes to compile in Windows to find out if there is something I am missing.
Thank you very much for your feedback!
I will look into this for version 5.0.
I am not sure about hardware implementation, but later this year I expect to export to pure C, for which it should be compatible for hardware implementation.
Ya entiendo lo que buscas, pero eso es parte de la optimización de un controlador difuso, y este módulo aun no está disponible en fuzzylite. Luego de terminar la versión 5.0, exploraré métodos para la optimización de controladores difusos. Por ahora, no tengo ningún método para hacer este tipo de cálculos.
Los pesos Pi que mencionas corresponden a un término de tipo Linear, y no son calculados por fuzzylite sino determinados por el usuario. Revisa los ejemplos de Takagi-Sugeno.
If you have a fuzzy engine in “fis” format (check examples), then you can copy and paste the contents of the “fis” file into the import window.
For example, if you copy and paste the following block into the import window, you will have a fuzzy engine ready to use.
[System] Name='simple-dimmer' Type='mamdani' NumInputs=1 NumOutputs=1 NumRules=3 AndMethod='' OrMethod='' ImpMethod='min' AggMethod='max' DefuzzMethod='centroid' [Input1] Enabled=1 Name='Ambient' Range=[0.000 1.000] NumMFs=3 MF1='DARK':'trimf',[0.000 0.250 0.500] MF2='MEDIUM':'trimf',[0.250 0.500 0.750] MF3='BRIGHT':'trimf',[0.500 0.750 1.000] [Output1] Enabled=1 Name='Power' Range=[0.000 1.000] Default=nan LockValid=0 LockRange=0 NumMFs=3 MF1='LOW':'trimf',[0.000 0.250 0.500] MF2='MEDIUM':'trimf',[0.250 0.500 0.750] MF3='HIGH':'trimf',[0.500 0.750 1.000] [Rules] 1.000 , 3.000 (1.000) : 1 2.000 , 2.000 (1.000) : 1 3.000 , 1.000 (1.000) : 1
thank you for your post and your kind words.
It is good to see a way to make fuzzylite work under MinGW.
I like your advise of not requiring to recompile the whole package, but I do not quite follow what a non-stripped dll is. What do you mean by non-stripped dll? Would that be the file with a lib extension? Is that what you would need? Could you provide a few more details? I definitely want developers not to need to recompile the whole package, but just use the binaries provided.
Oh, as for performance optimization, the only place (I can think of right now) that is worth parallelizing is the Integral defuzzifiers (e.g. Centroid, Bisector, etc). While it should be straightforward to do that, it involves using external libraries (e.g. Intel’s Building Blocks) that I have no plans to make fuzzylite dependant upon. Nonetheless, I will eventually make the defuzzifiers work in parallel if the library is available via MACRO definitions.
In order to import your FCL controller to fuzzylite, you need to perform the following changes:
(1) Change comments indicators
#(this is a temporary fix until next version).
(2) ACCU : MAX; goes in Defuzzify tip instead of RULEBLOCK (as mentioned before)
(3) Each rules needs to be presented in a single line (not across multiple lines)
(4) In rules, change the case of the keywords
if, then, withto lower case.
These changes will let you import your FCL into fuzzylite. However, please have in mind that you should also specify:
(1) The range of input and output variables (standard in FCL). By default, fuzzylite will assume (-inf .. inf)
(2) Explicitly define the Disjunction operator (OR) in Ruleblock. If not defined, fuzzylite will take NULL as operator, and since you use
orwithin the rules, fuzzylite will remind you to select one during its operation.
The following is the FCL code of your engine exported using fuzzylite. Have in mind that ENABLED is an extension to FCL which gives you the option to disable a variable or rule block (useful for testing purposes).
FUNCTION_BLOCK tipper VAR_INPUT service: REAL; food: REAL; END_VAR VAR_OUTPUT tip: REAL; END_VAR FUZZIFY service ENABLED : TRUE; RANGE := (-inf .. inf); TERM poor := (0.000, 1.000) (4.000, 0.000); TERM good := (1.000, 0.000) (4.000, 1.000) (6.000, 1.000) (9.000, 0.000); TERM excellent := (6.000, 0.000) (9.000, 1.000); END_FUZZIFY FUZZIFY food ENABLED : TRUE; RANGE := (-inf .. inf); TERM rancid := (0.000, 1.000) (1.000, 1.000) (3.000, 0.000); TERM delicious := (7.000, 0.000) (9.000, 1.000); END_FUZZIFY DEFUZZIFY tip ENABLED : TRUE; RANGE := (-inf .. inf); TERM cheap := (0.000, 0.000) (5.000, 1.000) (10.000, 0.000); TERM average := (10.000, 0.000) (15.000, 1.000) (20.000, 0.000); TERM generous := (20.000, 0.000) (25.000, 1.000) (30.000, 0.000); METHOD : COG; ACCU : MAX; DEFAULT := 0.000; END_DEFUZZIFY RULEBLOCK No1 ENABLED : TRUE; AND : MIN; ACT : MIN; RULE 1 : if service is poor or food is rancid then tip is cheap RULE 2 : if service is good then tip is average RULE 3 : if service is excellent and food is delicious then tip is generous END_RULEBLOCK END_FUNCTION_BLOCK
Although I do prefer the FuzzyLite Language (FLL):
Engine: tipper InputVariable: service enabled: true range: -inf inf term: poor Discrete 0.000 1.000 4.000 0.000 term: good Discrete 1.000 0.000 4.000 1.000 6.000 1.000 9.000 0.000 term: excellent Discrete 6.000 0.000 9.000 1.000 InputVariable: food enabled: true range: -inf inf term: rancid Discrete 0.000 1.000 1.000 1.000 3.000 0.000 term: delicious Discrete 7.000 0.000 9.000 1.000 OutputVariable: tip enabled: true range: -inf inf accumulation: Maximum defuzzifier: Centroid 200 default: 0.000 lock-valid: false lock-range: false term: cheap Discrete 0.000 0.000 5.000 1.000 10.000 0.000 term: average Discrete 10.000 0.000 15.000 1.000 20.000 0.000 term: generous Discrete 20.000 0.000 25.000 1.000 30.000 0.000 RuleBlock: No1 enabled: true conjunction: Minimum disjunction: none activation: Minimum rule: if service is poor or food is rancid then tip is cheap rule: if service is good then tip is average rule: if service is excellent and food is delicious then tip is generous