×
Home Companies Industry Politics Money Opinion LoungeMultimedia Science Education Sports TechnologyConsumerSpecialsMint on Sunday
×

Evolving, one step @ a time

Evolving, one step @ a time
Comment E-mail Print Share
First Published: Thu, Dec 22 2011. 11 17 PM IST

Updated: Thu, Dec 22 2011. 11 17 PM IST
With the press of a button, my svelte robot began moving. I watched her roam, wondering if she would learn her lessons. Every time she bumped into a tree, I penalized her; every time she found food, I rewarded her. Would she, in time, get intelligent at finding food and avoiding trees?
A good question to ask, because at the start she was a first-rate idiot. She moved, hit trees, ate her rasmalai, period. She was just a symbol that wandered stupidly on my screen.
Indeed, my screen. This baby was a simulated robot, an “@” on my computer. She spent her life roaming among simulated trees (“T”) and simulated rasmalai (“&”). I still don’t know why I thought of her as, well, a her. But she was the product of some dabbling I did in the days I used to be an inveterate hacker, in a branch of computer science called genetic algorithms (GA).
The first major conference on GA was held in 1985. Having read some of John Holland’s work—the man who pioneered the field—I was fascinated and wanted to attend the conference. But where I worked at the time, I was bottom on the totem pole. So no conference for me. I consoled myself, I remember, by spending those days getting my @ robot up and pottering about.
But why “genetic”? Behind the @ symbol, my simulated robot was no more than a collection of simulated chromosomes, each of those a set of simulated genes. These genes spelled out the way she would behave. Some chromosomes had food-sensitive genes that reacted when she found rasmalai. Others were sensitive to tree-bumping. I programmed her so that the state of her chromosomes at any given time determined which direction she chose to move in.
But I also programmed her—and this is the crucial part—to learn things from each move. If the robot found that moving north, say, took her to rasmalai, her food-sensitive chromosomes would evolve so as to favour moving north. In contrast, if she found that moving east brought bumps, the tree-sensitive chromosomes would begin favouring other directions.
Kind of simple-minded, you think? Certainly, but this model reflects the way we are, mimicking biology, and in two ways.
One, the genes and chromosomes each of us are born with encode our own physical and other characteristics. Your genes differ from mine, and that’s why you’re shorter, brighter and a better tennis player than me.
Two, just as we learn from experience and evolve to become better at what we do, at the business of life itself, computer models based on genetic algorithms—my robot, for example —evolve to become better at doing things.
At least, that’s the theory.
To begin with, of course, my robot’s chromosomes favoured no particular direction. But then they started to evolve. Holland suggested three mechanisms for this. The first is “crossover”, in which two chromosomes exchange parts of themselves—call them gene sequences—to produce two offspring chromosomes, thus spreading individual traits around. The second is “reproduction”, when two good chromosomes are chosen as parents for a new one, thus passing on favourable traits. With a robot that searches for food, for example, only chromosomes that favour a direction in which food is found are chosen to reproduce, thus reinforcing that preference. The third is “mutation”: once in a while, a random chromosome is changed randomly. Think of this as the effect of a sudden epidemic, say, which serves to introduce what you might call fresh blood.
So is this all just one big video game? Not at all. Now considerably evolved since 1985, GAs have been used to address all kinds of knotty problems: from the layout of websites to the design of car engines. In November 2010, Scientific American listed 10 “world changing ideas…that have the power to transform our lives”. GAs were one of them.
All fine, but you want to know what happened to Ms @. So did I.
To begin with, the screen was a mess of Ts and &s, though I had consciously arranged more trees in some areas, more rasmalai in others. I placed @ somewhere in this bleak landscape and pressed a key to get her going. She picked a direction at random and moved there. She then followed the logic of her chromosomes to decide her next move. Every few steps, the chromosomes evolved using one or more of the mechanisms above.
@ the robot began by wandering about without any method. But after a while, with much tweaking and experimenting, she became better at avoiding trees, at finding food.
Well, I think she became better. You might say, she showed some intelligence in her movements.
So I switched off my computer. From a symbol on my screen, there’s only so much intelligence I’m prepared to take. Also, I’m better at tennis than you.
Once a computer scientist, Dilip D’Souza now lives in Mumbai and writes for his dinners. A Matter of Numbers will explore the joy of mathematics, with occasional forays into other sciences. Comments are welcome at dilip@livemint.com
Comment E-mail Print Share
First Published: Thu, Dec 22 2011. 11 17 PM IST