Beispiel #1
0
int main(int argc, char** argv){
//Code automatically generated with jfuzzylite 6.0.

using namespace fl;

Engine* engine = new Engine;
engine->setName("tipper");
engine->setDescription("");

InputVariable* service = new InputVariable;
service->setName("service");
service->setDescription("");
service->setEnabled(true);
service->setRange(0.000, 10.000);
service->setLockValueInRange(false);
service->addTerm(new Gaussian("poor", 0.000, 1.500));
service->addTerm(new Gaussian("good", 5.000, 1.500));
service->addTerm(new Gaussian("excellent", 10.000, 1.500));
engine->addInputVariable(service);

InputVariable* food = new InputVariable;
food->setName("food");
food->setDescription("");
food->setEnabled(true);
food->setRange(0.000, 10.000);
food->setLockValueInRange(false);
food->addTerm(new Trapezoid("rancid", 0.000, 0.000, 1.000, 3.000));
food->addTerm(new Trapezoid("delicious", 7.000, 9.000, 10.000, 10.000));
engine->addInputVariable(food);

OutputVariable* tip = new OutputVariable;
tip->setName("tip");
tip->setDescription("");
tip->setEnabled(true);
tip->setRange(0.000, 30.000);
tip->setLockValueInRange(false);
tip->setAggregation(new Maximum);
tip->setDefuzzifier(new Centroid(200));
tip->setDefaultValue(fl::nan);
tip->setLockPreviousValue(false);
tip->addTerm(new Triangle("cheap", 0.000, 5.000, 10.000));
tip->addTerm(new Triangle("average", 10.000, 15.000, 20.000));
tip->addTerm(new Triangle("generous", 20.000, 25.000, 30.000));
engine->addOutputVariable(tip);

RuleBlock* ruleBlock = new RuleBlock;
ruleBlock->setName("");
ruleBlock->setDescription("");
ruleBlock->setEnabled(true);
ruleBlock->setConjunction(new Minimum);
ruleBlock->setDisjunction(new Maximum);
ruleBlock->setImplication(new Minimum);
ruleBlock->setActivation(new General);
ruleBlock->addRule(Rule::parse("if service is poor or food is rancid then tip is cheap", engine));
ruleBlock->addRule(Rule::parse("if service is good then tip is average", engine));
ruleBlock->addRule(Rule::parse("if service is excellent or food is delicious then tip is generous", engine));
engine->addRuleBlock(ruleBlock);


}
Beispiel #2
0
int main(int argc, char** argv){
//Code automatically generated with jfuzzylite 6.0.

using namespace fl;

Engine* engine = new Engine;
engine->setName("Laundry");
engine->setDescription("");

InputVariable* Load = new InputVariable;
Load->setName("Load");
Load->setDescription("");
Load->setEnabled(true);
Load->setRange(0.000, 6.000);
Load->setLockValueInRange(false);
Load->addTerm(Discrete::create("small", 8, 0.000, 1.000, 1.000, 1.000, 2.000, 0.800, 5.000, 0.000));
Load->addTerm(Discrete::create("normal", 6, 3.000, 0.000, 4.000, 1.000, 6.000, 0.000));
engine->addInputVariable(Load);

InputVariable* Dirt = new InputVariable;
Dirt->setName("Dirt");
Dirt->setDescription("");
Dirt->setEnabled(true);
Dirt->setRange(0.000, 6.000);
Dirt->setLockValueInRange(false);
Dirt->addTerm(Discrete::create("low", 6, 0.000, 1.000, 2.000, 0.800, 5.000, 0.000));
Dirt->addTerm(Discrete::create("high", 8, 1.000, 0.000, 2.000, 0.200, 4.000, 0.800, 6.000, 1.000));
engine->addInputVariable(Dirt);

OutputVariable* Detergent = new OutputVariable;
Detergent->setName("Detergent");
Detergent->setDescription("");
Detergent->setEnabled(true);
Detergent->setRange(0.000, 80.000);
Detergent->setLockValueInRange(false);
Detergent->setAggregation(new Maximum);
Detergent->setDefuzzifier(new MeanOfMaximum(500));
Detergent->setDefaultValue(fl::nan);
Detergent->setLockPreviousValue(false);
Detergent->addTerm(Discrete::create("less_than_usual", 6, 10.000, 0.000, 40.000, 1.000, 50.000, 0.000));
Detergent->addTerm(Discrete::create("usual", 8, 40.000, 0.000, 50.000, 1.000, 60.000, 1.000, 80.000, 0.000));
Detergent->addTerm(Discrete::create("more_than_usual", 4, 50.000, 0.000, 80.000, 1.000));
engine->addOutputVariable(Detergent);

OutputVariable* Cycle = new OutputVariable;
Cycle->setName("Cycle");
Cycle->setDescription("");
Cycle->setEnabled(true);
Cycle->setRange(0.000, 20.000);
Cycle->setLockValueInRange(false);
Cycle->setAggregation(new Maximum);
Cycle->setDefuzzifier(new MeanOfMaximum(500));
Cycle->setDefaultValue(fl::nan);
Cycle->setLockPreviousValue(false);
Cycle->addTerm(Discrete::create("short", 6, 0.000, 1.000, 10.000, 1.000, 20.000, 0.000));
Cycle->addTerm(Discrete::create("long", 4, 10.000, 0.000, 20.000, 1.000));
engine->addOutputVariable(Cycle);

RuleBlock* ruleBlock = new RuleBlock;
ruleBlock->setName("");
ruleBlock->setDescription("");
ruleBlock->setEnabled(true);
ruleBlock->setConjunction(new Minimum);
ruleBlock->setDisjunction(new Maximum);
ruleBlock->setImplication(new Minimum);
ruleBlock->setActivation(new General);
ruleBlock->addRule(Rule::parse("if Load is small and Dirt is not high then Detergent is less_than_usual", engine));
ruleBlock->addRule(Rule::parse("if Load is small and Dirt is high then  Detergent is usual", engine));
ruleBlock->addRule(Rule::parse("if Load is normal and Dirt is low then Detergent is less_than_usual", engine));
ruleBlock->addRule(Rule::parse("if Load is normal and Dirt is high then Detergent is more_than_usual", engine));
ruleBlock->addRule(Rule::parse("if Detergent is usual  or Detergent is less_than_usual  then Cycle is short", engine));
ruleBlock->addRule(Rule::parse("if Detergent is more_than_usual  then Cycle is long", engine));
engine->addRuleBlock(ruleBlock);


}
Beispiel #3
0
int main(int argc, char** argv){
//Code automatically generated with jfuzzylite 6.0.

using namespace fl;

Engine* engine = new Engine;
engine->setName("mam21");
engine->setDescription("");

InputVariable* angle = new InputVariable;
angle->setName("angle");
angle->setDescription("");
angle->setEnabled(true);
angle->setRange(-5.000, 5.000);
angle->setLockValueInRange(false);
angle->addTerm(new Bell("small", -5.000, 5.000, 8.000));
angle->addTerm(new Bell("big", 5.000, 5.000, 8.000));
engine->addInputVariable(angle);

InputVariable* velocity = new InputVariable;
velocity->setName("velocity");
velocity->setDescription("");
velocity->setEnabled(true);
velocity->setRange(-5.000, 5.000);
velocity->setLockValueInRange(false);
velocity->addTerm(new Bell("small", -5.000, 5.000, 2.000));
velocity->addTerm(new Bell("big", 5.000, 5.000, 2.000));
engine->addInputVariable(velocity);

OutputVariable* force = new OutputVariable;
force->setName("force");
force->setDescription("");
force->setEnabled(true);
force->setRange(-5.000, 5.000);
force->setLockValueInRange(false);
force->setAggregation(new Maximum);
force->setDefuzzifier(new Centroid(200));
force->setDefaultValue(fl::nan);
force->setLockPreviousValue(false);
force->addTerm(new Bell("negBig", -5.000, 1.670, 8.000));
force->addTerm(new Bell("negSmall", -1.670, 1.670, 8.000));
force->addTerm(new Bell("posSmall", 1.670, 1.670, 8.000));
force->addTerm(new Bell("posBig", 5.000, 1.670, 8.000));
engine->addOutputVariable(force);

RuleBlock* ruleBlock = new RuleBlock;
ruleBlock->setName("");
ruleBlock->setDescription("");
ruleBlock->setEnabled(true);
ruleBlock->setConjunction(new Minimum);
ruleBlock->setDisjunction(new Maximum);
ruleBlock->setImplication(new Minimum);
ruleBlock->setActivation(new General);
ruleBlock->addRule(Rule::parse("if angle is small and velocity is small then force is negBig", engine));
ruleBlock->addRule(Rule::parse("if angle is small and velocity is big then force is negSmall", engine));
ruleBlock->addRule(Rule::parse("if angle is big and velocity is small then force is posSmall", engine));
ruleBlock->addRule(Rule::parse("if angle is big and velocity is big then force is posBig", engine));
engine->addRuleBlock(ruleBlock);


}
Beispiel #4
0
int main(int argc, char** argv){
//Code automatically generated with jfuzzylite 6.0.

using namespace fl;

Engine* engine = new Engine;
engine->setName("shower");
engine->setDescription("");

InputVariable* temp = new InputVariable;
temp->setName("temp");
temp->setDescription("");
temp->setEnabled(true);
temp->setRange(-20.000, 20.000);
temp->setLockValueInRange(false);
temp->addTerm(new Trapezoid("cold", -30.000, -30.000, -15.000, 0.000));
temp->addTerm(new Triangle("good", -10.000, 0.000, 10.000));
temp->addTerm(new Trapezoid("hot", 0.000, 15.000, 30.000, 30.000));
engine->addInputVariable(temp);

InputVariable* flow = new InputVariable;
flow->setName("flow");
flow->setDescription("");
flow->setEnabled(true);
flow->setRange(-1.000, 1.000);
flow->setLockValueInRange(false);
flow->addTerm(new Trapezoid("soft", -3.000, -3.000, -0.800, 0.000));
flow->addTerm(new Triangle("good", -0.400, 0.000, 0.400));
flow->addTerm(new Trapezoid("hard", 0.000, 0.800, 3.000, 3.000));
engine->addInputVariable(flow);

OutputVariable* cold = new OutputVariable;
cold->setName("cold");
cold->setDescription("");
cold->setEnabled(true);
cold->setRange(-1.000, 1.000);
cold->setLockValueInRange(false);
cold->setAggregation(new Maximum);
cold->setDefuzzifier(new Centroid(200));
cold->setDefaultValue(fl::nan);
cold->setLockPreviousValue(false);
cold->addTerm(new Triangle("closeFast", -1.000, -0.600, -0.300));
cold->addTerm(new Triangle("closeSlow", -0.600, -0.300, 0.000));
cold->addTerm(new Triangle("steady", -0.300, 0.000, 0.300));
cold->addTerm(new Triangle("openSlow", 0.000, 0.300, 0.600));
cold->addTerm(new Triangle("openFast", 0.300, 0.600, 1.000));
engine->addOutputVariable(cold);

OutputVariable* hot = new OutputVariable;
hot->setName("hot");
hot->setDescription("");
hot->setEnabled(true);
hot->setRange(-1.000, 1.000);
hot->setLockValueInRange(false);
hot->setAggregation(new Maximum);
hot->setDefuzzifier(new Centroid(200));
hot->setDefaultValue(fl::nan);
hot->setLockPreviousValue(false);
hot->addTerm(new Triangle("closeFast", -1.000, -0.600, -0.300));
hot->addTerm(new Triangle("closeSlow", -0.600, -0.300, 0.000));
hot->addTerm(new Triangle("steady", -0.300, 0.000, 0.300));
hot->addTerm(new Triangle("openSlow", 0.000, 0.300, 0.600));
hot->addTerm(new Triangle("openFast", 0.300, 0.600, 1.000));
engine->addOutputVariable(hot);

RuleBlock* ruleBlock = new RuleBlock;
ruleBlock->setName("");
ruleBlock->setDescription("");
ruleBlock->setEnabled(true);
ruleBlock->setConjunction(new Minimum);
ruleBlock->setDisjunction(new Maximum);
ruleBlock->setImplication(new Minimum);
ruleBlock->setActivation(new General);
ruleBlock->addRule(Rule::parse("if temp is cold and flow is soft then cold is openSlow and hot is openFast", engine));
ruleBlock->addRule(Rule::parse("if temp is cold and flow is good then cold is closeSlow and hot is openSlow", engine));
ruleBlock->addRule(Rule::parse("if temp is cold and flow is hard then cold is closeFast and hot is closeSlow", engine));
ruleBlock->addRule(Rule::parse("if temp is good and flow is soft then cold is openSlow and hot is openSlow", engine));
ruleBlock->addRule(Rule::parse("if temp is good and flow is good then cold is steady and hot is steady", engine));
ruleBlock->addRule(Rule::parse("if temp is good and flow is hard then cold is closeSlow and hot is closeSlow", engine));
ruleBlock->addRule(Rule::parse("if temp is hot and flow is soft then cold is openFast and hot is openSlow", engine));
ruleBlock->addRule(Rule::parse("if temp is hot and flow is good then cold is openSlow and hot is closeSlow", engine));
ruleBlock->addRule(Rule::parse("if temp is hot and flow is hard then cold is closeSlow and hot is closeFast", engine));
engine->addRuleBlock(ruleBlock);


}
Beispiel #5
0
int main(int argc, char** argv){
//Code automatically generated with jfuzzylite 6.0.

using namespace fl;

Engine* engine = new Engine;
engine->setName("tsukamoto");
engine->setDescription("");

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* 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* 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* 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* 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->setName("");
ruleBlock->setDescription("");
ruleBlock->setEnabled(true);
ruleBlock->setConjunction(fl::null);
ruleBlock->setDisjunction(fl::null);
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);


}
Beispiel #6
0
int main(int argc, char** argv){
//Code automatically generated with jfuzzylite 6.0.

using namespace fl;

Engine* engine = new Engine;
engine->setName("tank2");
engine->setDescription("");

InputVariable* level = new InputVariable;
level->setName("level");
level->setDescription("");
level->setEnabled(true);
level->setRange(-1.000, 1.000);
level->setLockValueInRange(false);
level->addTerm(new Trapezoid("high", -2.000, -1.000, -0.800, -0.001));
level->addTerm(new Triangle("good", -0.150, 0.000, 0.500));
level->addTerm(new Trapezoid("low", 0.001, 0.800, 1.000, 1.500));
engine->addInputVariable(level);

InputVariable* change = new InputVariable;
change->setName("change");
change->setDescription("");
change->setEnabled(true);
change->setRange(-0.100, 0.100);
change->setLockValueInRange(false);
change->addTerm(new Trapezoid("falling", -0.140, -0.100, -0.060, 0.000));
change->addTerm(new Trapezoid("rising", -0.001, 0.060, 0.100, 0.140));
engine->addInputVariable(change);

OutputVariable* valve = new OutputVariable;
valve->setName("valve");
valve->setDescription("");
valve->setEnabled(true);
valve->setRange(-1.000, 1.000);
valve->setLockValueInRange(false);
valve->setAggregation(new Maximum);
valve->setDefuzzifier(new Centroid(200));
valve->setDefaultValue(fl::nan);
valve->setLockPreviousValue(false);
valve->addTerm(new Triangle("close_fast", -1.000, -0.900, -0.800));
valve->addTerm(new Triangle("close_slow", -0.600, -0.500, -0.400));
valve->addTerm(new Triangle("no_change", -0.100, 0.000, 0.100));
valve->addTerm(new Triangle("open_slow", 0.400, 0.500, 0.600));
valve->addTerm(new Triangle("open_fast", 0.800, 0.900, 1.000));
engine->addOutputVariable(valve);

RuleBlock* ruleBlock = new RuleBlock;
ruleBlock->setName("");
ruleBlock->setDescription("");
ruleBlock->setEnabled(true);
ruleBlock->setConjunction(new AlgebraicProduct);
ruleBlock->setDisjunction(new AlgebraicSum);
ruleBlock->setImplication(new AlgebraicProduct);
ruleBlock->setActivation(new General);
ruleBlock->addRule(Rule::parse("if level is low then valve is open_fast", engine));
ruleBlock->addRule(Rule::parse("if level is high then valve is close_fast", engine));
ruleBlock->addRule(Rule::parse("if level is good and change is rising then valve is close_slow", engine));
ruleBlock->addRule(Rule::parse("if level is good and change is falling then valve is open_slow", engine));
engine->addRuleBlock(ruleBlock);


}