コード例 #1
0
ファイル: elo.py プロジェクト: richemslie/gzero_data
    def bt7(self, filename="../data/elo/bt7.elo"):
        man = manager.get_manager()

        from ggpzero.battle.bt import MatchInfo
        match_info = MatchInfo(7)

        def dp(g, playouts, v):
            return define_player("bt7", g, playouts, v,
                                 depth_temperature_stop=4,
                                 depth_temperature_start=4,
                                 random_scale=0.5)

        gens = []
        for name, num, incr in (["kt1", 2, 4],):
            while True:
                gen = "%s_%s" % (name, num)
                if not man.can_load("bt_7", gen):
                    print "FAILED TO LOAD GEN", gen
                    break

                gens.append(gen)
                num += incr

        all_players = [dp(g, 800, 3) for g in gens]

        random_player = get_player("r", MOVE_TIME)
        mcs_player = get_player("m", MOVE_TIME, max_iterations=800)
        simplemcts_player = get_player("s", MOVE_TIME, max_tree_playout_iterations=800)
        all_players += [random_player, mcs_player, simplemcts_player]

        gen_elo(match_info, all_players, filename)
コード例 #2
0
ファイル: elo.py プロジェクト: richemslie/gzero_data
    def hex11(self, filename="../data/elo/hex11.elo"):
        man = manager.get_manager()

        from ggpzero.battle.hex import MatchInfo
        match_info = MatchInfo(11)

        def dp(g, playouts, v):
            return define_player("hex11", g, playouts, v,
                                 dirichlet_noise_pct=0.15,
                                 depth_temperature_stop=4,
                                 depth_temperature_start=4,
                                 random_scale=0.9)

        gens = []
        for name, num, incr in (["h1", 5, 8],
                                ["b1", 3, 5]):
            while True:
                gen = "%s_%s" % (name, num)
                if not man.can_load("hexLG11", gen):
                    print "FAILED TO LOAD GEN", gen
                    break

                gens.append(gen)
                num += incr

        all_players = [dp(g, 800, 3) for g in gens]

        random_player = get_player("r", MOVE_TIME)
        mcs_player = get_player("m", MOVE_TIME, max_iterations=800)
        simplemcts_player = get_player("s", MOVE_TIME, max_tree_playout_iterations=800)
        all_players += [random_player, mcs_player, simplemcts_player]

        gen_elo(match_info, all_players, filename)
コード例 #3
0
ファイル: elo.py プロジェクト: 1552382553/gzero_data
    def reversi_10(self, filename="../data/elo/r10.elo"):
        man = manager.get_manager()

        from ggpzero.battle.reversi import MatchInfo10
        match_info = MatchInfo10()

        random_player = get_player("r", MOVE_TIME)
        mcs_player = get_player("m", MOVE_TIME, max_iterations=800)
        simplemcts_player = get_player("s",
                                       MOVE_TIME,
                                       max_tree_playout_iterations=800)
        all_players = [random_player, mcs_player, simplemcts_player]

        def dp(g, playouts, v):
            return define_player("r10",
                                 g,
                                 playouts,
                                 v,
                                 dirichlet_noise_pct=0.15,
                                 depth_temperature_stop=6,
                                 depth_temperature_start=6,
                                 max_dump_depth=1,
                                 random_scale=0.9)

        # note x1_7x was Scan first match
        # note x2_119 (or 121) was Scan second match (i think)

        # retrained new_x2_174... not sure what x2 state was in...
        # going to aggregate x2 and h3 and see if total makes stronger

        # @ 192 - massive jump in starting step 25 -> 83.

        # @ 211 - another jump, starting step 83 -> 100
        # @ 211 - crazy add change to neutralise policy pcts
        # current: x2_224 - assuming this was Scan 3rd match

        gens = []
        for name, num, incr in (["x1", 5, 10], ["x2", 49,
                                                10], ['h5', 20,
                                                      10], ["kt1", 3, 5]):
            while True:
                gen = "%s_%s" % (name, num)
                if not man.can_load("reversi_10x10", gen):
                    print "FAILED TO LOAD GEN", gen
                    break

                gens.append(gen)
                num += incr

        # ensure this one
        gens.append("x2_224")

        all_players += [dp(g, 800, 3) for g in gens]

        all_players.append(dp("h5_100", 800, 1))

        gen_elo(match_info, all_players, filename)
