home › Forums › # Technical Support › std::bad_alloc error
- This topic has 0 replies, 1 voice, and was last updated 7 years, 11 months ago by
Unknown.
-
AuthorPosts
-
October 6, 2015 at 03:35 #1938
Unknown
MemberHi, I’m using fuzzylite for handling the combined input of some variables.. the code recently worked, and now i get this error:
Unhandled exception at 0x74DB3E28 in FuzzyOutputTest.exe: Microsoft C++ exception: std::bad_alloc at memory location 0x010CF070.
this is the code im running:
using namespace fl;
Engine* engine = new Engine;
engine->setName(“simple-dimmer”);InputVariable* inputVariable = new InputVariable;
inputVariable->setEnabled(true);
inputVariable->setName(“Ambient”);
inputVariable->setRange(0.000, 1.000);
inputVariable->addTerm(new Triangle(“DARK”, 0.000, 0.250, 0.500));
inputVariable->addTerm(new Triangle(“MEDIUM”, 0.250, 0.500, 0.750));
inputVariable->addTerm(new Triangle(“BRIGHT”, 0.500, 0.750, 1.000));
engine->addInputVariable(inputVariable);OutputVariable* outputVariable = new OutputVariable;
outputVariable->setEnabled(true);
outputVariable->setName(“Power”);
outputVariable->setRange(0.000, 2.000);
outputVariable->fuzzyOutput()->setAccumulation(new Maximum);
outputVariable->setDefuzzifier(new Centroid(200));
outputVariable->setDefaultValue(fl::nan);
outputVariable->setLockPreviousOutputValue(false);
outputVariable->setLockOutputValueInRange(false);
outputVariable->addTerm(new Triangle(“LOW”, 0.000, 0.500, 1.000));
outputVariable->addTerm(new Triangle(“MEDIUM”, 0.500, 1.000, 1.500));
outputVariable->addTerm(new Triangle(“HIGH”, 1.000, 1.500, 2.000));
engine->addOutputVariable(outputVariable);RuleBlock* ruleBlock = new RuleBlock;
ruleBlock->setEnabled(true);
ruleBlock->setName(“”);
ruleBlock->setConjunction(fl::null);
ruleBlock->setDisjunction(fl::null);
ruleBlock->setActivation(new Minimum);
ruleBlock->addRule(fl::Rule::parse(“if Ambient is DARK then Power is HIGH”, engine));
ruleBlock->addRule(fl::Rule::parse(“if Ambient is MEDIUM then Power is MEDIUM”, engine));
ruleBlock->addRule(fl::Rule::parse(“if Ambient is BRIGHT then Power is LOW”, engine));
engine->addRuleBlock(ruleBlock);it already throws an exception at “Engine* engine = new Engine;”
please help!
Kind Regards,
R
-
AuthorPosts
- You must be logged in to reply to this topic.