" RULE 3 : IF service IS excellent AND food IS delicious THEN tip is generous;\n" + //
"END_RULEBLOCK\n" + //
"\n" + //
"END_FUNCTION_BLOCK\n";
FIS fis = FIS.createFromString(fcl, true);
System.out.println(fis);
// Create a plot
JDialogFis jdf = new JDialogFis(fis, 800, 600);
// Set different values for 'food' and 'service'. Evaluate the system and show variables
for( double service = 0.0, food = 1; service <= 10; service += 0.1 ) {
food = service;
// Evaluate system using these parameters
fis.getVariable("service").setValue(service);
fis.getVariable("food").setValue(food);
fis.evaluate();
// Print result & update plot
System.out.println(String.format("Service: %2.2f\tfood:%2.2f\t=> tip: %2.2f %%", service, food, fis.getVariable("tip").getValue()));
jdf.repaint();
// Small delay
Thread.sleep(100);
}