db3108 / michi-c2

Michi-c2 --- development version for michi-c
25 stars 9 forks source link

How to hint michi-c2 to focus on a tsumego? #13

Closed horaceho closed 8 years ago

horaceho commented 8 years ago

I am trying to use michi-c2 as a tsumego solver. After loading a sgf, e.g.:

 (;AB[ic][lc][md][nd][oe][pd][qe][qc][rc]AW[nc][oc][pc][od][qb])
loadsgf fayang-01.sgf
Move: 0     Black: 0 caps   White: 0 caps   Komi: 7.5
 19 . . . . . . . . . . . . . . . . . . .     . . . . . . . . . . . . . . . . . . .
 18 . . . . . . . . . . . . . . . .(O). .     . . . . . . . . . . . . . . . . . . .
 17 . . . . . . . . X . . X . O O O X X .     . . . . . . . . . . . . . . . . . . .
 16 . . . . . . . . . . . . X X O X . . .     . . . . . . . . . . . . . . . . . . .
 15 . . . . . . . . . . . . . . X . X . .     . . . . . . . . . . . . . . . . . . .
 14 . . . . . . . . . . . . . . . . . . .     . . . . . . . . . . . . . . . . . . .
 13 . . . . . . . . . . . . . . . . . . .     . . . . . . . . . . . . . . . . . . .
 12 . . . . . . . . . . . . . . . . . . .     . . . . . . . . . . . . . . . . . . .
 11 . . . . . . . . . . . . . . . . . . .     . . . . . . . . . . . . . . . . . . .
 10 . . . . . . . . . . . . . . . . . . .     . . . . . . . . . . . . . . . . . . .
 9  . . . . . . . . . . . . . . . . . . .     . . . . . . . . . . . . . . . . . . .
 8  . . . . . . . . . . . . . . . . . . .     . . . . . . . . . . . . . . . . . . .
 7  . . . . . . . . . . . . . . . . . . .     . . . . . . . . . . . . . . . . . . .
 6  . . . . . . . . . . . . . . . . . . .     . . . . . . . . . . . . . . . . . . .
 5  . . . . . . . . . . . . . . . . . . .     . . . . . . . . . . . . . . . . . . .
 4  . . . . . . . . . . . . . . . . . . .     . . . . . . . . . . . . . . . . . . .
 3  . . . . . . . . . . . . . . . . . . .     . . . . . . . . . . . . . . . . . . .
 2  . . . . . . . . . . . . . . . . . . .     . . . . . . . . . . . . . . . . . . .
 1  . . . . . . . . . . . . . . . . . . .     . . . . . . . . . . . . . . . . . . .
    A B C D E F G H J K L M N O P Q R S T 

= B

michi-c2 does not care about the life and death on upper right:

genmove blank
+- pass 0.331 (   662/2000  , prior   5/10 , rave      0/0     =  nan, urgency 0.332)
   +- D15 0.641 (   127/198   , prior   5/10 , rave    742/1055  =0.703, urgency 0.689)
   +- J3 0.702 (   127/181   , prior  15/20 , rave    701/1046  =0.670, urgency 0.677)
   +- Q3 0.680 (   100/147   , prior  15/20 , rave    731/1081  =0.676, urgency 0.678)
   +- F14 0.682 (    30/44    , prior   5/10 , rave    666/967   =0.689, urgency 0.686)
   +- D18 0.678 (    59/87    , prior   5/20 , rave    691/984   =0.702, urgency 0.690)
   +- G15 0.696 (    48/69    , prior   5/10 , rave    684/1010  =0.677, urgency 0.677)
   +- C11 0.685 (   719/1049  , prior  15/20 , rave   1027/1485  =0.692, urgency 0.689)
