Herself's Artificial Intelligence

Humans, meet your replacements.

Archive for the ‘source code’ tag

SantaFe Ant Trail

without comments

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.

Source code:
ObjC iOS SantaFe Ant Trail

More info:
Wiki SantaFe Ant Trail
Solving the Artificial Ant on the Santa Fe Trail Problem in 20,696 Fitness Evaluations

See also:
Evolutionary AI

News:
Artificial Intelligence: Riders on a Swarm

Written by Linda MacPhee-Cobb

May 29th, 2014 at 5:00 am

Posted in evolution

Tagged with

PERL Data Language Scientific Computing with PERL

without comments

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.

PDL

Written by Linda MacPhee-Cobb

February 6th, 2012 at 6:15 pm

Pyevolve Open Source Python Genetic Algorithm Code

without comments

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.

More information:
Blog for Pyevolve
Documentation and downloads
GA Based Sorting using Pyevolve
MIT OpenCourseWare – Intro to Computer Science with Python

Written by Linda MacPhee-Cobb

December 30th, 2009 at 2:35 pm

Yet another computing language, R the language of statistics

without comments

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 . . .

See also:
@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)

Written by Linda MacPhee-Cobb

January 27th, 2009 at 5:00 am

Simple artificial life program source code

without comments

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.

Source Code:
Bugs.java

See also
Evolutionary AI for more information and several useful links and papers to get you started.
SantaFe Ants

Written by Linda MacPhee-Cobb

February 27th, 2008 at 5:00 am

Posted in game ai,source code

Tagged with