Created
April 29, 2013 01:03
-
-
Save andrecaribe/5479114 to your computer and use it in GitHub Desktop.
JS-Fuzzy Test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title>Fuzzy Logic</title> | |
</head> | |
<script src="./presentation.js"></script> | |
<script src="./raphael-min.js"></script> | |
<body onLoad="presentation();"> | |
<h1>Input Variables:</h1> | |
<div id="variables_input"></div> | |
<hr> | |
<h1>Output Variables:</h1> | |
<div id="variable_output"></div> | |
<hr> | |
<h1>Inferences:</h1> | |
<div id="inferences"></div> | |
<hr> | |
<h1>Input:</h1> | |
<div id="input"></div> | |
<hr> | |
<input type="button" value="Calculate" onClick="document.getElementById('result').innerHTML='Result: '+fl.getResult(obj);"> | |
<span id="result"></span> | |
<div id="draw_result"></div> | |
<script src="../src/fuzzy-min.js"></script> | |
<script> | |
var obj = { | |
crisp_input: [150, 10, 10], | |
variables_input: [ | |
{ | |
name: "Distance to Target", | |
setsName: ["Close", "Medium", "Far"], | |
sets: [ | |
[0,0,25,150], | |
[25,150,150,300], | |
[150,300,400,400] | |
] | |
}, | |
{ | |
name: "Ammo Status", | |
setsName: ["Low", "Okay", "Loads"], | |
sets: [ | |
[0,0,0,10], | |
[0,10,10,30], | |
[10,30,40,40] | |
] | |
}, | |
{ | |
name: "Defense", | |
setsName: ["Light", "Medium", "Heavy"], | |
sets: [ | |
[0,0,0,10], | |
[0,10,10,30], | |
[10,30,40,40] | |
] | |
} | |
], | |
variable_output: { | |
name: "Desirability", | |
setsName: ["Undesirable", "Desirable", "Very Desirable"], | |
sets: [ | |
[0,0,25,50], | |
[25,50,50,75], | |
[50,75,100,100] | |
] | |
}, | |
inferences: [ | |
[0,2,0], | |
[0,1,2], | |
[2,1,0] | |
] | |
}; | |
var fl = new FuzzyLogic(); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment