Giter VIP home page Giter VIP logo

help's Introduction

fuzzylite 7.0 (in progress)

A Fuzzy Logic Control Library in C++

fuzzylite

by Juan Rada-Vilela, PhD

License: GPL v3
License: Paid

Linux Medium Build
macOS Medium Build
Windows Medium Build

Coverage Status

The FuzzyLite Libraries for Fuzzy Logic Control refer to fuzzylite (C++), pyfuzzylite (Python), and jfuzzylite (Java).

The goal of the FuzzyLite Libraries is to easily design and efficiently operate fuzzy logic controllers following an object-oriented programming model with minimal dependency on external libraries.

fuzzylite is dual-licensed under the GNU GPL 3.0 and under a proprietary license for commercial purposes.

You are strongly encouraged to support the development of the FuzzyLite Libraries by purchasing a license of QtFuzzyLite.

QtFuzzyLite is the best graphical user interface available to easily design and directly operate fuzzy logic controllers in real time. Available for Windows, Mac, and Linux, its goal is to significantly speed up the design of your fuzzy logic controllers, while providing a very useful, functional and beautiful user interface. Please, download it and check it out for free at fuzzylite.com/downloads.

Visit fuzzylite.com/documentation

(6) Controllers: Mamdani, Takagi-Sugeno, Larsen, Tsukamoto, Inverse Tsukamoto, Hybrid

(25) Linguistic terms: (5) Basic: Triangle, Trapezoid, Rectangle, Discrete, SemiEllipse. (8) Extended: Bell, Cosine, Gaussian, GaussianProduct, PiShape, SigmoidDifference, SigmoidProduct, Spike. (7) Edges: Arc, Binary, Concave, Ramp, Sigmoid, SShape, ZShape. (3) Functions: Constant, Linear, Function. (2) Special: Aggregated, Activated.

(7) Activation methods: General, Proportional, Threshold, First, Last, Lowest, Highest.

(9) Conjunction and Implication (T-Norms): Minimum, AlgebraicProduct, BoundedDifference, DrasticProduct, EinsteinProduct, HamacherProduct, NilpotentMinimum, LambdaNorm, FunctionNorm.

(11) Disjunction and Aggregation (S-Norms): Maximum, AlgebraicSum, BoundedSum, DrasticSum, EinsteinSum, HamacherSum, NilpotentMaximum, NormalizedSum, UnboundedSum, LambdaNorm, FunctionNorm.

(7) Defuzzifiers: (5) Integral: Centroid, Bisector, SmallestOfMaximum, LargestOfMaximum, MeanOfMaximum. (2) Weighted: WeightedAverage, WeightedSum.

(7) Hedges: Any, Not, Extremely, Seldom, Somewhat, Very, Function.

(3) Importers: FuzzyLite Language fll, Fuzzy Inference System fis, Fuzzy Control Language fcl.

(7) Exporters: C++, Java, FuzzyLite Language fll, FuzzyLite Dataset fld, R script, Fuzzy Inference System fis, Fuzzy Control Language fcl.

(30+) Examples of Mamdani, Takagi-Sugeno, Tsukamoto, and Hybrid controllers from fuzzylite, Octave, and Matlab, each included in the following formats: C++, Java, fll, fld, R, fis, and fcl.

FuzzyLite Language

#File: ObstacleAvoidance.fll
Engine: ObstacleAvoidance
InputVariable: obstacle
  enabled: true
  range: 0.000 1.000
  lock-range: false
  term: left Ramp 1.000 0.000
  term: right Ramp 0.000 1.000
OutputVariable: mSteer
  enabled: true
  range: 0.000 1.000
  lock-range: false
  aggregation: Maximum
  defuzzifier: Centroid 100
  default: nan
  lock-previous: false
  term: left Ramp 1.000 0.000
  term: right Ramp 0.000 1.000
RuleBlock: mamdani
  enabled: true
  conjunction: none
  disjunction: none
  implication: AlgebraicProduct
  activation: General
  rule: if obstacle is left then mSteer is right
  rule: if obstacle is right then mSteer is left
