home Forums # Technical Support Importing fll,fcl,fis

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #1589
    Unknown
    Member

    Hello 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

    #1590
    Unknown
    Member

    I purchased the license. But is it posible to use the same features on the libraries.
    Is there a API Docutmentation ?

    #1592
    Unknown
    Member

    OK 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

    #1596

    Hi,

    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, the engine refers to the engine previously imported using FldImporter 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 of FldExporter.h and FldExporter.cpp. Both should be self-explanatory.

    #1599
    Unknown
    Member

    Thank 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

Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.