|
WORCESTER POLYTECHNIC INSTITUTE CS4341 ❏ Artificial Intelligence ❏ A'06
Mon, Tue, Thu, Fri - noon - AK 233 Version: Tue Oct 3 19:24:32 EDT 2006 PROJECT 3 - A Genetic Algorithm Learning SystemOverview:The task is to write a simple Genetic Algorithm (GA) learning system that will take rules as input and will improve them. That is, the set of rules that result from GA processing should produce "better" results than the original rules. This requires some procedure for evaluating the quality of the result produced by a set of rules. This evaluation procedure is used to help guide the learning, causing rule sets which produce better results to be favored. Demonstrate that the GA works by using a given set of rules as input.Inspiration:
"Kismet's facial expressions are generated using an interpolation-based technique over a three dimensional space. The three dimensions correspond to arousal, valence, and stance. These same three attributes are used to affectively assess the myriad of environmental and internal factors that contribute to Kismet's "emotional" state. We call the space defined by the [A, V, S] trio the affect space. The current affective state occupies a single point in this space at a time. As the robot's affective state changes, this point moves about within this space. Note that this space not only maps to emotional states (i.e., anger, fear, sadness, etc.) but also to the level of arousal as well (i.e., excitement and fatigue)." The Project:The goal of this project is to use a genetic algorithm to produce a high performance set of rules. For this project a set of rules is used to generate a configuration of movable "body parts", constituting a facial expression for Kismet, intended to correspond to a given emotional state. The four parts are ears, brows, lips, and jaw. Emotional states include, for example, tired, fear and joy. The best rule set produced, after using the GA as a sophisticated parallel search, will produce a configuration of part positions that correctly conveys every emotional state. A GA works on a population of candidate solutions (See Winston text Chapter 25). For this project an individual in the population is a rule set (i.e., a small set of IF-THEN rules). In each step of the GA activity new rule sets will be generated from the existing ones by crossover and mutation. Based on evaluations of quality, a fixed number of sets will be selected for survival through to the next generation. The process repeats itself from one generation to another until one or more rule sets with acceptable performance are generated. The relevant possible positions of the four movable parts are as follows:
The working memory (WM) which can describe the current state of the face has the following format: ((State value-1) (Ears value-2) (Brows value-3) (Lips value-4) (Jaw value-5))where "State" is the emotional state and the other slots in the WM represent the positions of the corresponding parts. Value-1 can be one of {Tired, Content, Unhappy, Joy, Fear}, while value-2 to value-5 can each be one of {0, 1, 2}. The available predicates are (Tired?), (Content?), (Unhappy?), (Joy?), and (Fear?). Each tests the value of the State slot. So, for example, (Tired?) returns True if value-1 is "Tired", and False otherwise. The available actions are (Ears-are x), (Brows-are x), (Lips-are x), (Jaw-is x), where x is a value from {0, 1, 2}, and the result of each action is that the corresponding slot is set to the new value. So, for example, (Ears-are 2) sets the value 2 in the Ears slot in the WM. Based on these definitions, the five generic rules which determine body part positions in response to an emotional state are: (IF (Tired?) THEN ((Ears-are a)(Brows-are b)(Lips-are c)(Jaw-is d)) ) (IF (Content?) THEN ((Ears-are f)(Brows-are g)(Lips-are h)(Jaw-is i)) ) (IF (Unhappy?) THEN ((Ears-are k)(Brows-are l)(Lips-are m)(Jaw-is n)) ) (IF (Joy?) THEN ((Ears-are p)(Brows-are q)(Lips-are r)(Jaw-is s)) ) (IF (Fear?) THEN ((Ears-are u)(Brows-are v)(Lips-are w)(Jaw-is x)) ) Every rule set follows that general pattern. In an actual rule set the attribute values (e.g., q) are one of {0, 1, 2}. So, for example, a sample rule set might be: (IF (Tired?) THEN ((Ears-are 0)(Brows-are 1)(Lips-are 2)(Jaw-is 1)) ) (IF (Content?) THEN ((Ears-are 2)(Brows-are 0)(Lips-are 1)(Jaw-is 0)) ) (IF (Unhappy?) THEN ((Ears-are 1)(Brows-are 2)(Lips-are 0)(Jaw-is 2)) ) (IF (Joy?) THEN ((Ears-are 0)(Brows-are 1)(Lips-are 2)(Jaw-is 1)) ) (IF (Fear?) THEN ((Ears-are 2)(Brows-are 0)(Lips-are 1)(Jaw-is 0)) ) Your program must use the GA principles described in Chapter 25 of Winston's AI textbook. The genetic algorithm performs two types of transformations to rule sets -- mutation and crossover.
Follow the general process shown in the text on page 524. The program should start with one rule set. That set is acted on by mutation (and crossover which does nothing) to form a second set. In each additional step you are supposed to generate, by using mutation and also crossover on the current generation, all possible new rule sets. Discard any duplicate rule sets that were already generated by this transformation process. Note that you apply a single mutation transformation to each member of the current population, to produce new rule sets. You also do crossovers between all possible pairs of the current rule sets, to produce new rule sets. The initial rule set in your population is the one where all attribute values are set to 1. That is: (IF (Tired?) THEN ((Ears-are 1)(Brows-are 1)(Lips-are 1)(Jaw-is 1)) ) (IF (Content?) THEN ((Ears-are 1)(Brows-are 1)(Lips-are 1)(Jaw-is 1)) ) (IF (Unhappy?) THEN ((Ears-are 1)(Brows-are 1)(Lips-are 1)(Jaw-is 1)) ) (IF (Joy?) THEN ((Ears-are 1)(Brows-are 1)(Lips-are 1)(Jaw-is 1)) ) (IF (Fear?) THEN ((Ears-are 1)(Brows-are 1)(Lips-are 1)(Jaw-is 1)) ) Evaluation of the quality of a facial expression would normally be done by a human. In this project we cheat (to drastically reduce run time) and simulate a human with a table of acceptable values. Each row in the table represents an acceptable resulting working memory given an initial State setting. Your fitness function will use this table.
(Note that in this project you do not need to use the Rule Interpreter to determine the settings of the working memory for each rule set in the population, as the rules themselves provide that information. In general, of course, for rule set improvement systems this isn't true. Usually the rule set needs to be actually executed by the RI with an initial WM, and the resulting WM evaluated to determine what quality of solution that set produced. If the attribute values were not directly visible in the rules then you'd need to set State to Tired in the WM, then run the rules, and repeat that for each additional emotional state.) To determine the quality of a rule set, using the table, you must devise a measure which determines how well the rules produce values that a human would find acceptable. Only four rule sets should survive into the next generation. In order to select these four sets you need to use the rank-space method (p. 520) based on quality rank and diversity rank.
Select the highest quality rule set to be the first to include in your next generation population. Compute the diversity rank of each set relative to the one selected. Select the next by combined rank. To select the third and fourth sets of rules compute the diversity rank relatively to the sets which already have been selected. You should break rank-sum ties by choosing the rule set with better diversity. In each case calculate the fitness and store it with the rules set in the new population. The fitness (probability) usually influence which rules sets take part in crossovers. Or, for this problem, you can try all of them, given that there are only four members in the population. As in the book, use p=0.66. The next fitness value will be 0.66 of the .33 that remains, and so on, for all four selections. The algorithm should stop after producing an acceptable rule set. In case no such set is produced, the algorithm should stop after a specified number of generations. You can determine that value by experimentation. Your program must produce an output file containing, in a condensed form, a record of the the rule sets selected in each generation with their corresponding quality measure, and quality and diversity ranks. A condensed rule set representation could be:
Submit
You must submit:
How to submit:
|