I did below sample program for testing.
How can pass input variable to fuzzy function and get out put result.
public class Test {
public static void main(String[] args) {
String inputOne = “colorOne”;
String inputTwo = “ColorTwo”;
String output = fuzzyFuction(inputOne, inputTwo);
System.out.println(output);
}
private static String fuzzyFuction(String inputOne, String inputTwo) {
String configurationFile = “E:\\Test\\src\\ObstacleAvoidance.fll”;
Engine engine = null;
try {
engine = new FllImporter().fromFile(new File(configurationFile));
} catch (Exception ex) {
FuzzyLite.logger().log(Level.SEVERE, ex.toString(), ex);
}
System.out.println(new JavaExporter().toString(engine)); //this will print the engine in Java code
return null;
}
}
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