User Interface

AlphaZero.UserInterfaceModule

The default user interface for AlphaZero.

The user interface is fully separated from the core algorithm and can therefore be replaced easily.

source

Session

AlphaZero.UserInterface.SessionType
Session{Env}

A wrapper on an AlphaZero environment that adds features such as:

  • Logging and plotting
  • Loading and saving of environments

In particular, it implements the Handlers interface.

Public fields

  • env::Env is the environment wrapped by the session
  • report is the current session report, with type SessionReport
source

Session CLI (first iteration)

AlphaZero.UserInterface.SessionMethod
Session(::Type{Game}, ::Type{Net}, params, netparams) where {Game, Net}

Create a new session using the given parameters, or load it from disk if it already exists.

Arguments

  • Game is the type ot the game that is being learnt
  • Net is the type of the network that is being used
  • params has type Params
  • netparams has type Network.HyperParams(Net)

Optional keyword arguments

  • dir: session directory in which all files and reports are saved; this argument is either a string or nothing (default), in which case the session won't be saved automatically and no file will be generated
  • autosave=true: if set to false, the session won't be saved automatically nor any file will be generated
  • nostdout=false: disables logging on the standard output when set to true
  • benchmark=[]: vector of Benchmark.Duel to be used as a benchmark
  • save_intermediate=false: if set to true (along with autosave), all intermediate training environments are saved on disk so that the whole training process can be analyzed later. This can consume a lot of disk space.
source
Session(env::Env[, dir])

Create a session from an initial environment.

  • The iteration counter of the environment must be equal to 0
  • If a session directory is provided, this directory must not exist yet

This constructor features the optional keyword arguments autosave, nostdout, benchmark and save_intermediate.

source
AlphaZero.UserInterface.saveFunction
save(session::Session)

Save a session on disk.

This function is called automatically by resume! after each training iteration if the session was created with autosave=true.

source

Explorer

AlphaZero.UserInterface.ExplorerType
Explorer{Game}

A command interpreter to explore the internals of a player through interactive play.

Constructors

Explorer(player::AbstractPlayer, game=nothing; memory=nothing)

Build an explorer to investigate the behavior of player in a given game (by default, in the initial state). Optionally, a reference to a memory buffer can be provided, in which case additional state statistics will be displayed.

Explorer(env::Env, game=nothing; arena_mode=false)

Build an explorer for the MCTS player based on neural network env.bestnn and on parameters env.params.self_play.mcts or env.params.arena.mcts (depending on the value of arena_mode).

Commands

The following commands are currently implemented:

  • do [action]: make the current player perform action. By default, the action of highest score is played.
  • explore [num_sims]: run num_sims MCTS simulations from the current state (for MCTS players only).
  • go: query the user for a state description and go to this state.
  • flip: flip the board according to a random symmetry.
  • undo: undo the effect of the previous command.
  • restart: restart the explorer.
source

Explorer