mirror of
https://github.com/marcin-szczepanski/jFuzzyLogic.git
synced 2024-12-18 16:35:27 +01:00
Project updated
This commit is contained in:
parent
ecae013c7d
commit
245e2bb2b9
@ -578,7 +578,7 @@ public class FunctionBlock extends FclObject implements Iterable<RuleBlock>, Com
|
||||
/**
|
||||
* Set a variable
|
||||
* @param variableName : Variable's name
|
||||
* @param value : variable's value to be setted
|
||||
* @param value : variable's value to be set
|
||||
* @return this
|
||||
*/
|
||||
public void setVariable(String variableName, double value) {
|
||||
|
@ -12,7 +12,7 @@ public class DefuzzifierCenterOfGravity extends DefuzzifierContinuous {
|
||||
super(variable);
|
||||
}
|
||||
|
||||
/** Deffuzification function */
|
||||
/** Defuzification function */
|
||||
@Override
|
||||
public double defuzzify() {
|
||||
double x = min, sum = 0, weightedSum = 0;
|
||||
|
@ -96,7 +96,7 @@ public abstract class DefuzzifierContinuous extends Defuzzifier {
|
||||
private void init(double min, double max, int numberOfPoints) {
|
||||
values = new double[numberOfPoints];
|
||||
|
||||
// Go on only if min & max are setted
|
||||
// Go on only if min & max are set
|
||||
if (Double.isNaN(min) || Double.isNaN(max)) return;
|
||||
|
||||
// Check parameters
|
||||
|
@ -27,7 +27,7 @@ public abstract class MembershipFunction extends FclObject {
|
||||
|
||||
public abstract boolean checkParamters(StringBuffer errors);
|
||||
|
||||
/** Try to guess the universe (if not setted) */
|
||||
/** Try to guess the universe (if not set) */
|
||||
public abstract void estimateUniverse();
|
||||
|
||||
/** Short name */
|
||||
|
@ -39,7 +39,7 @@ public class MembershipFunctionGaussian extends MembershipFunctionContinuous {
|
||||
|
||||
@Override
|
||||
public void estimateUniverse() {
|
||||
// Are universeMin and universeMax already setted? => nothing to do
|
||||
// Are universeMin and universeMax already set? => nothing to do
|
||||
if( (!Double.isNaN(universeMin)) && (!Double.isNaN(universeMax)) ) return;
|
||||
universeMin = parameters[0].getValue() - 4.0 * parameters[1].getValue();
|
||||
universeMax = parameters[0].getValue() + 4.0 * parameters[1].getValue();
|
||||
|
@ -46,7 +46,7 @@ public class MembershipFunctionGaussian2 extends MembershipFunctionContinuous {
|
||||
|
||||
@Override
|
||||
public void estimateUniverse() {
|
||||
// Are universeMin and universeMax already setted? => nothing to do
|
||||
// Are universeMin and universeMax already set? => nothing to do
|
||||
if ((!Double.isNaN(universeMin)) && (!Double.isNaN(universeMax))) return;
|
||||
universeMin = parameters[0].getValue() - 4.0 * parameters[1].getValue();
|
||||
universeMax = parameters[2].getValue() + 4.0 * parameters[3].getValue();
|
||||
|
@ -57,7 +57,7 @@ public class MembershipFunctionGenericSingleton extends MembershipFunctionDiscre
|
||||
|
||||
@Override
|
||||
public void estimateUniverse() {
|
||||
// Are universeMin and universeMax already setted? => nothing to do
|
||||
// Are universeMin and universeMax already set? => nothing to do
|
||||
if( (!Double.isNaN(universeMin)) && (!Double.isNaN(universeMax)) ) return;
|
||||
universeMin = x[0].getValue();
|
||||
universeMax = x[x.length - 1].getValue();
|
||||
|
@ -33,7 +33,7 @@ public class MembershipFunctionSigmoidal extends MembershipFunctionContinuous {
|
||||
|
||||
@Override
|
||||
public void estimateUniverse() {
|
||||
// Are universeMin and universeMax already setted? => nothing to do
|
||||
// Are universeMin and universeMax already set? => nothing to do
|
||||
if ((!Double.isNaN(universeMin)) && (!Double.isNaN(universeMax))) return;
|
||||
universeMin = parameters[1].getValue() - 9.0 / Math.abs(parameters[0].getValue());
|
||||
universeMax = parameters[1].getValue() + 9.0 / Math.abs(parameters[0].getValue());
|
||||
|
@ -58,7 +58,7 @@ public class MembershipFunctionSingleton extends MembershipFunctionDiscrete {
|
||||
|
||||
@Override
|
||||
public void estimateUniverse() {
|
||||
// Are universeMin and universeMax already setted? => nothing to do
|
||||
// Are universeMin and universeMax already set? => nothing to do
|
||||
if( (!Double.isNaN(universeMin)) && (!Double.isNaN(universeMax)) ) return;
|
||||
universeMin = parameters[0].getValue();
|
||||
universeMax = parameters[0].getValue();
|
||||
|
@ -45,7 +45,7 @@ public class MembershipFunctionTriangular extends MembershipFunctionContinuous {
|
||||
|
||||
@Override
|
||||
public void estimateUniverse() {
|
||||
// Are universeMin and universeMax already setted? => nothing to do
|
||||
// Are universeMin and universeMax already set? => nothing to do
|
||||
if( (!Double.isNaN(universeMin)) && (!Double.isNaN(universeMax)) ) return;
|
||||
universeMin = parameters[0].getValue();
|
||||
universeMax = parameters[2].getValue();
|
||||
|
@ -114,7 +114,7 @@ public abstract class Parameter {
|
||||
/**
|
||||
* Sets parameter to 'value'
|
||||
* @param value
|
||||
* @return 'true' if setted ok, 'false if can't be setted (e.g. due to consistenci errors, out of range, etc.)
|
||||
* @return 'true' if set ok, 'false if can't be set (e.g. due to consistenci errors, out of range, etc.)
|
||||
*/
|
||||
public abstract boolean set(double value);
|
||||
|
||||
|
@ -363,7 +363,7 @@ public class RuleBlock extends FclObject implements Iterable<Rule>, Comparable<R
|
||||
// Not already resetted?
|
||||
if (resetted.get(var) == null) {
|
||||
// Sanity check
|
||||
if (var.getDefuzzifier() == null) throw new RuntimeException("Defuzzifier not setted for output variable '" + var.getName() + "'");
|
||||
if (var.getDefuzzifier() == null) throw new RuntimeException("Defuzzifier not set for output variable '" + var.getName() + "'");
|
||||
var.reset(true); // Reset variable
|
||||
resetted.put(var, var); // Mark it as 'resetted' so we don't reset it again
|
||||
}
|
||||
|
@ -100,7 +100,7 @@ public class Variable extends FclObject implements Comparable<Variable>, Iterabl
|
||||
|
||||
/** Estimate universe */
|
||||
public void estimateUniverse() {
|
||||
// Are universeMin and universeMax already setted? => nothing to do
|
||||
// Are universeMin and universeMax already set? => nothing to do
|
||||
if ((!Double.isNaN(universeMin)) && (!Double.isNaN(universeMax))) return;
|
||||
|
||||
// Calculate max / min on every membership function
|
||||
@ -121,7 +121,7 @@ public class Variable extends FclObject implements Comparable<Variable>, Iterabl
|
||||
else umin = umax = 0;
|
||||
}
|
||||
|
||||
// Set parameters (if not setted)
|
||||
// Set parameters (if not set)
|
||||
if (Double.isNaN(universeMin)) universeMin = umin;
|
||||
if (Double.isNaN(universeMax)) universeMax = umax;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user