Combining UCT and Constraint Satisfaction Problems for Minesweeper

454 views
437 views

Published on

@inproceedings{buffet:hal-00750577,
hal_id = {hal-00750577},
url = {http://hal.inria.fr/hal-00750577},
title = {{Optimistic Heuristics for MineSweeper}},
author = {Buffet, Olivier and Lee, Chang-Shing and Lin, Woanting and Teytaud, Olivier},
abstract = {{We present a combination of Upper Con dence Tree (UCT) and domain speci c solvers, aimed at improving the behavior of UCT for long term aspects of a problem. Results improve the state of the art, combining top performance on small boards (where UCT is the state of the art) and on big boards (where variants of CSP rule).}},
language = {Anglais},
affiliation = {MAIA - INRIA Nancy - Grand Est / LORIA , Department of Computer Science and Information Engineering - CSIE , National University of Tainan - NUTN , TAO - INRIA Saclay - Ile de France , Laboratoire de Recherche en Informatique - LRI , Department of Electrical Engineering and Computer Science - Institut Montefiore},
booktitle = {{International Computer Symposium}},
address = {Hualien, Ta{\"\i}wan, Province De Chine},
audience = {internationale },
year = {2012},
pdf = {http://hal.inria.fr/hal-00750577/PDF/mines3.pdf},
}

Published in: Education
1 Comment
0 Likes
Statistics
Notes
  • @inproceedings{buffet:hal-00750577,
    hal_id = {hal-00750577},
    url = {http://hal.inria.fr/hal-00750577},
    title = {{Optimistic Heuristics for MineSweeper}},
    author = {Buffet, Olivier and Lee, Chang-Shing and Lin, Woanting and Teytaud, Olivier},
    abstract = {{We present a combination of Upper Con dence Tree (UCT) and domain speci c solvers, aimed at improving the behavior of UCT for long term aspects of a problem. Results improve the state of the art, combining top performance on small boards (where UCT is the state of the art) and on big boards (where variants of CSP rule).}},
    language = {Anglais},
    affiliation = {MAIA - INRIA Nancy - Grand Est / LORIA , Department of Computer Science and Information Engineering - CSIE , National University of Tainan - NUTN , TAO - INRIA Saclay - Ile de France , Laboratoire de Recherche en Informatique - LRI , Department of Electrical Engineering and Computer Science - Institut Montefiore},
    booktitle = {{International Computer Symposium}},
    address = {Hualien, Ta{\'\i}wan, Province De Chine},
    audience = {internationale },
    year = {2012},
    pdf = {http://hal.inria.fr/hal-00750577/PDF/mines3.pdf},
    }
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • Be the first to like this

No Downloads
Views
Total views
454
On SlideShare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
11
Comments
1
Likes
0
Embeds 0
No embeds

No notes for slide

Combining UCT and Constraint Satisfaction Problems for Minesweeper

  1. 1. Optimistic Heuristics &Application to MineSweeperO. Buffet, W. Lin, O. Teytaud
  2. 2. A great challenge: MineSweeper.- looks easy- in fact, not easy: many myopic (one- step-ahead) approaches.- partially observable
  3. 3. 1. Rules of MineSweeper 2. State of the art 3. The CSP approach 4. The UCT approach5. The best of both worlds
  4. 4. RULES At the beginning, all locations are Covered(unkwown).
  5. 5. I playhere!
  6. 6. Good news! No mine in theneighborhood! I can “click” all the neighbours.
  7. 7. I have 3 uncovered neighbors, and I have 3 mines in theneighborhood ==> 3 flags!
  8. 8. I know its a mine,so I put a flag!
  9. 9. No info !
  10. 10. I play here and I lose...
  11. 11. The mostsuccessfulgame ever!Who in thisroom never played Mine-Sweeper ?
  12. 12. 1. Rules of MineSweeper 2. State of the art 3. The CSP approach 4. The UCT approach5. The best of both worlds
  13. 13. Do you think its easy ? (10 mines)MineSweeperis not simple.
  14. 14. What isthe optimal move ?
  15. 15. What is the optimal move ? Remark: the question makes sense, without Knowing the history.You dont need the history for playing optimaly. ==> (this fact is mathematically non trivial!)
  16. 16. What is the optimal move ? This one is easy.Both remaining locations win with proba 50%.
  17. 17. Moredifficult! Whichmove isoptimal ?Here, theclassicalapproach (CSP)is wrong.
  18. 18. Probability of a mine ?- Top:- Middle:- Bottom:
  19. 19. Probability of a mine ?- Top: 33%- Middle:- Bottom:
  20. 20. Probability of a mine ?- Top: 33%- Middle: 33%- Bottom:
  21. 21. Probability of a mine ?- Top: 33%- Middle: 33%- Bottom: 33%
  22. 22. Probability of a mine ?- Top: 33%- Middle: 33%- Bottom: 33%==> so all moves equivalent ?
  23. 23. Probability of a mine ?- Top: 33%- Middle: 33%- Bottom: 33%==> so all moves equivalent ?==> NOOOOO!!!
  24. 24. Probability of a mine ?- Top: 33%- Middle: 33%- Bottom: 33%Top or bottom: 66% of win!Middle: 33%!
  25. 25. The myopic(one-step ahead) approach plays randomly. The middle is a bad move! Even with same proba of mine, some moves arebetter than others!
  26. 26. State of the art:- solved in 4x4- NP-complete- Constraint Satisfaction Problem approach: = Find the location which is less likely to be a mine, play there. ==> 80% success “beginner” (9x9, 10 mines) ==> 45% success “intermediate” (16x16, 40 mines) ==> 34% success “expert” (30x40, 99 mines)
  27. 27. 1. Rules of MineSweeper 2. State of the art 3. The CSP approach(and other old known methods) 4. The UCT approach 5. The best of both worlds
  28. 28. - Exact MDP: very expensive. 4x4 solved.- Single Point Strategy (SPS): simple local solving- CSP (constraint satisf. problem): the main approach. - (unknown) state: x(i) = 1 if there is a mine at location i - each visible location is a constraint: If location 15 is 4, then the constraint is x(04)+x(05)+x(06) +x(14)+ x(16) +x(24)+x(25)+x(26) = 4. - find all solutions x1, x2, x3,...,xN - P(mine in j) = (sumi Xij ) / N <== this is math. proved! - play j such that P(mine in j) minimal - if several such j, randomly break ties. MDP= Markov Decision Process CSP = Constraint Satisfaction Problem
  29. 29. CSP as modified by Legendre et al, 2012: - (unknown) state: x(i) = 1 if there is a mine at location i - each visible location is a constraint: If location 15 is 4, then the constraint is x(04)+x(05)+x(06) +x(14)+ x(16) +x(24)+x(25)+x(26) = 4. - find all solutions x1, x2, x3,...,xN - P(mine in j) = (sumi Xij ) / N <== this is math. proved! - play j such that P(mine in j) minimal - if several such j, choose one “closest to the frontier” (proposed by Legendre et al) - if several such j, randomly break ties.
  30. 30. CSP- is very fast- but its not optimal- because ofHere CSP plays randomly!Also for the initial move: dont play randomly the first move! (sometimes opening book)
  31. 31. 1. Rules of MineSweeper 2. State of the art 3. The CSP approach 4. The UCT approach5. The best of both worlds
  32. 32. Why not UCT ?- looks like a stupid idea at first view- can not compete with CSP in terms of speed- But at least UCT is consistent: if given sufficient time, it will play optimally.- Tested in Couetoux and Teytaud, 2011
  33. 33. UCT (Upper Confidence Trees)Coulom (06)Chaslot, Saito & Bouzy (06)Kocsis Szepesvari (06)
  34. 34. UCT
  35. 35. UCT
  36. 36. UCT
  37. 37. UCT
  38. 38. UCT Kocsis & Szepesvari (06)
  39. 39. Exploitation ...
  40. 40. Exploitation ... SCORE = 5/7 + k.sqrt( log(10)/7 )
  41. 41. Exploitation ... SCORE = 5/7 + k.sqrt( log(10)/7 )
  42. 42. Exploitation ... SCORE = 5/7 + k.sqrt( log(10)/7 )
  43. 43. ... or exploration ? SCORE = 0/2 + k.sqrt( log(10)/2 )
  44. 44. UCT in one slide
  45. 45. UCT in one slide C SP by se the al 2012We u re et dLegen expansion for ulation . a nd sim
  46. 46. Applying UCT here ?• Might look like a hammer for a drosophilia• But in many cases CSP is suboptimal• We have seen an example of suboptimal move by CSP a few slides ago• Lets see two additional examples
  47. 47. An example showing that the initialmove matters (UCT finds it, not CSP).. 3x3, 7 mines: the optimal move is anything but the center. Optimal winning rate: 25%. Optimal winning rate if random uniform initial move: 17/72. (yes we get 1/72 improvement!)
  48. 48. Second such example: 15 mines on 5x5 board with GnoMine rule (i.e. initial move is a 0, i.e. no mine in the neighborhood) Optimal success rate = 100%!!!!!Play the center, and you win (well, you have to work...) The myopic CSP approach does not find it.
  49. 49. 1. Rules of MineSweeper 2. State of the art 3. The CSP approach 4. The UCT approach5. The best of both worlds
  50. 50. SummaryI have two approaches:• CSP: • Fast • Suboptimal (myopic, only 1-step ahead)• UCT: • needs a generative model (probability of next states, given my action), • Asymptotically optimal
  51. 51. The best of both worlds ?• CSP: • Fast • Suboptimal (myopic, only 1-step ahead)• UCT: • needs a generative model by CSP, • Asymptotically optimal
  52. 52. What do I need for implementing UCT ?A complete generative model.Given a state and an action,I must be able to simulate possible transitions.State S, Action a:(S,a) ==> SExample: given the state below, and the action “top left”, whatare the possible next states ?
  53. 53. What do I need for implementing UCT ?A complete generative model.Given a state and an action,I must be able to simulate possible transitions.State S, Action a:(S,a) ==> SExample: given the state below, and the action “top left”, what are the possible nextstates ?
  54. 54. What do I need for implementing UCT ?A complete generative model.Given a state and an action,I must be able to simulate possible transitions.State S, Action a:(S,a) ==> SExample: given the state below, and the action “top left”, what are the possible nextstates ?
  55. 55. What do I need for implementing UCT ?A complete generative model.Given a state and an action,I must be able to simulate possible transitions.State S, Action a:(S,a) ==> SExample: given the state below, and the action “top left”, what are the possible nextstates ?
  56. 56. What do I need for implementing UCT ?A complete generative model.Given a state and an action,I must be able to simulate possible transitions.State S, Action a:(S,a) ==> SExample: given the state below, and the action “top left”, what are the possible nextstates ?
  57. 57. We published a version of UCT for MineSweeper in which this wasWhat do I need for implementing UCT ? implemented usingA complete generative model.Given a state and an action, the rejection method only.I must be able to simulate possible transitions.State S, Action a:(S,a) ==> SExample: given the state below, and the action “top left”, what are the possible nextstates ?
  58. 58. Rejection algorithm: 1- randomly draw the minesWhat do I need for implementing UCT ?Given 2- if and an action, return the new observation a state its ok,A complete generative model. 3- otherwise, go back to 1.I must be able to simulate possible transitions.State S, Action a:(S,a) ==> SExample: given the state below, and the action “top left”, what are the possible nextstates ?
  59. 59. It is mathematically ok, but it is too slow.Then,need for used a UCT ? CSP implementation.What do I we implementing weakA complete generative model.Given a state and an action, Still too slow.Now a reasonably fast implementation, withI must be able to simulate possible transitions.State S, Action a:(S,a) ==> S Legendre et al heuristic.Example: given the state below, and the action “top left”, what are the possible nextstates ?
  60. 60. EXPERIMENTAL RESULTS Huge computation10 000 UCT-simulations time per move Our results (total = a few days)
  61. 61. CONCLUSIONS: a methodology for sequential decision making- When you have a myopic solver (i.e. which neglects long term effects, as too often in industry!) ==> improve it with heuristics (as Legendre et al) ==> combine with UCT (as we did) ==> significant improvements- We have similar experiments on industrial testbeds
  62. 62. Thanks for yourattention! 9 Mines. What is theoptimal move ?

×