Below is a sample of what some typical 'C'
code might look like to implement a small set of fuzzy logic rules:
if ((facing == LFT)
&& (position == SRP_LFT)) then
angle = SRP_RT;
if ((facing == LFT)
&& (position == SLO_LFT)) then
angle = SLO_RT;
if ((facing ==
LFT)
&& ((position == SLO_LFT)
|| (position = STRT))) then
angle = STRT;
if ((facing == LFT)
&& (position == SRP_RT)) then
angle = SLO_LFT;
As you can see, the code can be confusing and
error prone. As a matter of fact there is one "bug" in
the code above... not counting potential rule errors!
Where's the "bug"? See the bottom of this page for
the answer.
Fuzzy
Logic With Spreadsheets
Spreadsheet style interfaces are often used to create
and modify fuzzy logic rules. These can be confusing and
error prone - if you want to change all the rules involving a term in
the first variable you need to jump around to change all of them.
Here's what a typical spreadsheet interface may look like:
With only 15 rules it's fairly manageable... when the number of
rules increase - which they do quickly due to combinatorial
explosion - creating and modifying rules can become a dreaded
chore.