Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Genetic Programming
#1
I'm working on a gp program and was wondering if any of you had already done some stuff (in QB) that I could look at.

Thanks.
Reply
#2
gp = life sim?
Reply
#3
Quote:gp = life sim?
I guess I can take that as a "no." Joking.

Anyway, just to add some more confusion, I've heard more than one thing refered to as life sims. Genetic programming is *not* the thing where you have a screen of pixels that change on or off depending on the ones next to them.

It's a process by which the program can learn to achieve a goal by simulating randoming algorthims, taking the most successful, combining them to produce new ones (hence "genetic"), and repeating a few gazillion times. Pretty cool.

Like I said, I was just wondering if anyone had done any of this in QBasic.
Reply
#4
No. I was considering something (I think) like that for the bot in Empyrean... where there would be several 'modes', like agressive, defensive, greedy, trigger happy, etc, and the bot would assess the effectiveness of each mode in a particular battle and use them accordingly.

As it is, I'm not doing it that way, but I'd never attempt that without some inheritence and pointers...
Reply
#5
Yes.

My qb code for evolving "simple poker" players is full of bugs and really sux (nevertheless, it gives some good resultz), but you can check it out here:

http://www.geocities.com/pisforpi/poker.zip

The (interpreted) program size isn't variable but the effective execution size is. Read the readme.

Output to C:\finorg.txt and C:\iniorg.txt...
Peace cannot be obtained without war. Why? If there is already peace, it is unnecessary for war. If there is no peace, there is already war."

Visit www.neobasic.net to see rubbish in all its finest.
Reply
#6
Processing the first generation 2.1% complete? ALREADY? Smile
Peace cannot be obtained without war. Why? If there is already peace, it is unnecessary for war. If there is no peace, there is already war."

Visit www.neobasic.net to see rubbish in all its finest.
Reply
#7
Can I be a lil bit medical here?

Well a life sim would involve Offsprings right? So if you want to "genetically" pass traits, you should learn how each genes (in Chromosomes) behave on a DIPLOID(Sexual) cells.

A proccess I've been using and teaching is called the "Punnet Square". Try to Google search it. Its very easy to implement into code.
y smiley is 24 bit.
[Image: anya2.jpg]

Genso's Junkyard:
http://rel.betterwebber.com/
Reply
#8
Yes, mine is similar.

Except that recessive and dominant genes are determined by score, of course.

The latest version (in LISP) takes two random organisms from the whole population. Then it goes through all the genes of said organisms, and creates a number for each organism. The organism with the highest number duplicates the bit in the other organism.

The number is determined by (.75 + INT(RND * .25)) * the score of the individual in the latest version.

In all versions, new generations of organisms are not created but merely old ones changed. It keeps a lot of the old population, keeping the ecosystem stead, and increases chances of a good result. It's also more memory efficient.

I plan to add another feature which will add recessive and dominant genes. Who gets which genes will still not be determined by recessiveness, but the actual program will be dependant on it.

The way I will do it is instead of having one bitstring for the organism, I will have three or five. The zero or one with the most count will be the one used. This will have to be compressed to a new bitstring for running the simulation to avoid recounting.
Peace cannot be obtained without war. Why? If there is already peace, it is unnecessary for war. If there is no peace, there is already war."

Visit www.neobasic.net to see rubbish in all its finest.
Reply
#9
Thanks for the replies - just another quick question:

In the program I'm working on, the organisms compete against one another and pass on the most effective AI scripts. In theory, this should develope a kick-butt AI script, but I'm not very far with the program.

I've run into a problem: after a while, the organisms work themselves into a corner and can't backtrack to find a better solution. They get stuck. How can I fix this?

Thanks in advance.
Reply
#10
Code:
I've run into a problem: after a while, the organisms work themselves into a corner and can't backtrack to find a better solution. They get stuck. How can I fix this?

The triple bitstring and the way that I evolved and the organisms help in this: they make the transition slower yet less random. (as in, do not just throw away the worst 50%!)

There are two other ways. You can either increase the amount of organisms (this won't work if you just keep evolving from a small subsection of your population, it WILL get stuck) or you can make the programs more or less complex by introducing some other sort of redundancy.

For example, in another program that I have in my site somewhere, the task is to convert a certain amount of M money into N coins. The evolved genetic algorithm has a list of coins to swap: 25 to 5 5's, 10 to 10 1's, etc. The list is read and the swaps are made if it brings you closer to the goal..

anyways, if one good swap is accidentally mutated, it evolves redundant (identical) swaps, so all is good.
Peace cannot be obtained without war. Why? If there is already peace, it is unnecessary for war. If there is no peace, there is already war."

Visit www.neobasic.net to see rubbish in all its finest.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)