我在论文项目中使用jfuzzylogic应用程序。当我试图在Android平台上运行jfuzzylogic应用程序时,我遇到了一个问题。我在下面运行此代码后,无法加载fcl文件。我猜Android平台无法检测或识别fcl文件。但是,当我在普通计算机中运行这个相同的jfuzzylogic代码块时,fcl文件被正确加载。有人对此问题有任何建议吗?可以在Android平板电脑上运行jfuzzylogic应用程序吗?这是代码:
import net.sourceforge.jFuzzyLogic.FIS;
import android.widget.TextView;
public class Mixing implements Runnable {
public Interfacekit mixkit,sonarkit;
public TextView[] Rfidviews;
int count;
public Mixing(Interfacekit sonarkit,Interfacekit dishkit,Interfacekit mixkit,Rfid mrfid1,Rfid mrfid2, Rfid mrfid3,Rfid mrfid4,Rfid dishrfid,Rfid sinkrfid,Rfid stoverfid,Temperature eggtemp,Temperature stovetemp,final TextView[] Rfidviews)
{
this.sonarkit=sonarkit;
this.Rfidviews = Rfidviews;
new Thread(this).start();
}
public void run()
{
while(count==1){
//////////////////////////initial states
if(mixkit.getattach()==true||sonarkit.getattach()==true )
{
Rfidviews[20].post(new Runnable() {
public void run() {
{
// Vassiliki
// Load from 'FCL' file
String vassiliki_fileName1= "vassiliki_examinable.fcl";
// Vassiliki Examinable
/* I FACED PROBLEM IN THIS LINE. THIS FCL FILE WASN'T LOADED SINCE I GUESS ANDROID TABLET CAN'T DETECT
* OR RECOGNIZE FCL FILE.
*/
FIS vassiliki_examinable_obj1 = FIS.load(vassiliki_fileName1,true);
// Error while loading?
if( vassiliki_examinable_obj1 == null ) {
System.err.println("Can't load file: '"
+ vassiliki_fileName1 + "'");
return;
}
int sonar1 = sonarkit.getsonar(2);
if (sonar1 != 0){
vassiliki_examinable_obj1.setVariable("proximity", sonar1);
vassiliki_examinable_obj1.setVariable("obj_orient_perception", 1);
vassiliki_examinable_obj1.setVariable("obj_size", 40);
vassiliki_examinable_obj1.evaluate();
double ex_toaster=vassiliki_examinable_obj1.getVariable("examinable").getValue();
if(ex_toaster>10){
Rfidviews[20].setText("Toaster");
}
}
else
Rfidviews[20].setText(" ");
}
}
});
}
}
}
}
答案 0 :(得分:0)
使用jfuzzylite代替。它是免费和开源的。它不需要第三方库,包含比jfuzzylogic更多的功能(参数优化除外),二进制大小小于300KB,并且它在Android上运行完美。访问www.fuzzylite.com。