Entries Tagged as 'source code'
I’ve covered a fair bit of simulations of people in news stories and recently read a chapter on people simulations in ‘ The Magic Machine: A Handbook of Computer Sorcery
‘ and thought it was time to try a simple simulation.
This source code simulates 3 groups at a party. One group has a personal comfort zone of 1 foot, one group a zone of two feet and one a zone of three feet. Each group is a different color. The people start in random locations. As the party progresses and people move about they try to keep other people at their personal comfort zone. Each person moves to the square nearest himself that maximizes the comfort zone for himself. If that is not possible the person moves to a random spot ( mingles ).
If you deduct happiness from a person when they are crowded or lonely they move more than if no happiness points are deducted. They mingle more, deducting no points the crowd is more likely to form groups.
The code is heavily commented and should be easy to follow, source code is in Java.
party.tar.gz
Tags: source code
Synthetic psychology is a field where biological behavior is synthesized rather than analyzed. The father of such behavior Valentino Braitenberg ( home page ) did some interesting work with toy vehicles in the 1986 book “Vehicles: Experiments in Synthetic Psychology
“.
The Braitenberg vehicles were simple toy cars with light sensors as headlights. In some cars the wire for each headlight went to the real wheel directly behind it, in some the wires went to the opposite back wheel. The headlight receptors were aimed slightly off to the outside. The more light received by a receptor the faster the wheel wired to that receptor would turn.
Each vehicle exhibited realistic behavior when placed in a plane with several randomly placed light sources. A vehicle wired straight back when placed near a light source will then rush towards the light veering off as it gets closer to the light. As it gets more distant from the light sources the vehicle slows down. The reason is the wheel receiving the most light spins fastest turning the car away from the light source.
The vehicle with the crossed wires will turn and drive towards the brightest light in its field of view. The closer it gets, the faster it goes eventually running into the light.
Pretty interesting behavior from a very simple machine. But what if we add in a neurode to each wire and instead of a plain wire we use a wire that inhibits signals? Neurodes are set to only fire if they receive signals over a certain threshold. In this case zero is to be our threshold. So now our cars send signals to the wheels if there is no light, and do not send a signal if there is a light. Now the vehicle with the wires straight back moves toward a light and slows as it approaches, facing the light. The second vehicle now avoids light sources, speeding off to the darkest corner it can find.
So what has this all to do with current artificial intelligence? Some of our best stuff right now came from earlier work that was done and stopped. Some of our best mathematical algorithms come from extremely early math. And to remind you ( and me ) that simple rules can create very complex behavior in game characters and artificial life forms.
Four neurode versions of these vehicles have been built and they will exhibit more complex, non-linear behavior. “The question of whether a computer can think is no more interesting than the question of whether a submarine can swim.” (Edsger Dijkstra) At what point does the behavior become realist enough to be considered a life form?
Source Code:
Java simulation of Braitenberg Vehicles
More information:
Braitenberg Vehicles ( Java and Lisp simulators here )
Another simulation and pseudocode code here
Papers:
Robotics as an educational tool ( CiteSeer )
Swarm modelling. The use of Swarm Intelligence to generate architectural form. ( pdf)
Tags: source code · topics in artificial intelligence
In Wolfram’s book “A New Kind of Science
” he studies cellular automata. What is also interesting is the approach he is taking. Rather than take something we know and try to figure out the rules, he tries different rules to see what they will create. While his book was badly received when it came out, other’s have found great success using this approach recently.
Wolfram was hardly the first to use cellular automata to mimick real life. Martin Gerhardt and Heike Schuster created ‘HodgePodge’ a cellular automata to mimic a chemical reaction. They explained it as using a discrete form of a differential equation. Since we have described most natural phenomena with differential equations that may explain why we have not done more with cellular automata. We just haven’t needed it. We may find use for it in things we can not yet easily describe with differential equations.
For example, cellular automata has found success in artificial intelligence in solving echohydraulics modeling problems. Cellular automata is also being used in pattern recognition, image processing, fluid mechanics and bioinformatics.
Cellular automata is simple rules repeated over and over. While one would expect simple patterns to emerge and repetitive patterns to emerge, non-repetitive and complex patterns also emerge in some cases. The two examples shown use only two colors and simple rules. Three colors leads to many more complex designs.
Nested: If either neighbor but not both neighbors in previous row are black-> color this cell black else color it white.

Irregular: If self and right neighbor in previous row are white then self is same color as left neighbor in previous row. If self and right neighbor are not both white then self is opposite color of left neighbor in previous row.

Source code:
Java automata examples
More information:
CelLab, Cellular Automata Laboratory
A New Kind of Science ( book is available online and free)
Some of the recent controversy about Wolfram’s book
Fractal Geometry
Cellular Automata Links
An Introduction to Lindenman Systems ( related subject )
The Primordial Soup Kitchen
Tags: source code · topics in artificial intelligence