def add_parser(subparsers): """Create brute force parser""" parser = subparsers.add_parser( 'brute', help="""Compute equilibria by sampling all profiles""", description="""Samples profiles from the entire game, and then runs standard equilibrium finding. For games with a large number of players, a reduction should be specified. A list of is returned where each element has an "equilibrium" and the corresponding "regret" in the full game.""") parser.add_argument( 'scheduler', metavar='<sched-spec>', help="""A scheduler specification, see `egta spec` for more info.""") parser.add_argument( '--regret-thresh', metavar='<reg>', type=float, default=1e-3, help="""Regret threshold for a mixture to be considered an equilibrium. (default: %(default)g)""") parser.add_argument( '--dist-thresh', metavar='<norm>', type=float, default=0.1, help="""Norm threshold for two mixtures to be considered distinct. (default: %(default)g)""") parser.add_argument( '--supp-thresh', metavar='<min-prob>', type=float, default=1e-4, help="""Minimum probability for a strategy to be considered in support. (default: %(default)g)""") parser.add_argument( '--restrict', '-r', metavar='<restriction-file>', type=argparse.FileType('r'), help="""Specify an optional restricted game to sample instead of the whole game. Only deviations from the restricted strategy set will be scheduled.""") parser.add_argument( '--one', action='store_true', help="""Guarantee that an equilibrium is found. This may take up to exponential time.""") parser.add_argument( '--min-reg', action='store_true', help="""Return the minimum regret profile found, if none were found below regret threshold.""") utils.add_reductions(parser) parser.run = run
def add_parser(subparsers): """Create parser for tracing""" parser = subparsers.add_parser( "trace", help="""Compute trace of equilibria between two games""", description="""Computes traces of equilibria as the probability of mixing between two games changes. This uses quiesce as a subroutine and sparsely schedules profiles so that this can be done without having to fully sample either game. The results is a list of traces, where each trace is a list of the mixture probability, the equilibriium, and the regret. In order to allow this to work on games with singleton players, games are "normalized" by removing them prior to scheduling. Thus, any roles with only one strategy should be omitted from reductions, and will also be omitted from equilibria as their answer is trivial.""", ) parser.add_argument( "sched0", metavar="<sched-spec-0>", help="""The scheduler specification for the game when t is 0. See `egta spec` for more info.""", ) parser.add_argument( "sched1", metavar="<sched-spec-1>", help="""The scheduler specification for the game when t is 1. See `egta spec` for more info.""", ) parser.add_argument( "--regret-thresh", metavar="<reg>", type=float, default=1e-3, help="""Regret threshold for a mixture to be considered an equilibrium. This can't be strictly enforced as the ODE that this solves has some numerical instability, and there is no way to guarantee the equilibria stays small. (default: %(default)g)""", ) parser.add_argument( "--dist-thresh", metavar="<norm>", type=float, default=0.1, help="""Norm threshold for two mixtures to be considered distinct. (default: %(default)g)""", ) parser.add_argument( "--max-restrict-size", metavar="<support>", type=int, default=3, help="""Support size threshold, beyond which restricted games are not required to be explored. (default: %(default)d)""", ) parser.add_argument( "--num-equilibria", metavar="<num>", type=int, default=1, help="""Number of equilibria requested to be found. This is mainly useful when game contains known degenerate equilibria, but those strategies are still useful as deviating strategies. (default: %(default)d)""", ) parser.add_argument( "--num-backups", metavar="<num>", type=int, default=1, help="""Number of backup restricted strategy set to pop at a time, when no equilibria are confirmed in initial required set. When games get to this point they can quiesce slowly because this by default pops one at a time. Increasing this number can get games like tis to quiesce more quickly, but naturally, also schedules more, potentially unnecessary, simulations. (default: %(default)d)""", ) parser.add_argument( "--dev-by-role", action="store_true", help="""Explore deviations in role order instead of all at once. By default, when checking for beneficial deviations, all role deviations are scheduled at the same time. Setting this will check one role at a time. If a beneficial deviation is found, then that restricted strategy set is scheduled without exploring deviations from the other roles.""", ) parser.add_argument( "--style", default="best", choices=["fast", "more", "best", "one"], help="""Style of equilibrium finding to use. `fast` is the fastests but least thorough, `one` will guarantee an equilibrium is found in potentially exponential time.""", ) parser.add_argument( "--procs", type=int, default=2, metavar="<num-procs>", help="""Number of process to use. This will speed up computation if doing computationally intensive things simultaneously, i.e. nash finding or ode solving. (default: %(default)d)""", ) utils.add_reductions(parser) parser.run = run
def add_parser(subparsers): """Create innerloop parser""" parser = subparsers.add_parser( "quiesce", help="""Compute equilibria using the quiesce procedure""", description="""Samples profiles from small restricted strategy sets, expanding set support by best responses to candidate restricted game equilibria. For games with a large number of players, a reduction should be specified. The result is a list where each element specifies an "equilibrium".""", ) parser.add_argument( "scheduler", metavar="<sched-spec>", help="""A scheduler specification, see `egta spec` for more info.""", ) parser.add_argument( "--regret-thresh", metavar="<reg>", type=float, default=1e-3, help="""Regret threshold for a mixture to be considered an equilibrium. (default: %(default)g)""", ) parser.add_argument( "--dist-thresh", metavar="<norm>", type=float, default=0.1, help="""Norm threshold for two mixtures to be considered distinct. (default: %(default)g)""", ) parser.add_argument( "--max-restrict-size", metavar="<support>", type=int, default=3, help="""Support size threshold, beyond which restricted games are not required to be explored. (default: %(default)d)""", ) parser.add_argument( "--num-equilibria", metavar="<num>", type=int, default=1, help="""Number of equilibria requested to be found. This is mainly useful when game contains known degenerate equilibria, but those strategies are still useful as deviating strategies. (default: %(default)d)""", ) parser.add_argument( "--num-backups", metavar="<num>", type=int, default=1, help="""Number of backup restricted strategy set to pop at a time, when no equilibria are confirmed in initial required set. When games get to this point they can quiesce slowly because this by default pops one at a time. Increasing this number can get games like tis to quiesce more quickly, but naturally, also schedules more, potentially unnecessary, simulations. (default: %(default)d)""", ) parser.add_argument( "--dev-by-role", action="store_true", help="""Explore deviations in role order instead of all at once. By default, when checking for beneficial deviations, all role deviations are scheduled at the same time. Setting this will check one role at a time. If a beneficial deviation is found, then that restricted strategy set is scheduled without exploring deviations from the other roles.""", ) parser.add_argument( "--style", default="best", choices=["fast", "more", "best", "one"], help="""Style of equilibrium finding to use. `fast` is the fastests but least thorough, `one` will guarantee an equilibrium is found in potentially exponential time.""", ) parser.add_argument( "--procs", type=int, default=2, metavar="<num-procs>", help="""Number of process to use. This will speed up computation if doing computationally intensive things simultaneously, i.e. nash finding. (default: %(default)d)""", ) utils.add_reductions(parser) parser.run = run