Giter VIP home page Giter VIP logo

help's Issues

"[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.

"[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.

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

`

'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.

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!

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()));
    }
}

}

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.

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

Surface plot

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

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

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.

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.