[2000] winrate 0.685 | seq  C11 C10 D10 D9 C9| can  C11(0.685) D15(0.641) J3(0.702) Q3(0.680) D18(0.678)
Move: 1     Black: 0 caps   White: 0 caps   Komi: 7.5
 19 . . . . . . . . . . . . . . . . . . .     . . . . . . . x x x x x x . . . . . x
 18 . . . . . . . . . . . . . . . . O . .     . . . . . . . x x x x x . . . . . x x
 17 . . . . . . . . X . . X . O O O X X .     . . . . . . . x X X X X x . . . X X X
 16 . . . . . . . . . . . . X X O X . . .     . . . . . . . x x x x X X X . X X X X
 15 . . . . . . . . . . . . . . X . X . .     . . . . . . . . x x x x x X X X X X X
 14 . . . . . . . . . . . . . . . . . . .     . . . . . . . . . . . x x x x X x x x
 13 . . . . . . . . . . . . . . . . . . .     . . . . . . . . . . . . . . x x x x x
 12 . . . . . . . . . . . . . . . . . . .     . . . . . . . . . . . . . . . . . . .
 11 . .(X). . . . . . . . . . . . . . . .     . . . . . . . . . . . . . . . . . . .
 10 . . . . . . . . . . . . . . . . . . .     . . . . . . . . . . . . . . . . . . .
 9  . . . . . . . . . . . . . . . . . . .     . . . . . . . . . . . . . . . . . . .
 8  . . . . . . . . . . . . . . . . . . .     . . . . . . . . . . . . . . . . . . .
 7  . . . . . . . . . . . . . . . . . . .     . . . . . . . . . . . . . . . . . . .
 6  . . . . . . . . . . . . . . . . . . .     . . . . . . . . . . . . . . . . . . .
 5  . . . . . . . . . . . . . . . . . . .     . . . . . . . . . . . . . . . . . . .
 4  . . . . . . . . . . . . . . . . . . .     . . . . . . . . . . . . . . . . . . .
 3  . . . . . . . . . . . . . . . . . . .     . . . . . . . . . . . . . . . . . . .
 2  . . . . . . . . . . . . . . . . . . .     . . . . . . . . . . . . . . . . . . .
 1  . . . . . . . . . . . . . . . . . . .     . . . . . . . . . . . . . . . . . . .
    A B C D E F G H J K L M N O P Q R S T 

= C11

Is it possible to hint michi-c2 focus on the upper right and try to kill white?

traveller42 commented 8 years ago

I think this is non-trivial and outside the intended scope of this program.

However, if one were to try, I think the way to approach this is to adjust move generation to only create moves in the area of interest. You would then need to adjust the win conditions to only care about the survival of the target group.

In addition to the internal changes, one would need to add GTP commands or Command Line arguments to define the starting condition (likely already solved), the limits of the area of interest, and the target group.

db3108 commented 8 years ago

Hello Horace,

Is this a question or an issue ? The purpose of michi-c is to win a game not to solve a tsumego.

If you want to build a tsumego solver using the base code of michi, then you could go along the lines described above by traveller42. Once, I thought to try something like that, but didn't go farther in that direction.

They are many traps in building a tsumego solver. To avoid many of them, the first thing is to begin with trying to solve completely enclosed positions (but of course the enclosure of the position should not change the solution of the problem if the problem itself is not closed at the beginning) see for example the papers of Thomas Wolf (program GoTools, etc.)

db3108 commented 8 years ago

Afterthought ...

If you really want to use michi-c without any modification to solve this kind of problem, then of course, you could setup a position on the board such that C1. the fake of each point of the board is decided except in the region of interest of the tsumego C2. the result of the game is decided by which side win the tsumego

Note: C1. Can be achieved by making a lot of 1 point eyes on the board so that michi-c will not waste time playing outside the region of interest (trying of course to balance the number points owned by BLACK and WHITE ... in order to achieve C2 ... komi could also be used for achieving C2 of course).

This is cumbersome to build such positions but I made some of them for test purpose in order to study how the MCTS search behave in some rather controlled conditions. In particular, a great deal of attention must be put on the problem definition in order to be sure that the environment does not interfere with the tsumego. But it can be done.

