Learning and Adapting


Note:
This section uses ideas and techniques developed at length in the CD-ROM "How God Makes God"
The Joe object, which was created in the last section, can be primed to respond and react to all kinds of situations. It is simply a matter of providing suitable data for Joe to be able to access, then feeding this information into his emotive decision making mechanism.

A Joe object can also be designed to incorporate a logical decision making mechanism (covered in the logical thinking networks section), to give Joe a dual system which will take into consideration both logical and emotive aspects of a problem (this will be covered in the extension of this project ).

Conventional artificial intelligence techniques can readily be applied to this combined dual control system. By linking to suitable data bases, Joe's brain can be arranged to access all kinds of rule based systems to feed into his 'brain', allowing Joe to act from "experience".

Similarly, Joe can create his own 'experience' as a result of information he gathers for himself by updating relational data bases during his activities and involvements.

However, these kinds of techniques alone produce robotic objects whose behavior is more or less predictable; they will faithfully carry out the algorithms designed by their creators. The Joe object we have here is capable of much more.

The real power of Joe type objects is when you design them for learning and adapting in completely new situations; where there is no appropriate information available to program into their data banks. These Joe objects will be able to go into situations where they have to start from scratch and learn everything for themselves.

These are the situations where Joe objects have to devise their own strategies to be able to work in rapidly changing or competitive environments, or, where they might have to cooperate with each other to achieve goals.

The Joe object we have here has the potential of not only living up to a designer's expectations but going far beyond them to realize achievements which the designer could not even have imagined possible and in ways which the designer could not have foreseen.

This takes us into the area of genetic algorithms.

The magic and power of genetic algorithms

The simplicity of the structure and operation of a genetic algorithm is deceptive - these mathematical mechanisms are incredibly powerful devices.

Despite their extreme simplicity, these amazing phenomena have caused lifeless inorganic chemicals to evolve into every kind of life form, including even that of man. Every part of the human form, even the brain and including emotions, are a direct result of the mathematical consequences of genetic algorithms.

Working models, explaining these genetic algorithms, are featured in the CD-ROM "How God Makes God". A brief summary follows here:

The essence, of what they are about, is the solving of very complex problems involving large numbers of independent variables. For example, to program Joe's brain with a set of emotions which allow him to make an emotive decision involves setting optimum values for every possible combination of each option and the influencing factors involved.

Even the very simple example used (showing object Joe waking up and having to make a decision, involving five options with five variable factors) needed twenty five different values to be calculated for his "emotional responses".

We fudged the issue there by just adding in some arbitrary values for the "emotional responses" based upon a "common sense" view. The trick though, is to get Joe to work out these values for himself.

To understand the difficulty Joe has in trying to set up his own emotional values, consider the following "ten dice" problem from HGMG (Fig 20/27 ).

In this problem you have to keep rolling ten dice. At each roll, the computer will tell you the sum of the dice faces. By repeatedly rolling the dice you have to try to work out the value for a letter for every one of the different 60 dice faces.

It is a seemingly impossible problem to solve. Ten dice are rolled. The faces are marked with letters from A to F to correspond with the numbers 1 to 6, but, each die is coded differently (e.g. A might be equal to 1 on dice number 1 but equal to 3 on die number 2 and equal to 5 on die number 3... etc.).

Figure 20/27 An impossible game for the human mind

Eight consecutive rolls of the ten dice might produce the totals: 32, 24, 27, 48, 17, 51, 30 and 41. From these numbers (plus any number of further rolls) you have to work out the value of each of the six letters for each of the ten dice.

To get your mind round the extent of this problem, consider the information you will have if the sum of the ten dice shown in figure 20/27 returned a total value of 10 instead of 16.

In this special case, you would know that each of the faces shown would be equal to one (for die number 1, B = 1; for die number 2, B = 1; for die number 3, C = 1; for die number 4, E = 1... etc).

Of course, even with such a lucky throw, you still wouldn't have any idea of the values of the other letters on each of the dice. As for getting the resulting sum of 16 instead of 10, you have practically no clues whatsoever about any of the values of the dice faces.

There are about 60 million (factorial ten) different possible combinations. It is quite impossible for the human mind to solve this kind of problem, yet, a genetic algorithm, using nothing more than a few simple list manipulations can solve the problem quite easily and come up with the answer in seconds.

