Module: Defuzz

Included in:
Function
Defined in:
lib/rfuzzy/defuzz.rb

Constant Summary collapse

DEFUZZ_METHODS =
{
	:lom => :least_of_maximum,
	:mom => :middle_of_maximum,
	:bom => :biggest_of_maximum,
	:aom => :average_of_maximum,
	:cog => :center_of_gravity
}
@@defuzz_method =
nil

Class Method Summary collapse

Class Method Details

.defuzz_method(m) ⇒ Object

Sets the method for defuzzification. Avalaible norms are defined in DEFUZZ_METHODS



13
14
15
16
17
18
19
20
21
22
23
# File 'lib/rfuzzy/defuzz.rb', line 13

def Defuzz.defuzz_method(m)
	if DEFUZZ_METHODS.has_key?(m)
		@@defuzz_method = m
	else
		sm = ""
		DEFUZZ_METHODS.each_key do |k|
			sm << "#{k} "
		end
		raise ArgumentError, "defuzzification method #{m} is not supported\nSupported methods: #{sm}"
	end
end