コード例 #4
0
ファイル: elo.py プロジェクト: 1552382553/gzero_data
def define_player(game, gen, playouts, version, **extra_opts):
    opts = dict(
        verbose=True,
        puct_constant=0.85,
        dirichlet_noise_pct=0.5,
        fpu_prior_discount=0.25,
        fpu_prior_discount_root=0.1,
        choose="choose_temperature",
        temperature=1.5,
        depth_temperature_max=10.0,
        depth_temperature_start=2,
        depth_temperature_increment=1.0,
        depth_temperature_stop=2,
        random_scale=0.8,
        max_dump_depth=2,
        top_visits_best_guess_converge_ratio=0.85,
        backup_finalised=True,
        lookup_transpositions=True,

        # Passed in
        playouts_per_iteration=playouts)

    if version == 3:
        opts.update(name="%s_v3" % game,
                    puct_constant_root=0.85,
                    dirichlet_noise_pct=0.33,
                    choose="choose_temperature",
                    temperature=1.0,
                    depth_temperature_max=1.0,
                    depth_temperature_start=2,
                    depth_temperature_increment=0,
                    depth_temperature_stop=2,
                    random_scale=0.99,
                    minimax_backup_ratio=0.75,
                    batch_size=8,
                    think_time=MOVE_TIME,
                    converged_visits=playouts / 2)
        opts.update(extra_opts)
        return get_player("puct", MOVE_TIME, gen, **opts)

    elif version == 2:
        opts.update(name="%s_v2" % game,
                    puct_constant_root=0.85,
                    minimax_backup_ratio=0.75,
                    batch_size=8,
                    think_time=MOVE_TIME,
                    converge_relaxed=playouts / 2)

        opts.update(extra_opts)
        return get_player("puct", MOVE_TIME, gen, **opts)

    elif version == 1:
        assert False, "Deprecated with puct1 removal"

    else:
        assert False, "invalid version: %s" % version
コード例 #5
0
ファイル: elo.py プロジェクト: 1552382553/gzero_data
    def connect6(self, filename="../data/elo/connect6.elo"):
        from ggpzero.battle.connect6 import MatchInfo

        match_info = MatchInfo()

        def dp(g, playouts, v):
            return define_player("connect6",
                                 g,
                                 playouts,
                                 v,
                                 max_dump_depth=1,
                                 dirichlet_noise_pct=0.15)

        # random = 500 elo
        random_player = get_player("r", MOVE_TIME)
        mcs_player = get_player("m", MOVE_TIME, max_iterations=800)
        simplemcts_player = get_player("s",
                                       MOVE_TIME,
                                       max_tree_playout_iterations=800)
        all_players = [random_player, mcs_player, simplemcts_player]

        man = manager.get_manager()

        num = 5
        gens = []
        while True:
            gen = "h1_%s" % num
            if not man.can_load("connect6", gen):
                break

            gens.append(gen)
            num += 10

        num = 145
        while True:
            gen = "h2_%s" % num
            if not man.can_load("connect6", gen):
                break

            gens.append(gen)
            num += 5

        gens += ["h1_183"]
        gens += [
            "h2_281", "h2_267", "h2_272", "h2_274", "h2_277", "h2_306",
            "h2_318", "h2_321"
        ]
        all_players += [dp(g, 800, 3) for g in gens]

        gen_elo(match_info,
                all_players,
                filename,
                move_generator=move_generator_c6)
