我正在尝试用jfuzzylite
创建java模糊项目。但我的项目有错误。我的项目类型是Maven。
错误:
The project was not built since its build path is incomplete. Cannot find the class file for com.fuzzylite.norm.SNorm. Fix the build path then try building this project
The type com.fuzzylite.norm.SNorm cannot be resolved. It is indirectly referenced from required .class files tipper.java
的pom.xml
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.fuzzy</groupId>
<artifactId>02-jfuzzylite</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>02-jfuzzylite</name>
<dependencies>
<!-- https://mvnrepository.com/artifact/com.fuzzylite/jfuzzylite -->
<dependency>
<groupId>com.fuzzylite</groupId>
<artifactId>jfuzzylite</artifactId>
<version>6.0.1</version>
</dependency>
</dependencies>
</project>
tipper.java
import com.fuzzylite.*;
import com.fuzzylite.activation.*;
import com.fuzzylite.defuzzifier.*;
import com.fuzzylite.factory.*;
import com.fuzzylite.hedge.*;
import com.fuzzylite.imex.*;
import com.fuzzylite.norm.*;
import com.fuzzylite.norm.s.*;
import com.fuzzylite.norm.t.*;
import com.fuzzylite.rule.*;
import com.fuzzylite.term.*;
import com.fuzzylite.variable.*;
public class tipper{
public static void main(String[] args){
//Code automatically generated with jfuzzylite 6.0.
Engine engine = new Engine();
engine.setName("tipper");
engine.setDescription("");
InputVariable service = new InputVariable();
service.setName("service");
service.setDescription("");
service.setEnabled(true);
service.setRange(0.000, 10.000);
service.setLockValueInRange(false);
service.addTerm(new Gaussian("poor", 0.000, 1.500));
service.addTerm(new Gaussian("good", 5.000, 1.500));
service.addTerm(new Gaussian("excellent", 10.000, 1.500));
engine.addInputVariable(service);
InputVariable food = new InputVariable();
food.setName("food");
food.setDescription("");
food.setEnabled(true);
food.setRange(0.000, 10.000);
food.setLockValueInRange(false);
food.addTerm(new Trapezoid("rancid", 0.000, 0.000, 1.000, 3.000));
food.addTerm(new Trapezoid("delicious", 7.000, 9.000, 10.000, 10.000));
engine.addInputVariable(food);
OutputVariable tip = new OutputVariable();
tip.setName("tip");
tip.setDescription("");
tip.setEnabled(true);
tip.setRange(0.000, 30.000);
tip.setLockValueInRange(false);
tip.setAggregation(new Maximum());
tip.setDefuzzifier(new Centroid(200));
tip.setDefaultValue(Double.NaN);
tip.setLockPreviousValue(false);
tip.addTerm(new Triangle("cheap", 0.000, 5.000, 10.000));
tip.addTerm(new Triangle("average", 10.000, 15.000, 20.000));
tip.addTerm(new Triangle("generous", 20.000, 25.000, 30.000));
engine.addOutputVariable(tip);
RuleBlock ruleBlock = new RuleBlock();
ruleBlock.setName("");
ruleBlock.setDescription("");
ruleBlock.setEnabled(true);
ruleBlock.setConjunction(new Minimum());
ruleBlock.setDisjunction(new Maximum());
ruleBlock.setImplication(new Minimum());
ruleBlock.setActivation(new General());
ruleBlock.addRule(Rule.parse("if service is poor or food is rancid then tip is cheap", engine));
ruleBlock.addRule(Rule.parse("if service is good then tip is average", engine));
ruleBlock.addRule(Rule.parse("if service is excellent or food is delicious then tip is generous", engine));
engine.addRuleBlock(ruleBlock);
}
}