我将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(" ");
}
}
});
}
}
}
}
最佳答案
请改用jfuzzylite。它是免费和开源的。它不需要第三方库,比jfuzzylogic包含更多功能(参数优化除外),二进制文件大小小于300KB,并且在Android上运行完美。请访问www.fuzzylite.com。