home › Forums › # Technical Support › Importing fll,fcl,fis
- This topic has 4 replies, 2 voices, and was last updated 8 years, 8 months ago by
Unknown.
-
AuthorPosts
-
January 2, 2015 at 22:48 #1589
Unknown
MemberHello Juan,
thanks for the great job you did.
I currently started to use fuzzy logic and think it would be a good think to integrate it into my applications.
Especially because I have to do a lot of descissons in the code and I think it would be a more slim approach to
let it do the fuzzy logic engine.
But I have to do a lot of testing and changes on parameters. So I thought that in steat to always export and compile the fuzzy logic code, it would be good to just import the rules using fll,fcl or fis and run it with the fuzzylite library.
Is this posible ?best regards and thanks,
Haluk
January 3, 2015 at 00:29 #1590Unknown
MemberI purchased the license. But is it posible to use the same features on the libraries.
Is there a API Docutmentation ?January 3, 2015 at 01:34 #1592Unknown
MemberOK I did some forum search.
This seams like the solution.
#include <fl/Headers.h> int main(int argc, char** argv){ std::string fisEngine = readFromSomeFile("xxx.fis"); std::vector<std::vector<fl::scalar> > inputs = readFromSomeFileAndParse("xxx.dat"); fl::Engine* engine = FisImporter().fromString(fisEngine); for (std::size_t i = 0 ; i < inputs.size(); ++i){ for (std::size_t x = 0 ; x < inputs.at(i).size(); ++x){ engine->getInputVariable(x)->setInputValue(inputs.at(i).at(x)); } engine->process(); for (int i = 0 ; i < engine->numberOfOutputVariables(); ++i){ fl::scalar output = engine->getOutputVariable(i)->defuzzify(); writeToSomeFile(output + " "); } writeToSomeFile(output + "\n"); }
But I still didn’t found the API Doc 🙂
br haluk
January 5, 2015 at 15:28 #1596Juan Rada-Vilela (admin)
KeymasterHi,
Thank you for your kind words.
There is no API documentation as of now, unfortunately. Once I get time, I will write some, but for now, you can read the code and should not be too hard to follow.
It is definitely possible to import a fuzzy engine and use it. In fuzzylite 5.0, you can do:
Engine* engine = FllImporter().fromFile("path/to/file.fll");
In addition, you can export the data to a file using the
FldExporter
, specifically, one of the following two methods:virtual void toFile(const std::string& path, Engine* engine, int maximumNumberOfResults) const; virtual void toFile(const std::string& path, Engine* engine, const std::string& inputData) const;
The first divides the values of the input variables such that the total number of combinations is at most
maximumNumberOfResults
.The second takes the input values separated by spaces (or tabs) and each is the input value for the input variables in your engine. You can use it as:
FldExporter exporter; exporter.toFile("path/to/yourFile.fld", engine, contentsOfFile);
where
contentsOfFile
is the data read from a file, theengine
refers to the engine previously imported usingFldImporter
and “path/to/yourFile.fld” is the file where the output values will be written.You can also configure the
FldExporter
, please check the source code ofFldExporter.h
andFldExporter.cpp
. Both should be self-explanatory.January 5, 2015 at 23:34 #1599Unknown
MemberThank you verry much for your detailed answer 🙂
I currently also use ruby a lot and am thinking to do a ruby gem module for the public, when I have more time.
It would be a wrapper to your fuzzylight engine. So only compiled ones and then just us the functionaltiy by using the wrapper method or importing the rules.thanks a lot,
Haluk -
AuthorPosts
- You must be logged in to reply to this topic.