Current Version: 5.0 (Released: 20/04/2015)


jfuzzylite is a cross-platform, free and open-source fuzzy logic control library programmed entirely in Java. Its goal is to allow you to easily create fuzzy logic controllers in a few steps utilizing object-oriented programming without requiring any third-party libraries.

jfuzzylite is the equivalent of the fuzzylite library for Java and Android platforms.

Repository:   Statistics:


jfuzzylite is licensed under the GNU Lesser General Public License (LGPL) v3.0

Since version 5.0, jfuzzylite is dual-licensed under the GNU Lesser General Public License (LGPL) v3.0 and a paid commercial license.

The change of license is an attempt to raise funds in order to continue working on the development of the fuzzylite family of products, namely fuzzylite (C++), jfuzzylite (Java), pyfuzzylite (Python), and QtFuzzyLite (Windows/Linux/Mac).

There are still many things to do!

Besides donations, you can significantly contribute by purchasing a license of the entirely new QtFuzzyLite commercial application. In addition, if you require (paid) private support, please contact


  • Contains all the features of fuzzylite for C++
  • Binary size of jfuzzylite.jar is smaller than 300KB, which makes it ideal for the Android platform
  • Operation and results fully tested and validated against fuzzylite in both Java and Android platforms
  • Controllers can be visually designed in QtFuzzyLite


If you use Maven, you can add the following snippet to your pom.xml file under <dependencies> to include the jfuzzylite library in your project. For more information, check the example application included in the examples folder.

IMPORTANT: Please download the JAR file from or the github repository. The jfuzzylite 5.0.1 is not available in Maven, and this version fixes a bug on version 5.0.



import com.fuzzylite.Engine;
import com.fuzzylite.FuzzyLite;
import com.fuzzylite.Op;
import com.fuzzylite.defuzzifier.Centroid;
import com.fuzzylite.imex.FldExporter;
import com.fuzzylite.norm.s.Maximum;
import com.fuzzylite.norm.t.Minimum;
import com.fuzzylite.rule.Rule;
import com.fuzzylite.rule.RuleBlock;
import com.fuzzylite.term.Triangle;
import com.fuzzylite.variable.InputVariable;
import com.fuzzylite.variable.OutputVariable;

public class Example {

    public static void main(String[] args){
        Engine engine = new Engine();

        InputVariable ambient = new InputVariable();
        ambient.setRange(0.000, 1.000);
        ambient.addTerm(new Triangle("DARK", 0.000, 0.250, 0.500));
        ambient.addTerm(new Triangle("MEDIUM", 0.250, 0.500, 0.750));
        ambient.addTerm(new Triangle("BRIGHT", 0.500, 0.750, 1.000));

        OutputVariable power = new OutputVariable();
        power.setRange(0.000, 1.000);
        power.addTerm(new Triangle("LOW", 0.000, 0.250, 0.500));
        power.addTerm(new Triangle("MEDIUM", 0.250, 0.500, 0.750));
        power.addTerm(new Triangle("HIGH", 0.500, 0.750, 1.000));

        RuleBlock ruleBlock = new RuleBlock();
        ruleBlock.addRule(Rule.parse("if Ambient is DARK then Power is HIGH", engine));
        ruleBlock.addRule(Rule.parse("if Ambient is MEDIUM then Power is MEDIUM", engine));
        ruleBlock.addRule(Rule.parse("if Ambient is BRIGHT then Power is LOW", engine));

        engine.configure("", "", "Minimum", "Maximum", "Centroid");

        StringBuilder status = new StringBuilder();
        if (!engine.isReady(status)) {
            throw new RuntimeException("Engine not ready. "
                    + "The following errors were encountered:\n" + status.toString());

        for (int i = 0; i < 50; ++i) {
            double light = ambient.getMinimum() + i * (ambient.range() / 50);
                    "Ambient.input = %s -> Power.output = %s",
                    Op.str(light), Op.str(power.getOutputValue())));

What’s new?

The entire fuzzylite library has been thoroughly revised, refactored, validated, and significantly improved. The following list shows a summary of the new features. Users from previous versions are strongly encouraged to visit

  • Support for JDK v1.6 and later.
  • Build from source using Maven or Ant
  • Performance improvements of Takagi-Sugeno by over 55%.
  • Cloning in many classes.
  • Easily compare the FuzzyLite Dataset generated for your engine against the evaluation of the same engine in Matlab or Octave.
  • Better operation of OutputVariable.
  • Every integral Term have a new height parameter.
  • New terms: Concave, Cosine and Spike.
  • Incorporate your own functions thanks to the new FunctionFactory.
  • New hedges: NilpotentMinimum and NilpotentMaximum.
  • Basic rule chaining allows to have rules with an OutputVariable in the antecedent.
  • Changed the role of the accumulation and activation operators in WeightedDefuzzifier, that is, in WeightedAverage and WeightedSum.
  • Importers and exporters support for terms with the new height parameter.
  • In FuzzyLite Language, renamed property lock-valid to lock-previous.
  • New examples of basic rule chaining: mamdani/SimpleDimmerInverse.fll and mamdani/Laundry.fll.
  • FuzzyLite Interactive Console to manually evaluate an engine from console.
  • Fixed minor bugs.

What’s next?

  • Source code documentation
  • Type-2 Fuzzy Logic Controllers
  • Adaptive Neuro-Fuzzy Inference System (ANFIS)
  • Fuzzy C-means data clustering

Building from source

Building from source requires you to have either Ant or Maven installed.

 #using Ant from jfuzzylite/jfuzzylite:
 ant -f build.xml

 #using Maven from jfuzzylite/jfuzzylite:
 mvn install

The Ant script will create the library bin/jfuzzylite.jar and the library sources bin/jfuzzylite-src.jar.

The Maven script will create the library target/jfuzzylite-5.0.jar and library sources target/jfuzzylite-5.0-sources.jar.

The binaries built by Ant and Maven are equivalent.

Building from source

After building from source, the binary jfuzzylite.jar will be ready to use for both Java and Android platforms. In addition, the binary file jfuzzylite.jar contains the FuzzyLite Interactive Console application which allows you to import and export your controllers. Its usage can be obtained as follows.

 #from jfuzzylite/jfuzzylite/bin
 java -jar jfuzzylite.jar