//File: ObstacleAvoidance.cpp
#include <fl/Headers.h>

fl::Engine* engine = fl::FllImporter().fromFile("ObstacleAvoidance.fll");

C++

//File: ObstacleAvoidance.cpp
#include <fl/Headers.h>

using namespace fuzzylite;

Engine* engine = new Engine;
engine->setName("ObstacleAvoidance");
engine->setDescription("");

InputVariable* obstacle = new InputVariable;
obstacle->setName("obstacle");
obstacle->setDescription("");
obstacle->setEnabled(true);
obstacle->setRange(0.000, 1.000);
obstacle->setLockValueInRange(false);
obstacle->addTerm(new Ramp("left", 1.000, 0.000));
obstacle->addTerm(new Ramp("right", 0.000, 1.000));
engine->addInputVariable(obstacle);

OutputVariable* mSteer = new OutputVariable;
mSteer->setName("mSteer");
mSteer->setDescription("");
mSteer->setEnabled(true);
mSteer->setRange(0.000, 1.000);
mSteer->setLockValueInRange(false);
mSteer->setAggregation(new Maximum);
mSteer->setDefuzzifier(new Centroid(100));
mSteer->setDefaultValue(fl::nan);
mSteer->setLockPreviousValue(false);
mSteer->addTerm(new Ramp("left", 1.000, 0.000));
mSteer->addTerm(new Ramp("right", 0.000, 1.000));
engine->addOutputVariable(mSteer);

RuleBlock* mamdani = new RuleBlock;
mamdani->setName("mamdani");
mamdani->setDescription("");
mamdani->setEnabled(true);
mamdani->setConjunction(fl::null);
mamdani->setDisjunction(fl::null);
mamdani->setImplication(new AlgebraicProduct);
mamdani->setActivation(new General);
mamdani->addRule(Rule::parse("if obstacle is left then mSteer is right", engine));
mamdani->addRule(Rule::parse("if obstacle is right then mSteer is left", engine));
engine->addRuleBlock(mamdani);
using namespace fuzzylite;

std::string status;
if (not engine->isReady(&status))
    throw Exception("[engine error] engine is not ready:\n" + status, FL_AT);

InputVariable* obstacle = engine->getInputVariable("obstacle");
OutputVariable* steer = engine->getOutputVariable("steer");

for (int i = 0; i <= 50; ++i){
    scalar location = obstacle->getMinimum() + i * (obstacle->range() / 50);
    obstacle->setValue(location);
    engine->process();
    FL_LOG("obstacle.input = " << Op::str(location) << 
        " => " << "steer.output = " << Op::str(steer->getValue()));
}

Once you have an engine written in C++, you can compile it to create an executable file which links to the fuzzylite library. The linking can be either static or dynamic. Basically, the differences between static and dynamic linking are the following.

Static linking includes the fuzzylite library into your executable file, hence increasing its size, but the executable no longer needs to have access to the fuzzylite library files.

Dynamic linking does not include the fuzzylite library into your executable file, hence reducing its size, but the executable needs to have access to the fuzzylite shared library file. When using dynamic linking, make sure that the shared library files are either in the same directory as the executable, or are reachable via environmental variables:

rem Windows:
set PATH="\path\to\fuzzylite\release\bin;%PATH%"
#Unix:
export LD_LIBRARY_PATH="/path/to/fuzzylite/release/bin/:$LD_LIBRARY_PATH"

Windows

The commands to compile your engine in Windows are the following:

C++11 (default)

rem static linking:
cl.exe ObstacleAvoidance.cpp fuzzylite-static.lib /Ipath/to/fuzzylite /EHsc /MD
rem dynamic linking:
cl.exe ObstacleAvoidance.cpp fuzzylite.lib /Ipath/to/fuzzylite /DFL_IMPORT_LIBRARY /EHsc /MD 

C++98

