<?php

require_once '../fuzzy-logic-class.php';
/*--------------------------- start tank demo controll --------*/
$x = new Fuzzy_Logic();
$x->clearMembers();
/* ---------- set input members ---------*/
$x->setInputNames(array('ERROR', 'RATE'));
$x->addMember($x->getInputName(0), 'E_NEG', -1, -0.9, 0, LINFINITY);
$x->addMember($x->getInputName(0), 'E_OK', -0.1, 0, 0.1, TRIANGLE);
$x->addMember($x->getInputName(0), 'E_POS', 0, 0.9, 1, RINFINITY);
$x->addMember($x->GetInputName(1), 'R_NEG', -0.1, -0.07000000000000001, 0, LINFINITY);
$x->addMember($x->GetInputName(1), 'R_OK', -0.07000000000000001, 0, 0.07000000000000001, TRIANGLE);
$x->addMember($x->GetInputName(1), 'R_POS', 0, 0.07000000000000001, 0.1, RINFINITY);
/* ---------- set output members ---------*/
$x->setOutputNames(array('OUT'));
$x->addMember($x->getOutputName(0), 'CF', -1.0, -0.9, -0.8, TRIANGLE);
$x->addMember($x->getOutputName(0), 'CS', -0.6, -0.5, -0.4, TRIANGLE);
$x->addMember($x->getOutputName(0), 'NC', -0.1, 0.0, 0.1, TRIANGLE);
$x->addMember($x->getOutputName(0), 'OS', 0.4, 0.5, 0.6, TRIANGLE);
$x->addMember($x->getOutputName(0), 'OF', 0.8, 0.9, 1.0, TRIANGLE);
/* ---------- set rule table ------------ */
/* ---------- set rule table ------------ */
/* ---------- set rule table ------------ */
$x->clearRules();
$x->addRule('IF ERROR.E_NEG THEN OUT.CF');
$x->addRule('IF ERROR.E_OK THEN OUT.NC');
$x->addRule('IF ERROR.E_POS THEN OUT.OF');
$x->addRule('IF ERROR.E_OK AND RATE.R_POS THEN OUT.CS');
$x->addRule('IF ERROR.E_OK AND RATE.R_NEG THEN OUT.OS');
$x->setFuzzyTable(array(array('E_NEG', NULL, 'CF'), array('E_OK', NULL, 'NC'), array('E_POS', NULL, 'OF'), array('E_OK', 'R_POS', 'CS'), array('E_OK', 'R_NEG', 'OS')));
<?php

require_once '../fuzzy-logic-class.php';
$x = new Fuzzy_Logic();
$x->clearMembers();
$x->SetInputNames(array('project_funding', 'project_staffing'));
$x->addMember($x->getInputName(0), 'inadequate', 0, 20, 40, LINFINITY);
$x->addMember($x->getInputName(0), 'marginal', 20, 50, 80, TRIANGLE);
$x->addMember($x->getInputName(0), 'adequate', 60, 80, 100, RINFINITY);
$x->addMember($x->getInputName(1), 'small', 0, 30, 70, LINFINITY);
$x->addMember($x->getInputName(1), 'large', 30, 70, 100, RINFINITY);
$x->SetOutputNames(array('risk'));
$x->addMember($x->getOutputName(0), 'low', 0, 20, 40, LINFINITY);
$x->addMember($x->getOutputName(0), 'normal', 20, 50, 80, TRIANGLE);
$x->addMember($x->getOutputName(0), 'high', 60, 80, 100, RINFINITY);
$x->clearRules();
$x->addRule('IF project_funding.adequate OR project_staffing.small THEN risk.low');
$x->addRule('IF project_funding.marginal AND project_staffing.large THEN risk.normal');
$x->addRule('IF project_funding.inadequate THEN risk.high');
$project_funding = isset($_GET['project_funding']) ? $_GET['project_funding'] : 35;
$project_staffing = isset($_GET['project_staffing']) ? $_GET['project_staffing'] : 65;
$x->setRealInput('project_funding', $project_funding);
$x->setRealInput('project_staffing', $project_staffing);
$fuzzy_arr = $x->calcFuzzy();
$risk = $fuzzy_arr['risk'];
$bar_width = 320;
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
        "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>