summaryrefslogtreecommitdiff
path: root/examples/tsukamoto/tsukamoto.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'examples/tsukamoto/tsukamoto.cpp')
-rw-r--r--examples/tsukamoto/tsukamoto.cpp143
1 files changed, 77 insertions, 66 deletions
diff --git a/examples/tsukamoto/tsukamoto.cpp b/examples/tsukamoto/tsukamoto.cpp
index 4432936..a50c53d 100644
--- a/examples/tsukamoto/tsukamoto.cpp
+++ b/examples/tsukamoto/tsukamoto.cpp
@@ -1,85 +1,96 @@
#include <fl/Headers.h>
int main(int argc, char** argv){
+//Code automatically generated with fuzzylite 6.0.
+
using namespace fl;
Engine* engine = new Engine;
-engine->setName("");
+engine->setName("tsukamoto");
+engine->setDescription("");
-InputVariable* inputVariable = new InputVariable;
-inputVariable->setEnabled(true);
-inputVariable->setName("X");
-inputVariable->setRange(-10.000, 10.000);
-inputVariable->addTerm(new Bell("small", -10.000, 5.000, 3.000));
-inputVariable->addTerm(new Bell("medium", 0.000, 5.000, 3.000));
-inputVariable->addTerm(new Bell("large", 10.000, 5.000, 3.000));
-engine->addInputVariable(inputVariable);
+InputVariable* X = new InputVariable;
+X->setName("X");
+X->setDescription("");
+X->setEnabled(true);
+X->setRange(-10.000, 10.000);
+X->setLockValueInRange(false);
+X->addTerm(new Bell("small", -10.000, 5.000, 3.000));
+X->addTerm(new Bell("medium", 0.000, 5.000, 3.000));
+X->addTerm(new Bell("large", 10.000, 5.000, 3.000));
+engine->addInputVariable(X);
-OutputVariable* outputVariable1 = new OutputVariable;
-outputVariable1->setEnabled(true);
-outputVariable1->setName("Ramps");
-outputVariable1->setRange(0.000, 1.000);
-outputVariable1->fuzzyOutput()->setAccumulation(fl::null);
-outputVariable1->setDefuzzifier(new WeightedAverage("Automatic"));
-outputVariable1->setDefaultValue(fl::nan);
-outputVariable1->setLockPreviousOutputValue(false);
-outputVariable1->setLockOutputValueInRange(false);
-outputVariable1->addTerm(new Ramp("b", 0.600, 0.400));
-outputVariable1->addTerm(new Ramp("a", 0.000, 0.250));
-outputVariable1->addTerm(new Ramp("c", 0.700, 1.000));
-engine->addOutputVariable(outputVariable1);
+OutputVariable* Ramps = new OutputVariable;
+Ramps->setName("Ramps");
+Ramps->setDescription("");
+Ramps->setEnabled(true);
+Ramps->setRange(0.000, 1.000);
+Ramps->setLockValueInRange(false);
+Ramps->setAggregation(fl::null);
+Ramps->setDefuzzifier(new WeightedAverage("Automatic"));
+Ramps->setDefaultValue(fl::nan);
+Ramps->setLockPreviousValue(false);
+Ramps->addTerm(new Ramp("b", 0.600, 0.400));
+Ramps->addTerm(new Ramp("a", 0.000, 0.250));
+Ramps->addTerm(new Ramp("c", 0.700, 1.000));
+engine->addOutputVariable(Ramps);
-OutputVariable* outputVariable2 = new OutputVariable;
-outputVariable2->setEnabled(true);
-outputVariable2->setName("Sigmoids");
-outputVariable2->setRange(0.020, 1.000);
-outputVariable2->fuzzyOutput()->setAccumulation(fl::null);
-outputVariable2->setDefuzzifier(new WeightedAverage("Automatic"));
-outputVariable2->setDefaultValue(fl::nan);
-outputVariable2->setLockPreviousOutputValue(false);
-outputVariable2->setLockOutputValueInRange(false);
-outputVariable2->addTerm(new Sigmoid("b", 0.500, -30.000));
-outputVariable2->addTerm(new Sigmoid("a", 0.130, 30.000));
-outputVariable2->addTerm(new Sigmoid("c", 0.830, 30.000));
-engine->addOutputVariable(outputVariable2);
+OutputVariable* Sigmoids = new OutputVariable;
+Sigmoids->setName("Sigmoids");
+Sigmoids->setDescription("");
+Sigmoids->setEnabled(true);
+Sigmoids->setRange(0.020, 1.000);
+Sigmoids->setLockValueInRange(false);
+Sigmoids->setAggregation(fl::null);
+Sigmoids->setDefuzzifier(new WeightedAverage("Automatic"));
+Sigmoids->setDefaultValue(fl::nan);
+Sigmoids->setLockPreviousValue(false);
+Sigmoids->addTerm(new Sigmoid("b", 0.500, -30.000));
+Sigmoids->addTerm(new Sigmoid("a", 0.130, 30.000));
+Sigmoids->addTerm(new Sigmoid("c", 0.830, 30.000));
+engine->addOutputVariable(Sigmoids);
-OutputVariable* outputVariable3 = new OutputVariable;
-outputVariable3->setEnabled(true);
-outputVariable3->setName("ZSShapes");
-outputVariable3->setRange(0.000, 1.000);
-outputVariable3->fuzzyOutput()->setAccumulation(fl::null);
-outputVariable3->setDefuzzifier(new WeightedAverage("Automatic"));
-outputVariable3->setDefaultValue(fl::nan);
-outputVariable3->setLockPreviousOutputValue(false);
-outputVariable3->setLockOutputValueInRange(false);
-outputVariable3->addTerm(new ZShape("b", 0.300, 0.600));
-outputVariable3->addTerm(new SShape("a", 0.000, 0.250));
-outputVariable3->addTerm(new SShape("c", 0.700, 1.000));
-engine->addOutputVariable(outputVariable3);
+OutputVariable* ZSShapes = new OutputVariable;
+ZSShapes->setName("ZSShapes");
+ZSShapes->setDescription("");
+ZSShapes->setEnabled(true);
+ZSShapes->setRange(0.000, 1.000);
+ZSShapes->setLockValueInRange(false);
+ZSShapes->setAggregation(fl::null);
+ZSShapes->setDefuzzifier(new WeightedAverage("Automatic"));
+ZSShapes->setDefaultValue(fl::nan);
+ZSShapes->setLockPreviousValue(false);
+ZSShapes->addTerm(new ZShape("b", 0.300, 0.600));
+ZSShapes->addTerm(new SShape("a", 0.000, 0.250));
+ZSShapes->addTerm(new SShape("c", 0.700, 1.000));
+engine->addOutputVariable(ZSShapes);
-OutputVariable* outputVariable4 = new OutputVariable;
-outputVariable4->setEnabled(true);
-outputVariable4->setName("Concaves");
-outputVariable4->setRange(0.000, 1.000);
-outputVariable4->fuzzyOutput()->setAccumulation(fl::null);
-outputVariable4->setDefuzzifier(new WeightedAverage("Automatic"));
-outputVariable4->setDefaultValue(fl::nan);
-outputVariable4->setLockPreviousOutputValue(false);
-outputVariable4->setLockOutputValueInRange(false);
-outputVariable4->addTerm(new Concave("b", 0.500, 0.400));
-outputVariable4->addTerm(new Concave("a", 0.240, 0.250));
-outputVariable4->addTerm(new Concave("c", 0.900, 1.000));
-engine->addOutputVariable(outputVariable4);
+OutputVariable* Concaves = new OutputVariable;
+Concaves->setName("Concaves");
+Concaves->setDescription("");
+Concaves->setEnabled(true);
+Concaves->setRange(0.000, 1.000);
+Concaves->setLockValueInRange(false);
+Concaves->setAggregation(fl::null);
+Concaves->setDefuzzifier(new WeightedAverage("Automatic"));
+Concaves->setDefaultValue(fl::nan);
+Concaves->setLockPreviousValue(false);
+Concaves->addTerm(new Concave("b", 0.500, 0.400));
+Concaves->addTerm(new Concave("a", 0.240, 0.250));
+Concaves->addTerm(new Concave("c", 0.900, 1.000));
+engine->addOutputVariable(Concaves);
RuleBlock* ruleBlock = new RuleBlock;
-ruleBlock->setEnabled(true);
ruleBlock->setName("");
+ruleBlock->setDescription("");
+ruleBlock->setEnabled(true);
ruleBlock->setConjunction(fl::null);
ruleBlock->setDisjunction(fl::null);
-ruleBlock->setActivation(fl::null);
-ruleBlock->addRule(fl::Rule::parse("if X is small then Ramps is a and Sigmoids is a and ZSShapes is a and Concaves is a", engine));
-ruleBlock->addRule(fl::Rule::parse("if X is medium then Ramps is b and Sigmoids is b and ZSShapes is b and Concaves is b", engine));
-ruleBlock->addRule(fl::Rule::parse("if X is large then Ramps is c and Sigmoids is c and ZSShapes is c and Concaves is c", engine));
+ruleBlock->setImplication(fl::null);
+ruleBlock->setActivation(new General);
+ruleBlock->addRule(Rule::parse("if X is small then Ramps is a and Sigmoids is a and ZSShapes is a and Concaves is a", engine));
+ruleBlock->addRule(Rule::parse("if X is medium then Ramps is b and Sigmoids is b and ZSShapes is b and Concaves is b", engine));
+ruleBlock->addRule(Rule::parse("if X is large then Ramps is c and Sigmoids is c and ZSShapes is c and Concaves is c", engine));
engine->addRuleBlock(ruleBlock);