Sun Sep 2 16:39:37 UTC 2018

fuzzy 1.3.1 released!

Configuring and building:

./configure --prefix=/usr

Now, as the root user:

make install

Mon Nov 14 00:26:23 UTC 2016
Fuzzy 1.3 released!
Fixed scope for user-defined type in the function (body) which be member of an array element

Tue Nov 8 10:06:03 UTC 2016
Fuzzy 1.2 released!
Fixed and extended overloading functions

Sat Nov 5 15:25:38 UTC 2016
Fuzzy 1.1 released!
Fixed statement return in loop and switch statements

Thu Nov 3 15:37:49 UTC 2016
FUZZY Programming Language

Fuzzy 1.0 released!


    fuzzy PROGRAM-FILE
    fuzzy -h

Fuzzy is an implementation of the FUZZY programming language. Fuzzy is designed to process linguistic variables and fuzzy sets with vague concepts such as HIGH, LOW, MEDIUM, VERY HIGH, NOT VERY LOW. Fuzzy reads the FUZZY program source from the file PROGRAM-FILE.


    -h Display the help and exit


Hello World program
FUZZY programs have no main function. The source codes of a simplest program may like this

print "Hello World";

Basic types
Basic types are int, Number, String, bool and fuzzy. Most of them can be assigned to another, for instance

int i = 100;
i += 50;
String text = i;
speed.high = i + 50; // speed.high is a fuzzy set

Control Statements
Control Statements while, for, if, else, break, continue, return are similar to C/C++. Statement switch can be used for String type

switch(text) // text is a String variable
case "abc":
    // do something
case "def":
    // do something

Override functions
Similar to C++, Fuzzy can be used to override functions and operators. operator= can be used with return type is void. Member variables can be initialized inside a struct

struct OBJECT
    int m_i = 50;
    String m_string = "abc";
    Number m_array[10]; //an array of Number
    void operator = (OBJECT t)
        m_i = t.m_i;
        m_string = t.m_string;
        for(int i = 0; i < 10; i++)
            m_array[i] = t.m_array[i];
    OBJECT operator - ()
        OBJECT obj;
        obj.m_i = -m_i;
        return obj;

fuzzy set and fuzzy term
Discrete fuzzy sets must be declared inside a discrete fuzzy term. The following example shows a fuzzy term with three fuzzy sets. Each one has five elements, each element is a pair grade/value

    fuzzy discrete low(1/100, 0.5/125, 0.25/150, 0.1/175, 0/200);
    fuzzy discrete medium(0.25/100, 0.5/125, 1/150, 0.5/175, 0.25/200);
    fuzzy discrete high(0/100, 0/125, 0.25/150, 0.75/175, 1/200);

Put data into a fuzzy term
Keyword put be used to set values and membership values for fuzzy terms

TEMPERATURE temperature;
put temperature := (0/100, 0/125, 0.5/150, 0.25/175, 0/200);

Apply fuzzy rules

rule temperature.medium AND pressure.medium OR weather.bad OR traffic.bad => speed.low;
rule VERY temperature.high AND pressure.low OR NOT VERY temperature.high AND pressure.medium AND NOT VERY traffic.bad => speed.high;
rule temperature.low AND pressure.high AND REALLY weather.normal OR traffic.normal => speed.medium;
rule (temperature.medium OR pressure.low) AND weather.good OR pressure.low AND traffic.good => speed.high;
rule REALLY temperature.medium AND LITTLE pressure.high AND VERY VERY weather.good => speed.high;

Print fuzzy sets and fuzzy terms
The following statement prints defuzzification value of a fuzzy term

print speed;

if you want to print its fuzzy data, you can use statement prints

prints speed;

Defuzzification method be used is centroid method


Reset fuzzy sets and fuzzy terms
Function ZeroFuzz be used to reset all data of a fuzzy set or fuzzy term to zero


Transfer fuzzy data to array
There is a built-in struct named FuzzyPair. To transfer fuzzy data to array, you declare an array of FuzzyPair whose size is sufficient to store data, then use function FuzzyToArray like this

FuzzyPair array[8];
FuzzyToArray(speed, array);

The struct FuzzyPair has two members, they are m_grade and m_value

for(int i = 0; i < 8; i++)
    print array[i].m_grade, " ", array[i].m_value;

Continuous fuzzy
This type of fuzzy be applied for fuzzy sets which have a declared domain and a center value. The membership function be used is Gaussian function

term TEMPERATURE(100, 200)
    fuzzy low = 100;
    fuzzy medium = 150;
    fuzzy high = 200;

Print to file
Token > be used to redirect output to file for print and prints

print speed > "filename.txt";

Token >> be used to redirect for print and prints, append output to the file

prints speed >> "filename.txt";

Execute a shell command
Execute a shell command with keyword system

String command_text = "sudo makeca -f";
system command_text;

Math functions
Built-in functions of math are sin, cos, tan, atan, ln, log10, exp, pow, sqrt, floor, round, abs, min, and max

Include file
Include file is similar to C/C++

#include "filename.h"

Comment is similar to C/C++, used with token // or pair /* and */

  • See also

Ngôn ngữ lập trình FUZZY: chiến lược bảng băm

Ngôn ngữ lập trình FUZZY: giải mờ một ví dụ quen thuộc

Ngôn ngữ lập trình FUZZY: biến String và phép gán dưới khía cạnh ngôn ngữ

Một chương trình Fuzzy đơn giản

Ngôn ngữ lập trình FUZZY (ngôn ngữ mờ) – chương trình dịch Fuzzy 1.0