EarthWeb   
HomeAccount InfoLoginSearchMy ITKnowledgeFAQSitemapContact Us
     

   
  All ITKnowledge
  Source Code

  Search Tips
  Advanced Search
   
  

  

[an error occurred while processing this directive]
Previous Table of Contents Next


7.2.2 Fitness Function

Once an encoding scheme has been declared, the remaining task is to define a fitness function that will drive the GA to high-quality solutions. In Chapter 6 we presented a fitness function used to develop high-quality membership functions in a liquid level controller. In that instance, the objective function was meant to provide high fitness values to controllers that drove the liquid level to a predefined setpoint in the least amount of time possible. The goal of the cart-pole controller is to drive the cart to the center of the track (while keeping the pole balanced) in the shortest time possible. Thus, the fitness function for the selection of rules in the cart-pole system is:

where tmax is the amount of time for which all cart-pole simulations are to be run and M is a pre-defined number of initial condition cases (we used four initial condition cases selected from extremes of the state space, i.e., x = NEGATIVE BIG, = NEGATIVE, θ = NEGATIVE, and = NEGATIVE), xdesired and θdesired are the setpoints for x and θ, respectively, and w1 and w2 are weighting values. The weighting values are necessary because the values of x are generally an order of magnitude larger than the values of θ. For the pole angle to be considered as important as the cart position, w2 must be an order of magnitude larger than w1.

An important point about the fitness function above is that fit individuals have low scores. In our previous discussions of genetic algorithms, we declared fitness to be a value that was to be maximized because of the reproduction operator being used. There are reproduction operators that can be used in situations such as the one above in which the fitness function actually represents a form of error that is to be minimized (Goldberg, 1989). One such operator is the tournament selection operator. The operator is implemented as follows. A subset of the strings in the current generation, say p strings, is selected for a tournament competition. The fitness values of these p strings are compared, the top performer is placed in the mating pool (which serves as a temporary file) where they await the operation of crossover. In a maximization problem, the top performer is the string with the largest fitness function value; in a minimization problem, the top performer is the string with the smallest fitness function value. These tournaments are continued until the mating pool is full, i.e., until popsize tournaments have been conducted. Thus, with the use of the tournament selection operator, the fitness function can just as easily be a value that is to be minimized.

7.2.3 Results

The coding scheme and fitness function defined above was used to guide a GA search for the actions associated with a rule set employed by a fuzzy controller for the cart-pole system. The GA efficiently considered the possible solutions and rapidly converged to a set of actions for a rule set equivalent to the one presented in Chapter 3. Recall that the rule set presented in Chapter 3 required approximately four man-months to develop. The GA’s search was conducted overnight on a 486-based personal computer. Naturally, there was some overhead associated with the computer programming required to implement the GA’s search, but it was on the order of a single day. Thus, a GA can be used to determine effective rule actions for fuzzy systems. The time necessary for determining effective rules can be reduced dramatically without a decrease in the effectiveness of the fuzzy system.

In the next section, the problem of rule selection for the cart-pole system is made more difficult through the inclusion of additional linguistic terms. As a consequence of increasing the number of linguistic terms available for describing the force, a new and more efficient coding scheme is used. The GA proves to be equally effective in the more complex system.

7.3 An Expanded Rule Set and a New Approach to Coding

The precision of a controller can be limited when we describe the possible actions with a finite number of linguistic terms. This is why we introduced the real-valued consequent approach in Chapter 4. However, since so many fuzzy systems have adopted the “traditional approach,” we will consider it further here. In the previous section, we addressed the cart-pole problem as described in Chapter 3 where the action associated with each rule was to be one of seven choices. One approach to achieving more precise control of a system is to increase the number of linguistic terms from which the actions can be chosen. However, when the number of action choices is increased, selecting the rule set becomes more difficult simply because there are more distinctions to be made.

Previously (Chapter 3 and section 7.2) we defined membership functions representing seven linguistic values of force applied to the cart. Here, we examine the ramifications of increasing this number from seven to nine. Consider the membership functions for force shown in Figure 7.3 in which the following nine linguistic terms are defined: (1) NEGATIVE VERY BIG, (2) NEGATIVE BIG, (3) NEGATIVE MEDIUM, (4) NEGATIVE SMALL, (5) NEAR ZERO, (6) POSITIVE SMALL, (7) POSITIVE MEDIUM, (8) POSITIVE BIG, and (9) POSITIVE VERY BIG. Notice in the figure that the limits of force have not been extended, so that the nine membership functions shown cover the same range of force values as the seven membership functions shown in Figure 7.2. Thus, the meaning of the linguistic terms have changed somewhat.


Figure 7.3  With the availability of the nine linguistic terms for describing a value of force, more effective controllers are possible. However, the problem of rule selection becomes more difficult since there are now 1089 or approximately 2*1018 possible rule actions to be considered.


Previous Table of Contents Next

Copyright © CRC Press LLC

HomeAccount InfoSubscribeLoginSearchMy ITKnowledgeFAQSitemapContact Us
Products |  Contact Us |  About Us |  Privacy  |  Ad Info  |  Home

Use of this site is subject to certain Terms & Conditions, Copyright © 1996-2000 EarthWeb Inc. All rights reserved. Reproduction in whole or in part in any form or medium without express written permission of EarthWeb is prohibited. Read EarthWeb's privacy statement.