User Interface
AlphaZero.UserInterface
— ModuleThe default user interface for AlphaZero.
The user interface is fully separated from the core algorithm and can therefore be replaced easily.
Session
AlphaZero.UserInterface.Session
— TypeSession{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 sessionreport
is the current session report, with typeSessionReport
AlphaZero.UserInterface.Session
— MethodSession(::Experiment; <optional kwargs>)
Create a new session from an experiment.
Optional keyword arguments
dir="sessions/<experiment-name>"
: session directory in which all files and reports are saved.autosave=true
: if set tofalse
, the session won't be saved automatically nor any file will be generatednostdout=false
: disables logging on the standard output when set totrue
save_intermediate=false
: if set to true (along withautosave
), 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.
AlphaZero.UserInterface.resume!
— Functionresume!(session::Session)
Resume a previously created or loaded session. The user can interrupt training by sending a SIGKILL signal.
AlphaZero.UserInterface.save
— Functionsave(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
.
AlphaZero.UserInterface.SessionReport
— TypeSessionReport
The full collection of statistics and benchmark results collected during a training session.
Fields
iterations
: vector of $n$ iteration reports with typeReport.Iteration
benchmark
: vector of $n+1$ benchmark reports with typeReport.Benchmark
Explorer
AlphaZero.UserInterface.explore
— Functionexplore(::AbstractPlayer, ::AbstractGameEnv; [memory])
explore(::AbstractPlayer, ::AbstractGameSpec; [memory])
Start a command interpreter to explore the internals of a player through interactive play.
The memory
argument is an optional reference to a memory buffer. When provided, additional state statistics are displayed.
Commands
The following commands are currently implemented:
do [action]
: make the current player performaction
. By default, the action of highest score is played.explore [num_sims]
: runnum_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.