Now here is the mind boggling significance of all this genetic algorithm stuff. If those ten dice represent ten emotional responses in Joe's memory, a genetic algorithm incorporated in the object Joe will optimize Joe's emotional responses for making decisions.

In other words, you needn't have to set any values for Joe's emotions (they could start off as random numbers): Joe could, with the aid of a genetic algorithm, be able to program himself.

Do you get the idea?.

The basic principle of the genetic algorithm is illustrated in HGMG by using a series of virtual objects which are represented by lists of 10 emotional values - initially decided by throwing a series of ten dice.

These virtual objects are mated and allowed to breed offspring.

Figure 20/28 shows how these virtual objects breed. Their lists are split at the same point and then recombined into new copies of the parts to produce offspring.

Figure 20/28 The mating and crossover mechanism of genetic algorithms

Breeding pairs are selected according to how well they cope in a given situation: only the best from a population being allowed to breed.

A typical population of objects (lists) which are ready for breeding are shown in fig 20/29. They have each been given a value according to how closely their emotional value combination comes to being the ideal combination for the particular situation they are competing in (the lower this number the better - with zero indicating that the combination of values is optimum for the environment). The lowest result numbers are selected for breeding (15 and 16 in this example).

Figure 20/29 A population of emotional patterns

The best pair, or pairs, then reproduce a new population of offspring which are all variations of those selected 'best' individuals.

The following generation should then result in some of the new population being closer still to perfection and then these too will be selected for breeding. As more and more generations are produced the population becomes closer and closer to perfection and the ten values become closer and closer to the optimum combination.

A simple method of scoring each list against a value perfect for the right environment (or set of options) is shown in fig 20/30.

Figure 20/30 How the offspring get selected for breeding

To see the significance of this, think about a population of Joes which are breeding lists to evolve the best list of emotions which will cause them to make optimum decisions to obtain a specific goal in a particular changing or competitive environment.

The key, to the successful operation of the genetic algorithm, is that chance is used not only to split the lists randomly at breeding time, but, also to introduce random changes into a few of the offspring.

Every now and again, as an offspring is being constructed with the bits copied from its parents, a random error is introduced. Instead of using a "2" for example, a random number will be inserted instead (this is known as mutation in biology).

Most times, the random insertions will either make no difference, or, will give the offspring a disadvantage (i. e. give Joe a wrong emotional bias so that he makes a bad decision in some situation). Just occasionally though, that insertion may give the offspring a little bit of extra advantage or accuracy: enough to allow it to edge in front of the others and be chosen for breeding. This is the equivalent of Joe learning, through a mistake, a better way to do something).

The important point to realize is that if such a random mutation is beneficial in any way the offspring is chosen for breeding. This will result in the error, or mutation, being passed on to the next generation (retaining it in the gene pool).

The significance of emotional programming

Your first thoughts might be that emotional programming is an interesting novelty, but, you have no use for it in multi media productions. If this is your view I urge you to think again and start constructing a few simple models to get them to "learn" how to do simple tasks. Put several at work together and try working out ways to give them emotions which would cause them to cooperate with each other. Before long you will be using them ubiquitously in all kinds of situations which you had never before were aware existed..

Just like OOPS, it is not at all technically difficult - it is just a question of clicking into the right mind set. Actively using intelligent objects is the only way you can learn how to use them.

Sending Joe out onto the Internet

You will no doubt find many applications for intelligent and brainy Joes, but, Joe's best environment is the Internet.

To turn Joe into a bot or a Web buggy (a software robot that travels around the World Wide Web and the Internet) is extremely simple. First create a button called "Turn Joe into a bot". Then use the mouseUp script shown in fig 20/31. All you'll need to do then is to attach a "bot engine" to your Director movie and Joe will instantly become an intelligent, brainy bot (see the section on Web buggies).



Figure 20/31 Turning Joe into a bot



[Index]
[Next - Combining logic and emotion]
[Back - Emotive Decisions (4)]


Peter Small August 1996

Email:
peter@genps.demon.co.uk

Version 1.00

© Copyright 1996 Peter Small
No reproduction in whole or part without prior permission