Spark! Fuzzy Logic Editor Help


Variables | Sets | Rules | API | Integration | Tutorial


get_cog_output()

Gets the Center of Gravity output value.

float get_cog_output()

Parameters

none

Return Value

The value for the center of gravity of the output variable.

If no rules are active FLT_MIN is returned.  This is the minimum positive value a 'float' datatype can hold (usually 1.175494351e-38F).  This was selected as a "special value" to indicate that no rules are active for the model.

Remarks

COG output is used when you want a specific (defuzzified) value as output from the system.  If you're more interested in a Fuzzy State Machines (FuSMs) see the get_mom_output() method.  In FuSMs you are concerned with finding which action to take ("run away", "fight", "hide") rather than a specific "defuzzified" value.

Example

void print_output_vals(SparkModel* model)
{
	float cog_output = model->get_cog_output();

	cout << "COG Output value is: ";
	cout << cog_output << endl;

} // end print_output_vals()