defuzzifyMaxAv method

double defuzzifyMaxAv()

Defuzzifies the FLV using the "Average of Maxima" (MaxAv) method.

Implementation

double defuzzifyMaxAv() {
	// the average of maxima (MaxAv for short) defuzzification method scales the
	// representative value of each fuzzy set by its DOM and takes the average
	final fuzzySets = this.fuzzySets;

	double bottom = 0;
	double top = 0;

	for ( int i = 0, l = fuzzySets.length; i < l; i ++ ) {
		final fuzzySet = fuzzySets[ i ];

		bottom += fuzzySet.degreeOfMembership;
		top += fuzzySet.representativeValue * fuzzySet.degreeOfMembership;
	}

	return ( bottom == 0 ) ? 0 : ( top / bottom );
}