Free Republic
Browse · Search
News/Activism
Topics · Post Article

To: AndrewC; PugetSoundSoldier
When does the genetic algorithm program terminate? Why does it terminate?

When you have a solution that matches your parameters for a successful solution. In #4, PGS said

The fact that there is a pre-determined “stop executing” point is not a function of the evolutionary nature of a GA; it is simply a recognition that there’s not need to continue looking for answers after you have one...

And the fact there is a “stop executing” point does not mean your answer is pre-ordained. I’ve run GAs on the same problem set, with the same initial seeding, and come up with different - but still very viable and useful - results.

As I understand it, that means you know what an answer will look like, but you don't know what the answer is. I'm sure he can explain better.
56 posted on 05/09/2009 11:15:06 AM PDT by Ha Ha Thats Very Logical
[ Post Reply | Private Reply | To 54 | View Replies ]


To: Ha Ha Thats Very Logical
When you have a solution that matches your parameters for a successful solution.

Yes, and in a programmed genetic algorithm, that "solution" is used in each iteration to tailor the results of the iteration.

60 posted on 05/09/2009 11:33:17 AM PDT by AndrewC (Metanoia)
[ Post Reply | Private Reply | To 56 | View Replies ]

To: Ha Ha Thats Very Logical; GodGunsGuts
In my previous replies I did not show the "genetic algorithm" which really troubles me since so many people use it as an example. Scientific American even mentioned it. In past threads long ago forgotten, I posted it. I found it again. Here it is in "full glory" from How "Chance" works in Evolution


THE COMPUTER PROGRAM IN APPENDIX E IN "UPON THE SHOULDERS OF GIANTS" BY 
RICHARD HARDISON

10 REM 1984 R. HARDISON
11 PRINT "RANDOMIZING ALPHABET"
12 PRINT "WRITE HAMLET, KEEPING"
13 PRINT "SUCCESSES."
14 PRINT :; REM N-COUNTER: # OF TRIALS
15 REM T=COUNTER:REUSE "TO BE"
16 PRINT "SUBROUTINE TO
17 PRINT "RANDOMIZE AND SELECT"
18 PRINT "LETTER"
30 N = 0
40 FOR G = 1 TO 10
50 T = 0
60 GOTO 80
70 X = INT (26 * RND (1)) + 1: RETURN
80 GOSUB 70
90 N = N + 1
100 IF X = 20 THEN PRINT "T": IF X = 20 THEN GOTO 120
110 GOTO 60
120 N = N + 1
130 GOSUB 70
140 IF X = 15 THEN PRINT "O": IF X = 15 THEN PRINT : IF X = 15 THEN GOTO 160
150 GOTO 120 
160 N = N + 1 
170 GOSUB 70 
180 IF X = 2 THEN PRINT "B": IF X = 2 THEN GOTO 200 
190 GOTO 160 
200 N = N + 1 
210 GOSUB 70 
220 IF X = 5 THEN PRINT "E": IF X = 5 THEN PRINT : IF X = 5 THEN GOTO 240 
230 GOTO 200 
240 T = T + 1
250 IF T = 2 THEN GOTO 460 
260 N = N + 1 
270 GOSUB 70 
280 IF X = 15 THEN PRINT "O": IF X = 15 THEN GOTO 300 
290 GOTO 260 
300 N = N + 1 
310 GOSUB 70 
320 IF X = 18 THEN PRINT "R": IF X = 18 THEN GOTO 340 
330 GOTO 300 
340 N = N + 1 
350 GOSUB 70 
360 IF X = 14 THEN PRINT "N": IF X = 14 THEN GOTO 380 
370 GOTO 340
380 N = N + 1 
390 GOSUB 70 
400 IF X = 15 THEN PRINT "O": IF X = 15 THEN GOTO 420 
410 GOTO 380 
420 N = N + 1 
430 GOSUB 70 
440 IF X = 20 THEN PRINT "T": IF X = 20 THEN PRINT : IF X = 20 THEN GOTO 60 
450 GOTO 420 
460 PRINT "N=";N;" KEYS PRESSED TO WRITE 'TO BE OR NOT TO BE'" 
470 PRINT "FOR";G;" RUN(S) OF PROGRAM"
480 PRINT 
490 NEXT G 
500 END
510 REM  IF THE PROGRAM WERE 
511 REM  WRITTEN TO INCLUDE 
512 REM  PUNCTUATION MARKS ETC. 
513 REM  THE PROGRAM WOULD 
514 REM  TAKE LONGER, BUT WOULD 
515 REM  STILL NOT BE PROHIBI- 
516 REM  TIVE 
517 PRINT
518 PRINT "WITH 3000 RUNS, THE MEAN" 
519 PRINT "# of trials=333" 
520 PRINT "THE MEAN TIME REQUIRED" 
521 PRINT "WAS .14 MINUTES TO PRINT" 
522 PRINT "TOBEORNOTTOBE" 
------------------------------- 
From this analysis of Darwin,
Hamlet, Dawkins, Hardison, coincidence, and selective evolution, we may
conclude that whether the reality of evolution is to be believed or not to be
believed, methinks it is like a weasel of truth nonetheless.

Michael Shermer

I modified it to fix the run on lines, but it still has syntax problems which I don't need to fix to show how silly the program is. Essentially the program waits around until it gets the correct letter then moves on to the next until the whole "phrase" "TOBEORNOTTOBE" is generated. The spaces are put in by the program. Whatta marroooonnn! -- Bugs Bunny. Then, as if it means anything, the average number of iterations over 3000 runs is given, viz. 333. Well, that algorithm waits on average 18 iterations to get a .5 probability of not getting the letter. And 18*13 is 234. Plus, if I threw away the "invalid" letters not matching each position and only considered the remaining letters(no replacement), at most only 26*13 iterations would be required. That is 338.

65 posted on 05/09/2009 2:40:22 PM PDT by AndrewC (Metanoia)
[ Post Reply | Private Reply | To 56 | View Replies ]

Free Republic
Browse · Search
News/Activism
Topics · Post Article


FreeRepublic, LLC, PO BOX 9771, FRESNO, CA 93794
FreeRepublic.com is powered by software copyright 2000-2008 John Robinson