Fuzzy Logic Toolbox    

The Non-Fuzzy Approach

Let's start with the simplest possible relationship. Suppose that the tip always equals 15% of the total bill.

This doesn't really take into account the quality of the service, so we need to add a new term to the equation. Since service is rated on a scale of 0 to 10, we might have the tip go linearly from 5% if the service is bad to 25% if the service is excellent. Now our relation looks like this.

So far so good. The formula does what we want it to do, and it's pretty straightforward. However, we may want the tip to reflect the quality of the food as well. This extension of the problem is defined as follows.

The Extended Tipping Problem.   Given two sets of numbers between 0 and 10 (where 10 is excellent) that respectively represent the quality of the service and the quality of the food at a restaurant, what should the tip be?

Let's see how the formula will be affected now that we've added another variable. Suppose we try

In this case, the results look pretty, but when you look at them closely, they don't seem quite right. Suppose you want the service to be a more important factor than the food quality. Let's say that the service will account for 80% of the overall tipping "grade" and the food will make up the other 20%. Try

The response is still somehow too uniformly linear. Suppose you want more of a flat response in the middle, i.e., you want to give a 15% tip in general, and will depart from this plateau only if the service is exceptionally good or bad. This, in turn, means that those nice linear mappings no longer apply. We can still salvage things by using a piecewise linear construction. Let's return to the one-dimensional problem of just considering the service. You can string together a simple conditional statement using breakpoints like this.

The plot looks like this.

If we extend this to two dimensions, where we take food into account again, something like this results.

Wow! The plot looks good, but the function is surprisingly complicated. It was a little tricky to code this correctly, and it's definitely not easy to modify this code in the future. Moreover, it's even less apparent how the algorithm works to someone who didn't witness the original design process.


  An Introductory Example: Fuzzy vs. Non-Fuzzy The Fuzzy Approach