コード例 #6
0
ファイル: elo.py プロジェクト: richemslie/gzero_data
    def bt8(self, filename="../data/elo/bt8.elo"):
        from ggpzero.battle.bt import MatchInfo
        match_info = MatchInfo(8)

        def dp(g, playouts, v):
            return define_player("bt8", g, playouts, v,
                                 depth_temperature_stop=4,
                                 depth_temperature_start=4,
                                 random_scale=0.5)


        # 3 models ran on LG
        all_players = [dp(g, 800, 3) for g in ("x6_90", "x6_96", "x6_102", "x6_106", "x6_111",
                                               "x6_116", "x6_123", "x6_127", "x6_132", "x6_139",
                                               "x6_145", "x6_151", "x6_158", "x6_163", "x6_171",
                                               "x6_177")]

        kt_gens = ["kt1_1",
                   "kt1_2",
                   "kt1_3",
                   "kt1_4",
                   "kt1_5",
                   "kt1_7"]

        man = manager.get_manager()

        gens = []

        for name, num, incr in (["kt1", 10, 4],
                                ["kt3", 2, 3],
                                ["kt5", 2, 10],
                                ["f1", 1, 5],
                                ["az1", 2, 3]):
            while True:
                gen = "%s_%s" % (name, num)
                if not man.can_load("breakthrough", gen):
                    print "FAILED TO LOAD GEN", gen
                    break

                gens.append(gen)
                num += incr

        all_players += [dp(g, 800, 3) for g in gens]
        random_player = get_player("r", MOVE_TIME)
        mcs_player = get_player("m", MOVE_TIME, max_iterations=800)
        simplemcts_player = get_player("s", MOVE_TIME, max_tree_playout_iterations=800)
        all_players += [random_player, mcs_player, simplemcts_player]

        gen_elo(match_info, all_players, filename)
コード例 #7
0
ファイル: elo.py プロジェクト: richemslie/gzero_data
    def hex19(self, filename="../data/elo/hex19.elo"):
        ' hex19 - with new hex C++ SM '
        from ggpzero.battle import hex2

        man = manager.get_manager()

        match_info = hex2.MatchInfo(19)

        random_player = get_player("r", MOVE_TIME)

        # 1 second
        simplemcts_player = get_player("s", 1.0)
        all_players = [random_player, simplemcts_player]

        gens = []
        for name, num, incr, maxg in (["h1", 258, 7, 360],
                                      ["h1", 361, 10, 489],
                                      ["h1", 496, 6, 700],
                                      ["h2", 255, 6, 500],
                                      ["t1", 5, 5, 100]):
            while True:
                gen = "%s_%s" % (name, num)
                if not man.can_load("hex_lg_19", gen):
                    print "FAILED TO LOAD GEN", gen
                    break

                gens.append(gen)
                num += incr
                if num > maxg:
                    break

        def dp(g, playouts, v):
            return define_player("hex_lg_19", g, playouts, v,
                                 dirichlet_noise_pct=0.15,
                                 depth_temperature_increment=1.0,
                                 depth_temperature_max=10.0,
                                 depth_temperature_stop=8,
                                 depth_temperature_start=1,
                                 max_dump_depth=1,
                                 temperature=1.0,
                                 random_scale=0.8)

        gens += ["lalal_456", "lalal_490", "lalal_603"]
        gens += ["yy_291", "halfpol_291"]
        all_players += [dp(g, 800, 3) for g in gens]
        gen_elo(match_info, all_players, filename)
コード例 #8
0
ファイル: elo.py プロジェクト: 1552382553/gzero_data
    def chess_15d(self, filename="../data/elo/chess_15d.elo"):
        def dp(g, playouts, v):
            return define_player("c_15f",
                                 g,
                                 playouts,
                                 v,
                                 dirichlet_noise_pct=0.15,
                                 depth_temperature_stop=6,
                                 depth_temperature_start=6,
                                 max_dump_depth=1,
                                 evaluation_multiplier_to_convergence=2.0,
                                 batch_size=8,
                                 noise_policy_squash_pct=0.75,
                                 noise_policy_squash_prob=0.1,
                                 fpu_prior_discount_root=0.1,
                                 fpu_prior_discount=0.2,
                                 random_scale=0.6)

        man = manager.get_manager()

        from ggpzero.battle import chess
        match_info = chess.MatchInfo(short_50=True)

        random_player = get_player("r", MOVE_TIME)
        mcs_player = get_player("m", MOVE_TIME, max_iterations=800)
        simplemcts_player = get_player("s",
                                       MOVE_TIME,
                                       max_tree_playout_iterations=800)
        all_players = [random_player]  # mcs_player , simplemcts_player

        gens = []
        for name, num, incr in (["c1", 5, 7], ["kb1", 3, 5], ["c2", 145, 5]):
            while True:
                gen = "%s_%s" % (name, num)
                if not man.can_load("chess_15d", gen):
                    print "FAILED TO LOAD GEN", gen
                    break

                gens.append(gen)
                num += incr

        gens.append("c2_367")
        all_players += [dp(g, 800, 3) for g in gens]
        gen_elo(match_info, all_players, filename)
