我正在编写一个 android 应用程序,它使用模糊推理来显示我的一项活动的最终结果。我为此目的使用jFuzzyLogic库,首先我只想在我的应用程序中运行著名的自卸车模糊问题,
但是当我在我的onCreate方法中编写以下代码并运行应用程序时,应用程序关闭并停止运行!
我想它无法加载 FIS 文件“tipper.fcl” 有人可以帮忙吗
谢谢
这是我的 onCreate 方法:
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
//context = MainActivity.this;
double out=0;
String error = "can't load fis" ;
my_textview = (TextView) findViewById(R.id.output_tv);
String fileName = "tipper.fcl";
FIS fis = FIS.load(fileName, true); // Load from 'FCL' file
if (fis == null) {
my_textview.setText(error);
}
fis.setVariable("service", 3);
fis.setVariable("food", 7);
fis.evaluate();
out = fis.getVariable("tip").getValue();
my_textview.setText(String.valueOf(out));
}