home › Forums › # Technical Support › Help to resolve error › Reply To: Help to resolve error
public static String fuzzy() {
Engine engine = new Engine();
engine.setName(“simple-dimmer”);
InputVariable service = new InputVariable();
service.setName(“service”);
service.setRange(0.000, 1.000);
service.addTerm(new Triangle(“poor”, 0.000, 0.250, 0.500));
service.addTerm(new Triangle(“good”, 0.250, 0.500, 0.750));
service.addTerm(new Triangle(“excellent”, 0.500, 0.750, 1.000));
engine.addInputVariable(service);
OutputVariable snake = new OutputVariable();
snake.setName(“snake”);
snake.setRange(1, 3);
snake.setDefaultValue(Double.NaN);
snake.addTerm(new Constant(“Cobra”, 1));
snake.addTerm(new Constant(“SEA”, 2));
snake.addTerm(new Constant(“WIFE”, 3));
engine.addOutputVariable(snake);
RuleBlock ruleBlock = new RuleBlock();
ruleBlock.setName(“rule”);
ruleBlock.addRule(Rule.parse(“if service is poor then snake is Cobra”, engine));
ruleBlock.addRule(Rule.parse(“if service is good then snake is SEA”, engine));
ruleBlock.addRule(Rule.parse(“if service is excellent then snake is WIFE”, engine));
engine.addRuleBlock(ruleBlock);
engine.configure(“”, “”, “Minimum”, “Maximum”,”Centroid”, “General”);
engine.setInputValue(“service”, .7);
engine.process();
engine.getOutputVariable(“snake”);
System.out.print(engine.getOutputValue(“snake”));
return String.format(“”, engine.getOutputValue(“snake”));
}
i need to get extract out put variable.
Cobra or SEA or WIFE please help me to do that