FuzzyLogic in Javascript?

Does anyone know how to access fuzzy logic from javascript? I have a good library with a fuzzy library in Java and C ++, but I need something that I could run from HTML5 / javascript.

+5
source share
3 answers

Two projects are available:

+5
source

Parameters:

  • Put the logic on the server and use ajax to access it from the web page.
  • Rewrite it in javascript and include it in your page.
  • ++ javascript.

1) 2) . 3), , , , - , , .

+1

, NodeJS, javascript

, awesome nodejs-java - jFuzzylite, Java.

node -java: https://www.npmjs.com/package/java

Fuzzylite: http://www.fuzzylite.com/. jfuzzylite.jar

I created a membership function in Matlab membership_function_pn.fis . It has two inputs and one output. Enter mfedit in the Matlab command interface, the FIS editor will appear, where you can easily make your fuzzy function.

The following is my code that did the job! (To understand how code works in Nodejs, first do a Java practice with jfuzzylite.jar ).

var java = require("java");
var fs = require("fs");
java.classpath.push("commons-lang3-3.1.jar");
java.classpath.push("commons-io.jar");
java.classpath.push("jfuzzylite.jar");


var matlabString = fs.readFileSync("dataMatlab/membership_function_pn.fis", 'utf8');
var FisImporter = java.newInstanceSync("com.fuzzylite.imex.FisImporter");
var engineMatlab = java.callMethodSync(FisImporter, "fromString", matlabString);
var InputVariable = java.newInstanceSync('com.fuzzylite.imex.FisImporter');


var OutputVariable = java.callMethodSync(engineMatlab, "getOutputVariable", 0);
var bandwidthInputVariable = java.callMethodSync(engineMatlab, "getInputVariable", 0);
var timeInputVariable = java.callMethodSync(engineMatlab, "getInputVariable", 1);
java.callMethodSync(bandwidthInputVariable, "setInputValue", -0.5);
java.callMethodSync(timeInputVariable, "setInputValue", 0.5);
java.callMethodSync(engineMatlab, "process");
var resultFuzzy = java.callMethodSync(OutputVariable, "getOutputValue");

console.log("μ•ˆλ…•ν•˜μ„Έμš”" + resultFuzzy);
0
source

All Articles