home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #27 / NN_1992_27.iso / spool / comp / ai / 4359 < prev    next >
Encoding:
Text File  |  1992-11-20  |  5.2 KB  |  127 lines

  1. Newsgroups: comp.ai
  2. Path: sparky!uunet!haven.umd.edu!darwin.sura.net!zaphod.mps.ohio-state.edu!magnus.acs.ohio-state.edu!usenet.ins.cwru.edu!agate!apple!mumbo.apple.com!gallant.apple.com!kip2-11.apple.com!user
  3. From: PAULSON3@Applelink.apple.com (munch)
  4. Subject: Re: Games and genetic algorithms
  5. Sender: news@gallant.apple.com
  6. Message-ID: <PAULSON3-201192153909@kip2-11.apple.com>
  7. Date: Sat, 21 Nov 1992 00:51:52 GMT
  8. References: <1992Nov11.001553.12600@samba.oit.unc.edu> <1992Nov11.131739.19137@athena.mit.edu> <1992Nov16.175215.29411@versyss.com> <1992Nov18.210045.19530@Princeton.EDU>
  9. Organization: Apple Computer, Inc.
  10. Followup-To: comp.ai,comp.ai.genetic,rec.games.programmer
  11. Lines: 114
  12.  
  13. In article <1992Nov18.210045.19530@Princeton.EDU>,
  14. >acoggins@phoenix.Princeton.EDU (Adam Cody Coggins) wrote:
  15. > > In article <1992Nov16.175215.29411@versyss.com> keithd@versyss.UUCP (Keith Doyle) writes:
  16. > > >In article <1992Nov11.131739.19137@athena.mit.edu> acgoldis@athena.mit.edu (Andrew C Goldish) writes:
  17.  
  18. [...]
  19.  
  20.  
  21. wrt automatically creating optimal strategies for game play via genetic 
  22. algorithms:
  23.  
  24. For several years I've had as a background challenge developing an 
  25. algorithm which will create the optimal strategy for the simple two
  26. player poker game described in _Theory of Games and Economic Behavior_
  27. by von Neumann and MorgenStern.  In _Theory_, they describe a discrete
  28. form of the game and then evolve it into a continuous form.  They provide
  29. an analytic solution to the continuous form.
  30.  
  31. My version of the game deals from a 14 card deck.  The cards have values
  32. from 1 .. 7.  Ties are possible.  The game is played by dealing each player
  33. a card.  There is a single betting round where a player wagers either "low"
  34. number of chips (in my case, 5) or wagers a "high" number of chips (15).  
  35. The players simultaneously declare if they are betting high or if
  36. they are betting low.  If both players bet high or both bet low, the cards
  37. are revealed and the player with the higher card wins high/low number of
  38. chips from the other player.  If the players tie, no chips are exchanged.
  39. If one player bets high and the other player bets low, there is no
  40. showdown.
  41. The player betting high receives the "low" number of chips from the player
  42. betting low.
  43.  
  44. Strategy is represented by a 7 element vector.  Each element is the
  45. probability
  46. of the player betting high if the player is dealt the corresponding card.
  47.  
  48. My last attempts used genetic algorithms.  Working off the fact that an
  49. optimal strategy in the game-theoretic sense is one which is no worse than
  50. any other strategy, I create two populations of players, evolve optimal
  51. players in one pool and collect survivors in the other.  By collecting
  52. locally optimal survivors I am able to provide the evolving pool with a
  53. set of tougher opponents.
  54.  
  55. Computation of the fitness function of an individual strategy versus any
  56. other strategy is done with two nested loops and two conditionals in the
  57. heart of the loops.  No randomness is involved.  An individual is better 
  58. than an other if the fitness is greater than 0.  Computation of the fitness
  59. of an individual in the evolving pool versus the survivor pool is done by
  60. computing the fitness of the individual against all strategies in the
  61. survivor pool.  To satisfy the "no worse than any other strategy"
  62. constraint, 
  63. I add a massive penalty (-100000) to the cumulative fitness of an
  64. individual
  65. whenever a fitness value is negative.  (To avoid any potential problems
  66. with
  67. floating point roundoff and to allow otherwise good individuals to avoid 
  68. penalties, I penalize if below -5 instead of 0).
  69.  
  70. To summarize the technique:
  71.  
  72.         // Initialize to random strategies
  73.   evolvers <- random strategies
  74.   survivors <- random strategies
  75.  
  76.   // Evolve 
  77.   repeat
  78.     repeat
  79.                   // Clear fitness of evolvers
  80.       for e in evolvers
  81.         fitness of e <- 0
  82.  
  83.       // Compute fitness values
  84.       for e in evolvers
  85.         for s in survivors
  86.           value <- fitness(e, s)
  87.           if value is sufficiently negative
  88.             value <- value - penalty
  89.           fitness of e <- fitness of e + value
  90.  
  91.       // Apply genetic algorithm to evolvers
  92.       evolvers <- ga(evolvers)
  93.     until evolvers is opimized
  94.  
  95.                 // Evolvers has been optimized against survivors.
  96.     // Replace least fit survivor with optimized evolver
  97.     for s in survivors
  98.       fitness of s <- 0
  99.  
  100.     // Compute fitness values
  101.     for s1 in survivors
  102.       for s2 in survivors
  103.         value <- fitness(s1, s2)
  104.         if value is sufficiently negative
  105.           value <- value - penalty
  106.         fitness of s1 <- fitness of s1 + value
  107.  
  108.     // Replace least fit s in survivors with best from evolvers
  109.     replace(survivors, best of evolvers)
  110.   until survivors are only optimal strategies
  111.  
  112.  
  113. My experiences have been disappointing.  Viewing the results, we discover
  114. that strategies rapidly evolve to always bet high with the best hand.  We
  115. then see that the strategies for individual cards are then optimized, but
  116. as time goes by, those earlier optimizations are discarded.  We then wedge,
  117. with the pool of evolvers unable to produce a strategy no worse than any in
  118. the pool of survivors.  This is not correct, there is an optimal strategy
  119. for this game.
  120.  
  121. I hope that some of you might be able to use this experience and, perhaps,
  122. to show me the errors of my ways.  
  123.  
  124.  
  125. munch
  126. paulson3@applelink.apple.com
  127.