Jump to content
Science Forums

Recommended Posts

Posted

A brief description taken from a paper...

 

"Genetic Algorithm (GA) transforms a population (set) of individual objects, each with an associated fitness value, into a new generation of the population using the Darwinian principle of reproduction and survival of the fittest and analogs of naturally occuring genetic operations such as crossover (sexual recombination) and mutation."

 

..."Each individual in the population represents a possible solution to a given problem."

Posted

This definition is little clearer...

 

"Genetic Algorithms (GA) are numerical optimisation algorithms inspired by both natural selection and natural genetics." taken from "An Introduction to Genetic Algorithms for Scientists and Engineers" -Author David Coley

Posted

:steering: people that know the language say its wicked cool, and different...

I'd really like to discuss the genetic algorithms, but due to the lack of time at the moment, i would like to ask you to post something on it, questions, comments, perhaps an angle on something, and we'll follow with responses, it'll be fun, you'll see... looking foreward to a good read...

Posted

To explain, the thing that AI folks like about Lisp is that the language is built to generate code on the fly and execute it. *Everything* in Lisp is a "list" including the code. So all you have to do to do this "evolutionary" stuff is keep the algorithms around (kinda like gene sequences in dna) and then randomly change them or choose to "express" them by picking the list and doing an:

 (eval 'list)

many other languages have "eval" functions (vb, javascript, etc), but the fact that lists are the both the basic datastructure and how you write code makes it *extremely* straightforward in Lisp. Very cool.

 

Here's one of my favorite sites on the topic: http://www.generation5.org/ although there are lots of them out there. Google "neural networks" as well as "genetic programming": they use almost identical techniques.

 

Learning Algorithmically,

Buffy

Posted

Like most enthusiastic programmers old enough to be, I was interested in genetic algorithms in the 1990s, when they were a Hot New Thing. My interests and professional work didn’t steer me into continued work in them, but I did have some interesting experiences.

 

One of my favorite classes of problems to solve with genetic algorithms is finding strategies for simple games. The “evolving genomes” don’t “know” anything about tick tac-toe other than to make a move each time it’s allowed, and when the “environment” tells it it has won, lost, or tied. The 2 “genomes” evolve toward to goal of winning, or, if unable to win, not losing.

 

The following M[uMPS] code allows to “genomes”, initialized to completely random play strategies, to “evolve” the ability to play ordinary 3x3 tic-tac-toe:

f  r R q:'$l(R)  s I=$p($p(R,";",$l(R,";")),":") i $l(I) s @I=R ;XRX: read xecute code
n (B,CB) s CB=B f I=369258147,987654321,741852963,147258369,789456123,963852741,321654987 s J=$tr(I,123456789,:naughty: s:CB>J CB=J ;XCB: find cannonic board CB of B
n (B,EB) s EB=0 f I=123,147,159,258,357,369,456,789 s J=$tr(I,1234567890,:umno: i $l($tr(J,10))=3!($l($tr(J,20))=3) s EB=$e(J) Q ;XEB: evaluate board B:wt20060307
n (N,:umno: s M=N,N=0 f  q:'$l(M)  s E=$e(M),$e(M)="" s:E="(" E=$p(M,")"),$e(M,1,$l(E)+1)="" s N=N*B+E ;XCNVD: convert N from base B to 10
n (S1,S2,EB,B,H1,H2,WF,XPTTTS12,XCNVD,XCB,XEB) s B="000000000",(H1,H2,EB)="",WF=$g(WF) f  s S=S1,P=1 x XPTTTS12(1) s H1=$s($l(H1):H1_",",1:"")_N_" "_M w:WF B,! q:$l(EB)  s S=S2,P=2 x XPTTTS12(1) s H2=$s($l(H2):H2_",",1:"")_N_" "_M w:WF B,! q:$l(EB) ;XPTTTS12: play tic-tac-toe, strategy S1 vs S2, return EB, B
s N=B,CB=B,B=3 x XCNVD s B=CB,N=N+1,M=$e(S,N) s:$E(B,M) EB=3-P i 'EB s $e(B,M)=P x XCB,XEB s B=CB i 'EB,B[0 s EB=""  ;XPTTTS12(1)
n (S) s S="" f I=1:1:3**9 s S=$R(9)+1_S ;XRTTTS: create random tic-tac-toe strategy S
n (N,:hihi: s M=N,N="" f  s E=M#B,M=MB,N=$s(E<10:E,1:"("_R_")")_N q:'M ;XCNVB: convert N from base 10 to B
n (G,XCNVB,XCB) k G f I=1:1:3**9 s N=I-1,B=3 x XCNVB s B=$tr($j(N,9)," ",0) x XCB i B=CB s G(I)="1+1+1+1+1+1+1+1+1" ;XINITTTG: initialize tic-tac-toe genome
n (S,G) s S="" f I=1:1:3**9 s L=$g(G(I)) i $l(L) s @("R=$R("_L_")") f M=1:1:9 s R=R-$p(L,"+",M) i R<0 s $e(S,I)=M q ;XRGTTTS: create random genetic tic-tac-toe strategy S from genome G()
n (G,I,M,F,XDTTTG) s L=G(I) x XDTTTG(F),XDTTTG(K) s G(I)=L ;XDTTTG: multiply tic-tac-toe genome G(M).M*F
s K=3 i $p(L,"+",M)#2 s K=4 ;XDTTTG(.5): decide to multiply or divide
s K=4 f J=1:1:$l(L,"+") i J'=M,$p(L,"+",J)#2 s K=3 q ;XDTTTG(2): decide
s $p(L,"+",M)=$p(L,"+",M)*F ;XDTTTG(3): multiply
f J=1:1:$l(L,"+") s:J'=M $p(L,"+",J)=$p(L,"+",J)F ;XDTTTG(4): divide
n (G1,G2,XPGTTT1,XPTTTS12,XINITTTG,XRGTTTS,XDTTTG,XCNVD,XCNVB,XCB,XEB) k G1,G2 x XINITTTG m G1=G,G2=G ;XINIGTTT1: initialize genetic tic-tac-toe for 2 genomes
n (G1,G2,B,H1,H2,WF,XPGTTT1,XPTTTS12,XINITTTG,XRGTTTS,XDTTTG,XCNVD,XCB,XEB) M G=G1 X XRGTTTS S S1=S M G=G2 X XRGTTTS S S2=S X XPTTTS12,XPGTTT1(+EB) ;XPGTTT1: play a round of genetic tic-tac-toe
m G=G1 s F=2,H=H1 x XPGTTT1(0,1) m G1=G,G=G2 s H=H2 x XPGTTT1(0,1) m G2=G ;XPGTTT1(0): update genomes for tie
i $l(H) f J=1:1:$l(H,",") s M=$p(H,",",J),I=+M,M=$p(M," ",2) x XDTTTG ;XPGTTT1(0,1): update 1 genome
m G=G1 s F=2,H=H1 x XPGTTT1(0,1),XPGTTT1(0,1) m G1=G,G=G2 s F=1/2,H=H2 x XPGTTT1(0,1) m G2=G ;XPGTTT1(1): update genomes for G1 win
m G=G1 s F=1/2,H=H1 x XPGTTT1(0,1) m G1=G,G=G2 s F=2,H=H2 x XPGTTT1(0,1),XPGTTT1(0,1) m G2=G ;XPGTTT1(2): update genomes for G2 win
n (G1,G2,XINIGTTT1,XPGTTT1,XPTTTS12,XINITTTG,XRGTTTS,XDTTTG,XCNVD,XCNVB,XCB,XEB) x XINIGTTT1 f I=1:1 x XPGTTT1 w !,$E(B,1,3),$J(I,10),!,$E(B,4,6),!,$E(B,7,9),! r R s:R="W" WF='WF,X="" q:$l(R) ;XDEMOGTTT: demonstrate genetic tic-tac-toe

x XDEMOGTTT ;run the demo

Here’s a sample of its output, which, being randomly driven, varies

000         1
020
001

000         2
002
110
...
111       391
122
212
W
000000010
000001200
001001200
001001202
001001212
001021212
002121112
011221212
111122212

111       392
122
212

In this example, the 2 genomes “stabilize” after 390 plays of the game.

 

Interestingly, the 2 genomes aren’t “good” at tick-tac-toe in general, only in playing with each other. To evolve genomes that are good at it in general requires a more complicated “ecology” than just 2 “organisms.”

Posted

Hey every one,

Do you really belive that there is evolution in the humanbeing kind, do you really belive in Darwin, i my self dont believe that he is a real scientist, he is more of philosopher, i mean life is as simple as 1+1=2 but yet very complicated to understand.

Posted
Hey every one,

Do you really belive that there is evolution in the humanbeing kind, do you really belive in Darwin, i my self dont believe that he is a real scientist, he is more of philosopher, i mean life is as simple as 1+1=2 but yet very complicated to understand.

 

Hey, genetic Algorithms is simply based on the theory. It actually has nothign to do with evolution.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...