コード例 #9
0
ファイル: elo.py プロジェクト: 1552382553/gzero_data
    def reversi_8(self, filename="../data/elo/r8.elo"):
        man = manager.get_manager()

        from ggpzero.battle.reversi import MatchInfo8
        match_info = MatchInfo8()

        def dp(g, playouts, v):
            return define_player("r8",
                                 g,
                                 playouts,
                                 v,
                                 dirichlet_noise_pct=0.15,
                                 depth_temperature_stop=6,
                                 depth_temperature_start=6,
                                 random_scale=0.75,
                                 max_dump_depth=1)

        random_player = get_player("r", MOVE_TIME)
        mcs_player = get_player("m", MOVE_TIME, max_iterations=800)
        simplemcts_player = get_player("s",
                                       MOVE_TIME,
                                       max_tree_playout_iterations=800)
        all_players = [random_player, mcs_player, simplemcts_player]

        gens = []
        for name, num, incr in (["h3", 5, 20], ["h5", 10, 20], ['h6', 15, 20],
                                ["kt1", 3, 5], ["kt2", 2,
                                                5], ["f1", 2, 6], ["f2", 2,
                                                                   6]):
            while True:
                gen = "%s_%s" % (name, num)
                if not man.can_load("reversi", gen):
                    print "FAILED TO LOAD GEN", gen
                    break

                gens.append(gen)
                num += incr

        all_players += [dp(g, 800, 3) for g in gens]

        gen_elo(match_info, all_players, filename)
コード例 #10
0
ファイル: elo.py プロジェクト: richemslie/gzero_data
    def idk(self, filename="../data/elo/idk.elo"):
        ' international draught killer '
        man = manager.get_manager()

        from ggpzero.battle.draughts import Draughts_MatchInfo
        match_info = Draughts_MatchInfo(killer=True)

        random_player = get_player("r", MOVE_TIME)
        mcs_player = get_player("m", MOVE_TIME, max_iterations=800)
        simplemcts_player = get_player("s", MOVE_TIME, max_tree_playout_iterations=800)
        all_players = [random_player, mcs_player, simplemcts_player]

        gens = []
        for name, num, incr in (["f1", 1, 5],):
            while True:
                if num > 700:
                    break
                gen = "%s_%s" % (name, num)
                if not man.can_load("draughts_killer_10x10", gen):
                    print "FAILED TO LOAD GEN", gen
                    break

                gens.append(gen)
                num += incr

        gens.append("f1_816")
        gens.append("f1_849")
        def dp(g, playouts, v):
            return define_player("draughts_killer_10x10", g, playouts, v,
                                 dirichlet_noise_pct=0.15,
                                 depth_temperature_stop=6,
                                 depth_temperature_start=6,
                                 max_dump_depth=1,
                                 temperature=1.0,
                                 random_scale=0.5)

        all_players += [dp(g, 800, 3) for g in gens]
        gen_elo(match_info, all_players, filename)
コード例 #11
0
ファイル: elo.py プロジェクト: richemslie/gzero_data
    def bt6(self, filename="../data/elo/bt6.elo"):
        man = manager.get_manager()

        from ggpzero.battle.bt import MatchInfo
        match_info = MatchInfo(6)

        def dp(g, playouts, v):
            return define_player("bt6", g, playouts, v,
                                 depth_temperature_stop=4,
                                 depth_temperature_start=4,
                                 random_scale=0.5)

        gens = []
        for name, num, incr in (["x1", 5, 8],
                                ["h2", 7, 8],
                                ["b1", 3, 5]):
            while True:
                gen = "%s_%s" % (name, num)
                if not man.can_load("breakthroughSmall", gen):
                    print "FAILED TO LOAD GEN", gen
                    break

                gens.append(gen)
                num += incr

        # 80 - all, 90 global
        gens += ["b1_80", "b1_90"]

        all_players = [dp(g, 800, 3) for g in gens]

        random_player = get_player("r", MOVE_TIME)
        mcs_player = get_player("m", MOVE_TIME, max_iterations=800)
        simplemcts_player = get_player("s", MOVE_TIME, max_tree_playout_iterations=800)
        all_players += [random_player, mcs_player, simplemcts_player]

        gen_elo(match_info, all_players, filename)
