Forum Replies Created
-
AuthorPosts
-
Unknown
MemberHi, thanks for the quick reply.
When using “engine->toString()” it does print out my two inputs, output, and all its proportions as well as my Rule Block. But no matter what I do, I can’t seem to get my output based on mt data input or defuzzify it.
Any help is appreciated.
Here is my code if that helps at all
int main(int argc, char* argv[]) { using namespace fl; Engine* engine = new Engine; engine->setName("CAR_AI"); engine->setDescription(""); InputVariable* DistanceVariableInput = new InputVariable; DistanceVariableInput->setName("DistanceVariableInput"); DistanceVariableInput->setDescription(""); DistanceVariableInput->setEnabled(true); DistanceVariableInput->setRange(-1.000, 1.000); DistanceVariableInput->setLockValueInRange(false); DistanceVariableInput->addTerm(new Trapezoid("FarLeftOfLine", -1.000, -1.000, -0.900, -0.600)); DistanceVariableInput->addTerm(new Trapezoid("LeftOfLine", -0.900, -0.600, -0.400, -0.100)); DistanceVariableInput->addTerm(new Triangle("OnLine", -0.100, 0.000, 0.100)); DistanceVariableInput->addTerm(new Trapezoid("RightOfLine", 0.100, 0.400, 0.600, 0.900)); DistanceVariableInput->addTerm(new Trapezoid("FarRightOfLine", 0.700, 0.900, 1.000, 1.000)); engine->addInputVariable(DistanceVariableInput); InputVariable* LinearVelocityInput = new InputVariable; LinearVelocityInput->setName("LinearVelocityInput"); LinearVelocityInput->setDescription(""); LinearVelocityInput->setEnabled(true); LinearVelocityInput->setRange(-1.000, 1.000); LinearVelocityInput->setLockValueInRange(false); LinearVelocityInput->addTerm(new Trapezoid("MovingLeftFast", -1.000, -1.000, -0.800, -0.600)); LinearVelocityInput->addTerm(new Trapezoid("MoveingLeft", -0.800, -0.600, -0.300, -0.100)); LinearVelocityInput->addTerm(new Triangle("GoingStraight", -0.800, 0.000, 0.800)); LinearVelocityInput->addTerm(new Trapezoid("MovingRight", 0.100, 0.300, 0.600, 0.800)); LinearVelocityInput->addTerm(new Trapezoid("MovingRightFast", 0.600, 0.800, 1.000, 1.000)); engine->addInputVariable(LinearVelocityInput); OutputVariable* Steering = new OutputVariable; Steering->setName("Steering"); Steering->setDescription(""); Steering->setEnabled(true); Steering->setRange(-1.000, 1.000); Steering->setLockValueInRange(false); Steering->setAggregation(new Maximum); Steering->setDefuzzifier(new Centroid(100)); Steering->setDefaultValue(fl::nan); Steering->setLockPreviousValue(false); Steering->addTerm(new Triangle("MakeAHardLeft", -1.000, -1.000, -0.900)); Steering->addTerm(new Triangle("MakeALeft", -1.400, -0.900, -0.400)); Steering->addTerm(new Triangle("GoStraight", -1.500, 0.000, 1.500)); Steering->addTerm(new Triangle("MakeARight", 0.400, 0.900, 1.400)); Steering->addTerm(new Triangle("MakeAHardRight", 0.900, 1.000, 1.000)); engine->addOutputVariable(Steering); RuleBlock* OutputRule = new RuleBlock; OutputRule->setName("OutputRule"); OutputRule->setDescription(""); OutputRule->setEnabled(true); OutputRule->setConjunction(fl::null); OutputRule->setDisjunction(fl::null); OutputRule->setImplication(new AlgebraicProduct); OutputRule->setActivation(new General); OutputRule->addRule(Rule::parse("if DistanceVariableInput is OnLine and LinearVelocityInput is GoingStraight then Steering is GoStraight", engine)); OutputRule->addRule(Rule::parse("if DistanceVariableInput is OnLine and LinearVelocityInput is MoveingLeft then Steering is GoStraight", engine)); OutputRule->addRule(Rule::parse("if DistanceVariableInput is OnLine and LinearVelocityInput is MovingLeftFast then Steering is MakeARight", engine)); OutputRule->addRule(Rule::parse("if DistanceVariableInput is OnLine and LinearVelocityInput is MovingRight then Steering is GoStraight", engine)); OutputRule->addRule(Rule::parse("if DistanceVariableInput is OnLine and LinearVelocityInput is MovingRightFast then Steering is MakeALeft", engine)); OutputRule->addRule(Rule::parse("if DistanceVariableInput is LeftOfLine and LinearVelocityInput is GoingStraight then Steering is MakeARight", engine)); OutputRule->addRule(Rule::parse("if DistanceVariableInput is LeftOfLine and LinearVelocityInput is MoveingLeft then Steering is MakeARight", engine)); OutputRule->addRule(Rule::parse("if DistanceVariableInput is LeftOfLine and LinearVelocityInput is MovingLeftFast then Steering is MakeAHardRight", engine)); OutputRule->addRule(Rule::parse("if DistanceVariableInput is LeftOfLine and LinearVelocityInput is MovingRight then Steering is GoStraight", engine)); OutputRule->addRule(Rule::parse("if DistanceVariableInput is LeftOfLine and LinearVelocityInput is MovingRightFast then Steering is GoStraight", engine)); OutputRule->addRule(Rule::parse("if DistanceVariableInput is FarLeftOfLine and LinearVelocityInput is GoingStraight then Steering is MakeARight", engine)); OutputRule->addRule(Rule::parse("if DistanceVariableInput is FarLeftOfLine and LinearVelocityInput is MoveingLeft then Steering is MakeAHardRight", engine)); OutputRule->addRule(Rule::parse("if DistanceVariableInput is FarLeftOfLine and LinearVelocityInput is MovingLeftFast then Steering is MakeAHardRight", engine)); OutputRule->addRule(Rule::parse("if DistanceVariableInput is FarLeftOfLine and LinearVelocityInput is MovingRight then Steering is MakeARight", engine)); OutputRule->addRule(Rule::parse("if DistanceVariableInput is FarLeftOfLine and LinearVelocityInput is MovingRightFast then Steering is GoStraight", engine)); OutputRule->addRule(Rule::parse("if DistanceVariableInput is RightOfLine and LinearVelocityInput is GoingStraight then Steering is MakeALeft", engine)); OutputRule->addRule(Rule::parse("if DistanceVariableInput is RightOfLine and LinearVelocityInput is MoveingLeft then Steering is GoStraight", engine)); OutputRule->addRule(Rule::parse("if DistanceVariableInput is RightOfLine and LinearVelocityInput is MovingLeftFast then Steering is GoStraight", engine)); OutputRule->addRule(Rule::parse("if DistanceVariableInput is RightOfLine and LinearVelocityInput is MovingRight then Steering is MakeALeft", engine)); OutputRule->addRule(Rule::parse("if DistanceVariableInput is RightOfLine and LinearVelocityInput is MovingRightFast then Steering is MakeAHardLeft", engine)); OutputRule->addRule(Rule::parse("if DistanceVariableInput is FarRightOfLine and LinearVelocityInput is GoingStraight then Steering is MakeALeft", engine)); OutputRule->addRule(Rule::parse("if DistanceVariableInput is FarRightOfLine and LinearVelocityInput is MoveingLeft then Steering is MakeALeft", engine)); OutputRule->addRule(Rule::parse("if DistanceVariableInput is FarRightOfLine and LinearVelocityInput is MovingLeftFast then Steering is GoStraight", engine)); OutputRule->addRule(Rule::parse("if DistanceVariableInput is FarRightOfLine and LinearVelocityInput is MovingRight then Steering is MakeAHardLeft", engine)); OutputRule->addRule(Rule::parse("if DistanceVariableInput is FarRightOfLine and LinearVelocityInput is MovingRightFast then Steering is MakeAHardLeft", engine)); engine->addRuleBlock(OutputRule); engine->getInputVariable(0)->setValue(-1.000); engine->getInputVariable(1)->setValue(-1.000); engine->process(); printf("%f\n", engine->toString()); OutputVariable* outputVariable = engine->getOutputVariable(0); printf("%f\n", outputVariable->fuzzyOutputValue()); //OutputVariable* output = engine->getOutputVariable(0)->defuzzify(); //printf("%f\n", output); }
Unknown
MemberI tried to import fuzzy controllers but the import option was not working. That’s why I came up with this question. Can you please help me with that?
Unknown
MemberSo without buying a license, I cannot implement my own fuzzy code? Can I make editings to the existing code?
Unknown
MemberSir,
I downloaded fuzzylite from the same link and I have a folder named Qtfuzzylite and in that, I have its executable file. I run that and tipper program is executing by default. I want to create my own cpp engine and to run it instead of this program. How can I make that possible? Expecting your reply. Thank You.Unknown
MemberHi Juan,
thanks to your string text suggestions I found the licence.
Now QtfuzzyLite is working.
Thank you so much.
Cheers.
Filippo
Unknown
MemberGood morning Juan,
I am so sorry but one more time I had by pc down, therefore I had to re-install the whole operative system.
It is possible to have the Licence codes of the Fuzzy- Lite once again?
I bought the student licence the 5th of december 2017Thank you so much
Regards
Unknown
MemberWhat method do I call if I want to see a rule which was fired from the rule base?
Example if I have four rules from the tipping problem
takagiSugeno.addRule(Rule.parse(“if service is poor or food is rancid then tsTip is cheap”, engine));
takagiSugeno.addRule(Rule.parse(“if service is good then tsTip is average”, engine));
takagiSugeno.addRule(Rule.parse(“if service is excellent or food is delicious then tsTip is generous with 0.5”, engine));
takagiSugeno.addRule(Rule.parse(“if service is excellent and food is delicious then tsTip is generous with 1.0”, engine));
engine.addRuleBlock(takagiSugeno);I wan to know which rule is fired in every iteration.
like Cheap, average or deliciousUnknown
MemberHi,
see hereunder for compiler revision.
No problem, I have added pragma to ignore this warning.
Marc
[80481510acaa][amstoutzm][build]gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-redhat-linux/4.8.5/lto-wrapper
Target: x86_64-redhat-linux
Configured with: ../configure –prefix=/usr –mandir=/usr/share/man –infodir=/usr/share/info –with-bugurl=http://bugzilla.redhat.com/bugzilla –enable-bootstrap –enable-shared –enable-threads=posix –enable-checking=release –with-system-zlib –enable-__cxa_atexit –disable-libunwind-exceptions –enable-gnu-unique-object –enable-linker-build-id –with-linker-hash-style=gnu –enable-languages=c,c++,objc,obj-c++,java,fortran,ada,go,lto –enable-plugin –enable-initfini-array –disable-libgcj –with-isl=/builddir/build/BUILD/gcc-4.8.5-20150702/obj-x86_64-redhat-linux/isl-install –with-cloog=/builddir/build/BUILD/gcc-4.8.5-20150702/obj-x86_64-redhat-linux/cloog-install –enable-gnu-indirect-function –with-tune=generic –with-arch_32=x86-64 –build=x86_64-redhat-linux
Thread model: posix
gcc version 4.8.5 20150623 (Red Hat 4.8.5-28) (GCC)Unknown
MemberIt worked! Thank you Juan.
Unknown
MemberHi Juan,
Here is the generated R code by jfuzzylite.
When you run this code the following error occurs:
Error in textConnection(engine.fld) : object 'engine.fld' not found
So I changed from “engine.fld” to “engine.fldFile” on line 1075. But the original error still persists:
Error: Discrete value supplied to continuous scale In addition: Warning message: Error: Discrete value supplied to continuous scale
-
AuthorPosts