rem static linking:
cl.exe ObstacleAvoidance.cpp fuzzylite-static.lib /Ipath/to/fuzzylite /DFL_CPP98=ON /EHsc /MD
rem dynamic linking:
cl.exe ObstacleAvoidance.cpp fuzzylite.lib /Ipath/to/fuzzylite /DFL_IMPORT_LIBRARY /DFL_CPP98=ON /EHsc /MD 

Unix

The commands to compile your engine in Unix are the following:

C++11 (default)

#static linking
g++ ObstacleAvoidance.cpp -o ObstacleAvoidance -I/path/to/fuzzylite -L/path/to/fuzzylite/release/bin -lfuzzylite-static --std=c++11
#dynamic linking
g++ ObstacleAvoidance.cpp -o ObstacleAvoidance -I/path/to/fuzzylite -L/path/to/fuzzylite/release/bin -lfuzzylite -Wno-non-literal-null-conversion

C++98

#static linking
g++ ObstacleAvoidance.cpp -o ObstacleAvoidance -I/path/to/fuzzylite -L/path/to/fuzzylite/release/bin -lfuzzylite-static -DFL_CPP98=ON
#dynamic linking
g++ ObstacleAvoidance.cpp -o ObstacleAvoidance -I/path/to/fuzzylite -L/path/to/fuzzylite/release/bin -lfuzzylite -DFL_CPP98=ON -Wno-non-literal-null-conversion

Alternatively, you can use CMake to build your project linking to fuzzylite. Please, refer to the example application available at examples/application.

You can build the fuzzylite library from source using CMake (cmake.org).

Check .github/workflows for details.

Unix

cmake -B build/ -G"Unix Makefiles"  .
cmake --build build/ --parallel
ctest --test-dir build/

Windows

cmake -B build/ -G"NMake Makefiles" .
cmake --build build/
ctest --test-dir build/

Building Options

The following building options available:

-DFL_USE_FLOAT=ON builds the binaries using the fl::scalar data type as a float instead of double. By default, the binaries are built using -DFL_USE_FLOAT=OFF. If fuzzylite is built with -DFL_USE_FLOAT=ON, then the applications linking to fuzzylite also need to specify this compilation flag.

-DFL_CPP98=ON builds binaries using C++98 features instead of C++11. By default, the binaries are built using -DFL_CPP98=OFF. If you use C++98, you will not be able to benchmark the performance of your engine using the Benchmark class, and you will not be able to run any of the tests.

-DFL_BACKTRACE=OFF disables the backtrace information in case of errors. By default, the binaries are built using -DFL_BACKTRACE=ON. In Windows, the backtrace information requires the external library dbghelp, which is generally available in your system.

Documentation

The source code of fuzzylite is very well documented using doxygen formatting, and the documentation is available at fuzzylite.com/documentation. If you want to generate the documentation locally, you can produce the html documentation from the file Doxyfile using the command line: doxygen Doxyfile. The documentation will be created in the documentation folder.

After building from source, the following are the relevant binaries that will be created in Release mode. In Debug mode, the file names end with -debug (e.g., fuzzylite-debug.exe).

Windows

  • console application: fuzzylite.exe
  • shared library: fuzzylite.dll, fuzzylite.lib
  • static library: fuzzylite-static.lib

Linux

  • console application: fuzzylite
  • shared library: libfuzzylite.so
  • static library: libfuzzylite-static.a

Mac

  • console application: fuzzylite
  • shared library: libfuzzylite.dylib
  • static library: libfuzzylite-static.a

Console

The console application of fuzzylite allows you to import and export your engines. Its usage can be obtained executing the console binary. In addition, the console can be set in interactive mode. The FuzzyLite Interactive Console allows you to evaluate a given controller by manually providing the input values. The interactive console is triggered by specifying an input file and an output format. For example, to interact with the ObstacleAvoidance controller, the interactive console is launched as follows:

fuzzylite -i ObstacleAvoidance.fll -of fld