コード例 #12
0
ファイル: elo.py プロジェクト: richemslie/gzero_data
    def hex13(self, filename="../data/elo/hex13.elo"):
        from ggpzero.battle import hex

        match_info = hex.MatchInfo(13)

        # h1_229 was best from pre-july.  h1_50 was from 3rd June. h1_175 was from 21st
        # june. best_252 was 27th of August, I think some bigger model and includes historical
        # data.

        # abandoned lines
        # h1_289 - oct 4
        # h2_260 - dec 19
        # h2_xxx - dec x
        # h4_339 - dec 22
        # h5_xxx - feb 2 (2019)
        # h6_xxx - feb xxx (2019)
        # hz_xxx - failed try at training from scratch (50 evals)

        # c1 - started from 229 data, ran at 200 evals
        # c2 - started from c1 data, ran at 300? evals

        random_player = get_player("r", MOVE_TIME)
        simplemcts_player = get_player("s", MOVE_TIME, max_tree_playout_iterations=800)
        all_players = [random_player, simplemcts_player]

        def dp(g, playouts, v):
            return define_player("hex13", g, playouts, v,
                                 depth_temperature_stop=1,
                                 fpu_prior_discount=0.25,
                                 dirichlet_noise_pct=0.15,
                                 fpu_prior_discount_root=0.25,
                                 max_dump_depth=1)

        gens = ["h1_25", "h1_50", "h1_75", "h1_100", "h1_125", "h1_150", "h1_175", "h1_200",
                "h1_229", "h2_260", "h2_280", "h2_300", "h2_320", "h2_340", "h2_360", "best_252"]

        new_c1 = ["c1_235", "c1_245", "c1_255", "c1_260", "c1_261", "c1_264", "c1_270", "c1_276",
                  "c1_279", "c1_285", "c1_288", "c1_292", "c1_309", "c1_312", "c1_316", "c1_334",
                  "c1_340", "c1_352", "c1_356", "c1_366", "c1_370", "c1_378", "c1_380", "c1_388",
                  "c1_390", "c1_394", "c1_398", "c1_400", "c1_410", "c1_420", "c1_428", "c1_432",
                  "c1_438", "c1_442", "c1_450", "c1_458", "c1_461", "c1_462", "c1_464", "c1_468",
                  "c1_470", "c1_471", "c1_473", "c1_478"]

        others = ["c2_201", "c2_203", "c2_205", "c2_208", "c2_209", "c2_212", "c2_216", "c2_221",
                  "c2_222", "c2_226", "c2_227", "c2_228", "c2_229", "c2_230", "c2_231", "c2_235",
                  "c2_239", "c2_242", "c2_248", "c2_250", "c2_275", "c2_277", "d2_110", "d2_112",
                  "d2_139"]

        recent = ["b4_256", "b4_260", "b4_264", "b4_265", "b4_275", "b4_277"]

        man = manager.get_manager()


        for name, num, incr in (["c2", 252, 3],
                                ["d2", 113, 3],
                                ["b1", 3, 5],
                                ["b2", 100, 5],
                                ["b3", 160, 5],
                                ["b4", 280, 5]):

            while True:
                gen = "%s_%s" % (name, num)
                if not man.can_load("hexLG13", gen):
                    print "FAILED TO LOAD GEN", gen
                    break

                gens.append(gen)
                num += incr

        all_players += [dp(g, 800, 3) for g in gens + new_c1 + others + recent]

        gen_elo(match_info, all_players, filename,
                move_generator=move_generator_hex13)