|
FuzzyAlgebra.java
|
// FILE. . . . . d:/hak/hlt/src/hlt/math/fuzzy/FuzzyAlgebra.java // EDIT BY . . . Hassan Ait-Kaci // ON MACHINE. . Hp-Zbook // STARTED ON. . Sun May 6 08:23:47 2018 // Last modified on Sun May 27 06:00:12 2018 by hak package hlt.math.fuzzy;
This class provides definitions for two dual fuzzy operations:
sup (∨) and inf
(∧). Unless redefined otherwise, these operations
default respectively to Math.max and Math.min;
i.e.,
|
public class FuzzyAlgebra implements FuzzyOperations { static private final int maxmin = 0; static private final int product = 1; static private final int luka = 2; static private int fuzzyAlgebra = maxmin;
| Sets the current fuzzy algebra to the one corresponding to the given string. If no known fuzzy algebra corresponds to the string, this sets it to max/min and issues a warning. |
static public void setFuzzyAlgebra (String algebra) { fuzzyAlgebra = algebraKind(algebra); System.out.println("Current fuzzy algebra set to: "+stringForm(fuzzyAlgebra)); } static private String stringForm (int algebra) { switch (algebra) { case maxmin: return "Max/Min"; case product: return "Product (Probabilistic)"; case luka: return "Lukasiewicz"; } return "Max/Min"; }
| Returns an int identifying the fuzzy algebra corresponding to the given kind string. |
static private int algebraKind (String kind) { switch (kind) { case "MaxMin": case "maxmin": case "MinMax": case "minmax": case "Default": case "default": return maxmin; case "Probabilistic": case "probabilistic": case "Product": case "product": return product; case "Luka": case "luka": case "Lukasiewicz": case "lukasiewicz": return luka; default: System.err.println("Warning! Unsupported fuzzy algebra: " + kind + "; using default (\"MaxMin\")"); } return maxmin; }
| Returns the supremum of the arguments in the current fuzzy algebra. |
public double sup (double left, double right) { switch (fuzzyAlgebra) { case product: return left + right - left*right; case luka: return Math.min(left+right,1); } return Math.max(left,right); }
| Returns the infimum of the arguments in the current fuzzy algebra. |
public double inf (double left, double right) { switch (fuzzyAlgebra) { case product: return left*right; case luka: return Math.max(0,left+right-1); } return Math.min(left,right); } }
This file was generated on Sat Aug 25 09:29:34 CEST 2018 from file FuzzyAlgebra.java
by the hlt.language.tools.Hilite Java tool written by Hassan Aït-Kaci