All contributions are welcome, provided they follow the following guidelines:

  • Source code is consistent with standards in the library
  • Contribution is properly documented and tested, raising issues where appropriate
  • Contribution is licensed under the FuzzyLite License

If you are using the FuzzyLite Libraries, please cite the following reference in your article:

Juan Rada-Vilela. The FuzzyLite Libraries for Fuzzy Logic Control, 2018. URL https://fuzzylite.com.

Or using bibtex:

@misc{fl::fuzzylite,
    author={Juan Rada-Vilela},
    title={The FuzzyLite Libraries for Fuzzy Logic Control},
    url={https://fuzzylite.com},
    year={2018}
}

fuzzylite® is a registered trademark of FuzzyLite Limited
jfuzzylite™ is a trademark of FuzzyLite Limited
pyfuzzylite™ is a trademark of FuzzyLite Limited
QtFuzzyLite™ is a trademark of FuzzyLite Limited

help's People

Contributors

jcrada avatar

Watchers

 avatar  avatar  avatar  avatar

help's Issues

Implementing a Mean 3Pi aggregation operator with Pyfuzzylite

Hello!

I'm trying to implement a Mean 3Pi (M3P) aggregation operator:

$M3\Pi(x_1, \cdots, x_n) = \frac{\Pi_{j=1}^n (x_j)^{(1/n)}}{\Pi_{j=1}^n (x_j)^{(1/n)} + \Pi_{j=1}^n (1 - x_j)^{(1/n)}}$

I understand that a custom aggregation operator would be defined like this:

import fuzzylite as fl
from fuzzylite.types import Scalar

class Mean3Pi(fl.SNorm):
    def compute(self, a: Scalar, b: Scalar) -> Scalar:

        a = fl.scalar(a)
        b = fl.scalar(b)

        result = ###

        return result

I know that $a$ and $b$ are the membership functions values, however, despite looking into the library I still do not understand how the compute function retrieves those values and how I can manipulate them to implement the operator.

I will this article that explains the M3P better than I can: Analysis_of_New_Aggregation_Operators.pdf

I hope my explanation was not too confusing, feel free to ask if you need more information.

QtFuzzLite 6 Internal Error

The internal error shown in the attached screen dump appeared multiple times whenever I try to access the tsukamoto.fis example provided in the download using my licensed copy of QtFuzzylite 6.
Regards
Tim Wilson
Error QTFuzzylite looking at  Tsukamoto fis example

Issues about Outputs

Hi, Dr. Juan Rada-Vilela,

My name is Wenhui and I am a Ph.D student from Nanyang Technological University.

I am currently implementing C++ code of Fuzzylite-6.0 into my project and am suffering with a wrong output issue.

Several cases outputs nan at which it should not be default value(I know that nan can be displaced with any other value, but the issue is the output should not be a default value).

Unfortunately, I have no idea which line is incorrect after debugging.
Could you please help me with this issue?

I also have attached my file in the email and sent to [email protected]

----------------------------------------------------- script -------------------------------------------------------------------------------
int main(int argc, char* argv[]){
using namespace fl;
//Code automatically generated with fuzzylite 6.0.
using namespace fl;
Engine* engine = new Engine;
engine->setName("ControlAuthority");
engine->setDescription("");

//Define Input Variable
InputVariable* arf = new InputVariable;
arf->setName("arf");
arf->setDescription("");
arf->setEnabled(true);
arf->setRange(1.000, 5.000);
arf->setLockValueInRange(false);
arf->addTerm(new Trapezoid("small", 1.000, 1.000, 1.500, 2.500));
arf->addTerm(new Triangle("medium", 1.500, 2.500, 3.500));
arf->addTerm(new Trapezoid("large", 2.500, 3.500, 5.000, 5.000));
engine->addInputVariable(arf);

InputVariable* steer_dev = new InputVariable;
steer_dev->setName("steer_dev");
steer_dev->setDescription("");
steer_dev->setEnabled(true);
steer_dev->setRange(0.000, 0.500);
steer_dev->setLockValueInRange(false);
steer_dev->addTerm(new Trapezoid("very small", 0.000, 0.000, 0.075, 0.150));
steer_dev->addTerm(new Triangle("small", 0.075, 0.150, 0.250));
steer_dev->addTerm(new Triangle("medium", 0.150, 0.250, 0.350));
steer_dev->addTerm(new Trapezoid("large", 0.250, 0.350, 0.500, 0.500));
engine->addInputVariable(steer_dev);

//Define Output Variable
OutputVariable* control_authority = new OutputVariable;
control_authority->setName("control_authority");
control_authority->setDescription("");
control_authority->setEnabled(true);
control_authority->setRange(0.000, 1.000);
control_authority->setLockValueInRange(false);
control_authority->setAggregation(new Maximum);
control_authority->setDefuzzifier(new Centroid(100));
// control_authority->setDefaultValue(fl::nan);
// control_authority->setDefaultValue(1.0);
control_authority->setLockPreviousValue(false);
control_authority->addTerm(new Triangle("low", 0.000, 0.000, 0.400));
control_authority->addTerm(new Triangle("medium", 0.200, 0.400, 0.600));
control_authority->addTerm(new Triangle("high", 0.400, 0.600, 0.800));
control_authority->addTerm(new Triangle("very high", 0.700, 1.000, 1.000));
engine->addOutputVariable(control_authority);

//Define RuleList
RuleBlock* mamdani = new RuleBlock;
mamdani->setName("mamdani");
mamdani->setDescription("");
mamdani->setEnabled(true);
mamdani->setConjunction(new Minimum);
mamdani->setDisjunction(new Maximum);
mamdani->setImplication(new Minimum);
mamdani->setActivation(new General);
// mamdani->setConjunction(new Minimum);
// mamdani->setDisjunction(fl::null);
// mamdani->setImplication(new AlgebraicProduct);
// mamdani->setActivation(new General);
mamdani->addRule(Rule::parse("if arf is small   and steer_dev is very small  then control_authority is very high", engine));
mamdani->addRule(Rule::parse("if arf is small   and steer_dev is small       then control_authority is high", engine));
mamdani->addRule(Rule::parse("if arf is small   and steer_dev is medium      then control_authority is medium", engine));
mamdani->addRule(Rule::parse("if arf is small   and steer_dev is large       then control_authority is medium", engine));
mamdani->addRule(Rule::parse("if arf is medium  and steer_dev is very small  then control_authority is high", engine));
mamdani->addRule(Rule::parse("if arf is medium  and steer_dev is small       then control_authority is medium", engine));
mamdani->addRule(Rule::parse("if arf is medium  and steer_dev is medium      then control_authority is medium", engine));
mamdani->addRule(Rule::parse("if arf is medium  and steer_dev is large       then control_authority is low", engine));
mamdani->addRule(Rule::parse("if arf is large   and steer_dev is very small  then control_authority is medium", engine));
mamdani->addRule(Rule::parse("if arf is large   and steer_dev is small       then control_authority is low", engine));
mamdani->addRule(Rule::parse("if arf is large   and steer_dev is medium      then control_authority is low", engine));
mamdani->addRule(Rule::parse("if arf is large   and steer_dev is large       then control_authority is low", engine));
engine->addRuleBlock(mamdani);

std::string status;
if (not engine->isReady(&status))
    throw Exception("[engine error] engine is not ready:\n" + status, FL_AT);

for (int i = 0; i <= 8; ++i)
{
    scalar arf_candidate = arf->getMinimum() + i * 0.5;
    arf->setValue(arf_candidate);
    for (int j = 0; j <= 10; ++j)
    {
        scalar steer_dev_candidate = steer_dev->getMinimum() + j * 0.05;
        steer_dev->setValue(steer_dev_candidate);
        engine->process();
        FL_LOG("arf.input = " << Op::str(arf_candidate) << "steer_dev.input = " << Op::str(steer_dev_candidate) <<
            " => " << "control_authority.output = " << Op::str(control_authority->getValue()));
    }
}

}

Surface plot

I was wondering if QtFuzzyLite has anything similar to MATLABS Surface plot.

Linking problem Visual Studio C++

Dear Juan ,
first of all congratulations for your amazing work!
I am trying to use fuzzylite in Visual Studio using C++. The problem is that I am getting an "unsolved external symbol" error. I would like to mention that I am not an expert regarding linking, compiling and so on...

I am working on a project about list scheduling. My C++ files are located in the following directory: C:\Users\panawths\Documents\Visual Studio 2015\Projects\ListScheduling\ListScheduling
Let me explain what have i done so far:

  1. Download fuzzylite files, unzip and copy the contents of fuzzylite-6.0-Win64\fuzzylite-6.0\fuzzylite into the C:\Users\panawths\Documents\Visual Studio 2015\Projects\ListScheduling\ListScheduling folder.
  2. Open Project properties->Configuration Properties-> VC++ Directories->Include Directories -> add C:\Users\panawths\Documents\Visual Studio2015\Projects\ListScheduling\ListScheduling\fl
  3. Open Project properties->Configuration Properties-> VC++ Directories->Library Directories -> add C:\Users\panawths\Documents\Visual Studio 2015\Projects\ListScheduling\ListScheduling\release\bin
  4. Open Project properties->Linker->Input->Addition Dependencies->add "C:\Users\panawths\Documents\Visual Studio 2015\Projects\ListScheduling\ListScheduling\release\bin\fuzzylite.lib"
  5. Open Project properties->Linker->General->Addition Library Directories->add C:\Users\panawths\Documents\Visual Studio 2015\Projects\ListScheduling\ListScheduling\Debug\bin, C:\Users\panawths\Documents\Visual Studio 2015\Projects\ListScheduling\ListScheduling\release\bin
  6. Open Project properties->Configuration Properties-> Debugging->Command Arguments -> add C:\Users\panawths\Documents\Visual Studio 2015\Projects\ListScheduling\ListScheduling\release\bin\fuzzylite-static C:\Users\panawths\Documents\Visual Studio 2015\Projects\ListScheduling\ListScheduling /DFL_CPP98=ON /EHsc /MD
  7. Add #include "fl/Headers.h" in the ListScheduling.cpp file (this file includes the main and the fuzzylite code). No compile error so far
    But, when I run my project I get the errors like:

Error LNK2019 unresolved external symbol "public: __thiscall fl::Engine::Engine(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (??0Engine@fl@@QAE@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z) referenced in function _main

Error LNK2019 unresolved external symbol "public: __thiscall fl::General::General(void)" (??0General@fl@@QAE@XZ) referenced in function _main

Error LNK2001 unresolved external symbol "public: virtual class fl::AlgebraicSum * __thiscall fl::AlgebraicSum::clone(void)const " (?clone@AlgebraicSum@fl@@UBEPAV12@XZ)

Warning LNK4272 library machine type 'x64' conflicts with target machine type 'X86'

Thank you

`

"[file error] file <> could not be opened" (update)

Hi! It's me from my previous issue.

I changed Importer.cpp to print out the filepath it was receiving:

Engine* Importer::fromFile(const std::string& path) const {
        std::cout << "path: " << path << '\n';
        std::cout << "path.c_str(): " << path.c_str() << '\n';
        std::ifstream reader(path.c_str());
. . . 

And the ouptut is:

path:
path.c_str(): X÷ÿ↕]
[file error] file <> could not be opened
{at \src\imex\Importer.cpp::fl::Importer::fromFile() [line:33]}

I tried rebuilding the library using build.bat, and already tried fiddling with all of the build options (backtrace, float=on). It builds just fine, the linker on Visual Studio seems to be doing okay and etc, but nothing seems to fix the problem. I also tried using the 32bit version of the lib.

Here's my project setup on Visual Studio:

image
image
image
image

Am I missing a command line argument? A preprocessor parameter? Thanks for your time.

Newbie trouble with building library with CMakeList

Hello, I am working within a robot operating system (ROS) that is built using catkin_make (build system for ROS). catkin_make my program using a CMakeLists.txt file (I think you may have some experience with this from: https://answers.ros.org/question/266550/how-to-use-fuzzylite-on-my-workspace-via-cmakelists/). I'd downloaded your software from: https://www.fuzzylite.com/downloads/ and extracted the files into my ROS workspace. A generalization of my current workspace is here:

workspace
├── CMakeLists.txt
├── scripts
         ├── fuzzylite-6.0
         ├── missions
         │       ├── fuzzy
         │                └── fuzzy.h

Inside the CMakeLists.txt I'd copied the code from https://github.com/fuzzylite/fuzzylite/blob/release/examples/application/CMakeLists.txt into the CMakeLists.txt provided by catkin. I changed set(FL_HOME ${PROJECT_SOURCE_DIR}/../../fuzzylite/) to set(FL_HOME /scripts/fuzzylite-6.0/fuzzylite/).
However, when I tried to build the program I receive the error:

-- ==> add_subdirectory(quantum_drone)
Finding FuzzyLiteLibrary locally at /scripts/fuzzylite-6.0/fuzzylite/release/bin
=====================================
FuzzyLite Demo v6.0

FL_HOME=/scripts/fuzzylite-6.0/fuzzylite
FL_LIBRARY_NAME=fuzzylite-static
FuzzyLiteLibrary=FuzzyLiteLibrary-NOTFOUND

FL_BACKTRACE=ON
FL_STATIC=ON
FL_DEBUG=OFF
CMAKE_BUILD_TYPE=Release
CMAKE_CXX_COMPILER_ID=GNU
CMAKE_CXX_COMPILER_VERSION=7.5.0
CMAKE_CXX_FLAGS=
COMPILE_DEFINITIONS:
-- Defined: ROS_BUILD_SHARED_LIBS=1
-- Defined: ROS_BUILD_SHARED_LIBS=1
=====================================

CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
Please set them or make sure they are set and tested correctly in the CMake files:
FuzzyLiteLibrary
    linked by target "binary" in directory /home/kannachan/drone/src/quantum_drone

-- Configuring incomplete, errors occurred!
See also "/home/kannachan/drone/build/CMakeFiles/CMakeOutput.log".
See also "/home/kannachan/drone/build/CMakeFiles/CMakeError.log".
Makefile:712: recipe for target 'cmake_check_build_system' failed
make: *** [cmake_check_build_system] Error 1
Invoking "make cmake_check_build_system" failed

I assume that the path to the file is incorrect, but I checked many different ways to solve it and still end in no result. I'm not if I actually installed the library correctly (I simply extracted the files from the zip file downloaded from your webiste), so I am very confuse on what my mistake actually is. Appreciate it if you could help me with this!

'not' and 'any'

Hello

I use QTfuzzylite

I'm not shure to understand what's 'not' and 'any' means in the rules

'not'

conjunction: Minimum
disjunction: Maximum
implication: Minimum
activation: General

rule: if TAG is Petite and TAG is not Moyenne and ELE is any then DIS is Treseloignee

With the first part I try to apply the rule only on a small part of TAG where TAG is <0.017.
Capture d’écran du 2022-01-20 10-47-54

But I've got always an output to DIS evens when TAG >0.017

'any'
For the same rule 'ELE is any' give always an output to DIS evens if ELE is 'nan'
Capture d’écran du 2022-01-20 11-06-27

For this I've solve with:
if TAG is Petite and TAG is not Moyenne and (ELE is Basse or ELE is Moyenne or ELE is Elevee) then DIS is Treseloignee

What's is the use of 'any'?

I expect a result on DIS only for the left part of 'Petite' function if ELE is not 'nan'

I hope is clear! Thank-you.

Problem with unassigned input variables

Hi Juan,
I am attempting to create a fuzzy model with multiple outputs but have run into a problem which it took me quite a while to find a solution to. I was unable to find this issue documented anywhere.
My model works fine in the Fuzzylite GUI which by the way I find very nice to use . When I call it from my code which accesses the C++ Fuzzylite library, the call to the output returns a nan. I finally figured out that all input variables in the model, even ones that aren't assigned to the output that is being called seem to have to be assigned a value.
I tried many different ways of locking and unlocking inputs and outputs but it seemed to make no difference. I also notice that the linear variables that I am using in my Takagi-Sugeno style output variables have terms fields in them for all variables in the model, whether they are used in that output variable or not. I found this very confusing and when you have a large number of input variables, the gui interface gets very congested.

The following code returns an error (NAN) from the call to GetOutputVal

SetInputValue("distanceToProfitStop", glvTradeData.distanceToProfitStop);

SetInputValue("recentGradient", glvTradeData.scaledRecentGrad);

calcStatus = CalcFuzzyOutput();

if (calcStatus == SUCCESS)
{
       fuzzyResult =GetOutputVal("letProfitsRunAction");
        ........
}  

The following code returns a valid number

SetInputValue("distanceToProfitStop", glvTradeData.distanceToProfitStop);

SetInputValue("recentGradient", glvTradeData.scaledRecentGrad);

SetInputValue("profitGivenBack", 0);  // This value is not used in the "letProfitsRunAction" but is required to prevent error

calcStatus = CalcFuzzyOutput();

if (calcStatus == SUCCESS)
{
     fuzzyResult =GetOutputVal("letProfitsRunAction");
      ........
} 

A cut down version of the fll file that will reproduce the problem is attached in a zip file.
Test2.zip

Regards
Tim Wilson

"[file error] file <> could not be opened" when trying to import .fis

I'm trying to import a .fis file:

#include <iostream>
#include "fl/Headers.h"

int main()
{
    std::string filePath = "C:\\Users\\me\\fuzzyLogic\\rules.fis";

    fl::Engine* engine = new fl::Engine;

    try
    {
        engine = fl::FisImporter().fromFile(filePath);
    }
    catch (fl::Exception& e)
    {
        std::cerr << e.what() << std::endl; 
    }
} 

Which is outputting to the console:

[file error] file <> could not be opened
{at \src\imex\Importer.cpp::fl::Importer::fromFile() [line:31]}

Line 31 from Importer.cpp checks whether or not the reader is open:

if (not reader.is_open()) {
            throw Exception("[file error] file <" + path + "> could not be opened", FL_AT);
}

So it seems the file path is blank when it's passed to the reader at line 29:

std::ifstream reader(path.c_str());

I'm currently using Visual Studio Community 2022 17.5.0 with Visual C++ 2022, on Windows 11.

Problem with using output variable as input variable in C++

Hi!
I`m trying to build a simple fuzzy finite state machine using fuzzy rules.

I have three variables, an input called Input and two output ones called A and B.

The rules are as follows:

  1. if A is Active and input is One then B is Active and A is not Active
  2. if B is Active and input is Zero then A is Active and B is Not Active

What I expected was when making Input shift from 0.000 to 1.000 I would see a shift from A being Active to B.

Instead both numbers stayed the same I made them, with A being 1.000 and B being 0.000 with every Input value.

Using my code with raw C++ library code i pinpointed that processing OutputVariable follows a different route from InputVariable, calling FuzzyOutput()->ActivationDegree() and FuzzyOutput returning some internal class with it's own set of _terms which is somehow empty returning 0 even if A's value is 1, negating the cross product. I am very confused.

  1. Does the library even have the capability of letting me use it this vay?
    It should , given the if condition, but then again

  2. What can i do to my Output Variables so I may use it?
    I fail to understand how to influence the output without somehow using the variable in another ruleset, initialising it somehow.

Attached is my part of code ,fll and cpp version.
ffsmissue.zip

Hope I explained the issue well.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.