But do not claim the strength of michi-c as results of experiments like this (either good or bad), because I believe this will depend a lot on the size of the smallest environment you are able to define without changing the result of the tsumego ...

horaceho commented 8 years ago

This is a question, not an issue (sorry that I don't know a better place to post a question on GitHub).

Thanks very much for the C1 and C2 advices. I'll try.

horaceho commented 8 years ago

I use the following config:

param_general               play_until_the_end 1
param_general                     RESIGN_THRES 0.00

and following C1 with the following sgf:

(;AB[aa][ac][ae][ag][ai][ak][am][ao][aq][as]
[ca][cc][ce][cg][ci][ck][cm][co][cq][cs]
[ea][ec][ee][eg][ei][ek][em][eo][eq][es]
[ga][gc][ge][gg][gi][gk][gm][go][gq][gs]
    [ic][ie][ig][ii][ik][im][io][iq][is]
    [kc][ke][kg][ki][kk][km][ko][kq][ks]
        [me][mg][mi][mk][mm][mo][mq][ms]
        [oe][og][oi][ok][om][oo][oq][os]
        [qe][qg][qi][qk][qm][qo][qq][qs]
        [se][sg][si][sk][sm][so][sq][ss]
[bb][bd][bf][bh][bj][bl][bn][bp][br]
[db][dd][df][dh][dj][dl][dn][dp][dr]
[fb][fd][ff][fh][fj][fl][fn][fp][fr]
[hb][hd][hf][hh][hj][hl][hn][hp][hr]
    [jd][jf][jh][jj][jl][jn][jp][jr]
        [lf][lh][lj][ll][ln][lp][lr]
        [nf][nh][nj][nl][nn][np][nr]
        [pf][ph][pj][pl][pn][pp][pr]
        [rf][rh][rj][rl][rn][rp][rr]
[ic][lc][md][nd][oe][pd][qe][qc][rc]
AW[nc][oc][pc][od][qb])

here is the outcome:

loadsgf fayang-01.sgf
Move: 0     Black: 0 caps   White: 0 caps   Komi: 7.5
 19 X . X . X . X . . . . . . . . . . . .     . . . . . . . . . . . . . . . . . . .
 18 . X . X . X . X . . . . . . . .(O). .     . . . . . . . . . . . . . . . . . . .
 17 X . X . X . X . X . X X . O O O X X .     . . . . . . . . . . . . . . . . . . .
 16 . X . X . X . X . X . . X X O X . . .     . . . . . . . . . . . . . . . . . . .
 15 X . X . X . X . X . X . X . X . X . X     . . . . . . . . . . . . . . . . . . .
 14 . X . X . X . X . X . X . X . X . X .     . . . . . . . . . . . . . . . . . . .
 13 X . X . X . X . X . X . X . X . X . X     . . . . . . . . . . . . . . . . . . .
 12 . X . X . X . X . X . X . X . X . X .     . . . . . . . . . . . . . . . . . . .
 11 X . X . X . X . X . X . X . X . X . X     . . . . . . . . . . . . . . . . . . .
 10 . X . X . X . X . X . X . X . X . X .     . . . . . . . . . . . . . . . . . . .
 9  X . X . X . X . X . X . X . X . X . X     . . . . . . . . . . . . . . . . . . .
 8  . X . X . X . X . X . X . X . X . X .     . . . . . . . . . . . . . . . . . . .
 7  X . X . X . X . X . X . X . X . X . X     . . . . . . . . . . . . . . . . . . .
 6  . X . X . X . X . X . X . X . X . X .     . . . . . . . . . . . . . . . . . . .
 5  X . X . X . X . X . X . X . X . X . X     . . . . . . . . . . . . . . . . . . .
 4  . X . X . X . X . X . X . X . X . X .     . . . . . . . . . . . . . . . . . . .
 3  X . X . X . X . X . X . X . X . X . X     . . . . . . . . . . . . . . . . . . .
 2  . X . X . X . X . X . X . X . X . X .     . . . . . . . . . . . . . . . . . . .
 1  X . X . X . X . X . X . X . X . X . X     . . . . . . . . . . . . . . . . . . .
    A B C D E F G H J K L M N O P Q R S T 

= B

genmove white
+- pass 1.000 (  2000/2000  , prior   5/10 , rave      0/0     =  nan, urgency 0.998)
   +- Q19 0.000 (     0/182   , prior  27/32 , rave      0/590   =0.000, urgency 0.038)
   +- S15 0.000 (     0/151   , prior  13/18 , rave      0/186   =0.000, urgency 0.038)
   +- Q18 0.000 (     0/690   , prior  39/44 , rave      0/332   =0.000, urgency 0.038)
   +- P18 0.000 (     0/355   , prior  27/32 , rave      0/366   =0.000, urgency 0.038)
   +- R16 0.000 (     0/595   , prior  27/32 , rave      0/94    =0.000, urgency 0.038)
[2000] winrate 0.000 | seq  Q18 S18 R16 S16 O18| can  Q18(0.000) R16(0.000) P18(0.000) Q19(0.000) S15(0.000)
Move: 1     Black: 0 caps   White: 0 caps   Komi: 7.5
 19 X . X . X . X . . . . . . . . . . . .     X X X X X X X X X X X X . . . . x X X
 18 . X . X . X . X . . . . . . .(O)O . .     X X X X X X X X X X X X . . . . . X X
 17 X . X . X . X . X . X X . O O O X X .     X X X X X X X X X X X X x . . . X X X
 16 . X . X . X . X . X . . X X O X . . .     X X X X X X X X X X X X X X . X X X X
 15 X . X . X . X . X . X . X . X . X . X     X X X X X X X X X X X X X X X X X X X
 14 . X . X . X . X . X . X . X . X . X .     X X X X X X X X X X X X X X X X X X X
 13 X . X . X . X . X . X . X . X . X . X     X X X X X X X X X X X X X X X X X X X
 12 . X . X . X . X . X . X . X . X . X .     X X X X X X X X X X X X X X X X X X X
 11 X . X . X . X . X . X . X . X . X . X     X X X X X X X X X X X X X X X X X X X
 10 . X . X . X . X . X . X . X . X . X .     X X X X X X X X X X X X X X X X X X X
 9  X . X . X . X . X . X . X . X . X . X     X X X X X X X X X X X X X X X X X X X
 8  . X . X . X . X . X . X . X . X . X .     X X X X X X X X X X X X X X X X X X X
 7  X . X . X . X . X . X . X . X . X . X     X X X X X X X X X X X X X X X X X X X
 6  . X . X . X . X . X . X . X . X . X .     X X X X X X X X X X X X X X X X X X X
 5  X . X . X . X . X . X . X . X . X . X     X X X X X X X X X X X X X X X X X X X
 4  . X . X . X . X . X . X . X . X . X .     X X X X X X X X X X X X X X X X X X X
 3  X . X . X . X . X . X . X . X . X . X     X X X X X X X X X X X X X X X X X X X
 2  . X . X . X . X . X . X . X . X . X .     X X X X X X X X X X X X X X X X X X X
 1  X . X . X . X . X . X . X . X . X . X     X X X X X X X X X X X X X X X X X X X
    A B C D E F G H J K L M N O P Q R S T 

= Q18

Do you have any advice on archiving C2?

db3108 commented 8 years ago

You should put about the same number of Black and White stones on the board and then control that the score computed by gogui (for example) is close to zero when the stones of the tsumego are not decided. Then use the komi to adjust the score.

As a final check, play the tsumego up to the end with winning moves and losing moves in order to check that solving correctly the tsumego wins the game and losing it will loose the game. After that you can let michi-c try to find the winning move.

horaceho commented 8 years ago

Thank you.