home › Forums › # Technical Support › FuzzyLite 3.1: [syntax error] stack expected to contain the root, but contains
Tagged: fuzzylite5.0, runtime error, solved, syntax error
- This topic has 8 replies, 3 voices, and was last updated 9 years ago by
Unknown.
-
AuthorPosts
-
August 26, 2014 at 20:00 #1392
Unknown
MemberHello,
I am using FuzzyLite 3.1 with the OMNeT++ simulator. When running a simulation I have been getting these kind of errors:
[syntax error] stack expected to contain the root, but contains 0 nodes
After searching I found that this error points to the file FuzzyAntecedent.cpp and particularly these lines:
if (expressionStack.size() != 1) {
std::ostringstream ex;
ex << “[syntax error] stack expected to contain the root, but contains ”
<< expressionStack.size() << ” nodes”;
throw fl::Exception(ex.str(), FL_AT);
}
The expressionStack is defined as:
std::stack<FuzzyExpression*> expressionStack;What is the cause of the expressionStack = 0 error? What is the expressionStack used for?
August 26, 2014 at 21:54 #1394Juan Rada-Vilela (admin)
KeymasterHi,
I strongly recommend you use the new fuzzylite 5.0. It is in a much much better shape.
The error you are having has to do with an invalid rule that is probably misspelled, or contains invalid characters. Again, fuzzylite 5.0 would give you more information about the error.
Cheers.
September 4, 2014 at 01:19 #1416Unknown
MemberHi Juan,
Thanks your reply. I recently updated to FuzzyLite 5.0. I updated my code to the new version from 3.1, and the code compiles fine without any errors and all the necessary include files are present in the OMNeT++ IDE. However, when starting my simulation at the OMNeT++ IDE, I get this linker error:
<!> Error during startup: Cannot load library ‘/..inetmanet/src//libinet.so’: /../inetmanet/src//libinet.so: undefined symbol: _ZN2fl9TrapezoidC1ERKSsdddd.
Libinet.so is a library file in which all the simulator code is loaded. It seems that it is not loading correctly the FuzzyLite library.
I have added to the simulation project properties “OMNeT++ makemake->Additional objects to link with” the file libfuzzylite-static.a ( found in FuzzyLite-5.0/fuzzylite/release/bin), which was the library file that was created after compiling the FuzzyLite 5.0 as “./build.sh all”. I did not have any linker problems with the previous version 3.1.
Do you have any ideas or hints how I could try to solve this problem?
Thanks.
September 4, 2014 at 09:40 #1418Juan Rada-Vilela (admin)
KeymasterHi,
Your first problem is that it cannot load library
libinet
, probably due to setting the path wrong:/..inetmanet/src//libinet.so
, perhaps it is../inetmanet/src/libinet.so
?If the
Trapezoid
symbol is undefined, the fuzzylite library is not being loaded. You should check the path to the library is correct and make sure you have only one fuzzylite library installed. Also, perhaps the fuzzylite library is not being loaded due to errors loading other libraries like libinet?September 4, 2014 at 20:44 #1419Unknown
MemberHi Juan,
Apparently the problem was simple. I had forgot to do a “make clean” for the simulation project INETMANET. After “make clean” and “make” there were many compilation errors. After I solved these errors the fuzzylite library was correctly loaded into the simulation framework, and started without any errors.
When running the simulation I’ve been now getting runtime-errors, such as
accumulation operator needed to accumulate AP: Accumulated none[Minimum(1.000,EXCELLENT)]
but those are clearly related to the old vs new version updates.
September 4, 2014 at 23:24 #1420Unknown
MemberHi,
Right now I am getting this runtime error (when omnet++ simulation is running) with the FuzzyLite 5.0:
event #51428098, t=212.014939351788: fl::Exception: [syntax error] unable to parse the following expressions in antecedent <>.
This happens after 212 seconds of simulated time. Before that everything works perfectly without errors.
What could be the cause of this error? Same point in the code as in v. 3.1:
if (expressionStack.size() != 1) {
std::vector<std::string> errors;
while (expressionStack.size() > 1) {
Expression* expression = expressionStack.top();
expressionStack.pop();
errors.push_back(expression->toString());
delete expression;
}
std::ostringstream ex;
ex << “[syntax error] unable to parse the following expressions in antecedent <”
<< Op::join(errors, ” “) << “>”;
throw fl::Exception(ex.str(), FL_AT);
}September 4, 2014 at 23:31 #1421Juan Rada-Vilela (admin)
KeymasterHi,
Can you please post the rules?
September 5, 2014 at 23:14 #1424Unknown
MemberHai juan please help.. I’m not able to bulid fuzzylit.lib for c++ with my visual studio 2012.. please help..
September 10, 2014 at 23:47 #1445Unknown
MemberHi,
Apparently this was related to some memory errors of my own code and not related to the fuzzyLite library. Thanks for the help!
-
AuthorPosts
- You must be logged in to reply to this topic.