Archive for the ‘source code’ tag
I’m revisiting this problem again and hoping to dig more into evolutionary computing.
The SantaFe Ants Trail is a maze of 89 food pellets, with breaks in between. The ants must find a way to pick up all of the pellets.
Each ant checks to see if there is food in front, moves forward and collects it if so, else turns left, right or moves one forward depending on its coding. The food is removed for this ant once it is collected.
The genome must be a minimum of 32 chromosomes, that’s the minimum the state machine must have to solve the maze. It’s been solved with 32 chromosomes, 200 steps, 200 generations, 65,536 starting ants.
The fitness of the ant is the number of pellets it has collected.
Each generation the top 50% of the ants mate, half the genes ( in sequence from one parent, half from the other )
I only released 2048 ants at once, I suppose with out graphics the computer would’ve handled much more but it was interesting to watch and I spotted several problems along the way while watching.
At 512 ants, my best score was 43, at 1024 best was 50.
Problems I ran into:
– If one or a few ants were far above rest they cloned the entire population and diversity was lost.
– Need a way to cull individuals too far from the center and or remove clones. I inserted random mutations rather than check for clones, sorting by genes might make it easy to id and remove clones.
ObjC iOS SantaFe Ant Trail
PDL (“Perl Data Language”) gives standard Perl the ability to compactly store and speedily manipulate the large N-dimensional data arrays which are the bread and butter of scientific computing.
PDL turns Perl in to a free, array-oriented, numerical language similar to (but, we believe, better than) such commerical packages as IDL and MatLab. One can write simple perl expressions to manipulate entire numerical arrays all at once. Simple interactive shells, pdl2 and perldl, are provided for use from the command line along with the PDL module for use in Perl scripts.
Pyevolve was developed to be a complete genetic algorithm framework written in pure python, the main objectives of Pyevolve is:
* written in pure python, to maximize the cross-platform issue;
* easy to use API, the API must be easy for end-user;
* see the evolution, the user can and must see and interact with the evolution statistics, graphs and etc;
* extensible, the API must be extensible, the user can create new representations, genetic operators like crossover, mutation and etc;
* fast, the design must be optimized for performance;
* common features, the framework must implement the most common features: selectors like roulette wheel, tournament, ranking, uniform. Scaling schemes like linear scaling, etc;
* default parameters, we must have default operators, settings, etc in all options;
* open-source, the source is for everyone, not for only one.
Yet another year, yet another dozen languages. Some times it seems as if all my time gets sapped up learning new languages. R is growing rapidly in popularity making news on Slashdot and the NYT late last year.
R provides a graphics package for visualizing your data, a data editor, data manipulation and has C/C++ interfaces. When R is open it provides a set of windows allowing you to interact with your data. The instruction manuals, tutorials, source code for Linux, OSX and Windows are available for free at the R Project site
R is also the name of a popular programming language used by a growing number of data analysts inside corporations and academia. It is becoming their lingua franca partly because data mining has entered a golden age, whether being used to set ad prices, find new drugs more quickly or fine-tune financial models. Companies as diverse as Google, Pfizer, Merck, Bank of America, the InterContinental Hotels Group and Shell use it.
But R has also quickly found a following because statisticians, engineers and scientists without computer programming skills find it easy to use.
“R is really important to the point that it’s hard to overvalue it,” said Daryl Pregibon, a research scientist at Google, which uses the software widely. “It allows statisticians to do very intricate and complicated analyses without knowing the blood and guts of computing systems.”
It is also free. R is an open-source program, and its popularity reflects a shift in the type of software used inside corporations. Open-source software is free for anyone to use and modify. I.B.M., Hewlett-Packard and Dell make billions of dollars a year selling servers that run the open-source Linux operating system, which competes with Windows from Microsoft. Most Web sites are displayed using an open-source application called Apache, and companies increasingly rely on the open-source MySQL database to store their critical information. Many people view the end results of all this technology via the Firefox Web browser, also open-source software. R, the software, finds fans in data analysts read more . . .
@RStats tips and examples
An Introduction to R
The R Project for Statistical Computing
Revolutions: How R is disrupting a billion dollar market
The iGraph Library for Complex Network Research
SPOT: An R Package for Automatic and Interactive Tuning of Optimization Algorithms by Sequential Parameter Optimization (Download SPOT)
I am finishing up my reading of ‘The Magic Machine: A Handbook of Computer Sorcery‘ and there were only two programs left to write. I thought I’d wipe the first one out in a day. Heh, it took three.
In a chapter of the book the author discusses early attempts at genetically evolving artificial life. He gives a rough algorithm and states he had all kinds of critters running around in just a few hundred generations. I loosely wrote a program based on his algorithm. 150,000+ cycles, and 36 hours on my computer later, no evolution. I don’t know how he did it? I couldn’t get the algorithm in the book to produce any interesting results.
I did today get a program that has bugs that learn to stay on and follow food lines drawn in the window. It takes about 1500 days ( cycles ) for them to achieve this universally. The source code is linked to below.
Here’s what I learned in my attempts at a very simple genetic program.
If you place food randomly there is nothing to learn. You just end up with a population of stupid bugs. Adjusting the food nutrient content worked better than adjusting the amount of food for controlling population levels and for evolution. Creating more food to meet the population just created lots of stupid bugs. ( I wonder if there is a real life lesson in that? )
If you adjust the bugs DNA when they find food, not just their energy levels they learn much faster.
I hope to do some more complex and interesting evolution programs soon.