Expand description
This is the utility module of the NPC engine, containing helpful utility code.
It contains the following features:
- A helper trait OptionDiffDomain that can be used when Diffs are just copies of the State.
- Two executors (update loops), SimpleExecutor and ThreadedExecutor, that implement the execution logic of a Domain beyond planning itself, and related abstractions.
- A simple implementation of feed-forward leaky ReLU neurons (Neuron) and corresponding simple networks (NeuralNetwork), providing learning based on back-propagation (NeuralNetwork::train).
- Simple 2-D coordinates (Coord2D) and direction (Direction) implementations.
- Helper functions to plot search trees: plot_tree_in_tmp and plot_tree_in_tmp_with_task_name.
- Helper functions to simplify functional programming with tuples: keep_first and keep_second, and their mutable versions keep_first_mut and keep_second_mut.
Structs§
- Coord2D
- A 2-D integer coordinate type.
- Direction
Converter - A helper struct to apply direction to coordinates.
- Neural
Network - A simple neural network with I inputs and one hidden layer of H neurons.
- Neuron
- A simple leaky ReLU neuron with I inputs.
- Simple
Executor - A single-threaded generic executor.
- Threaded
Executor - A multi-threaded generic executor.
- YDown
- Down is positive.
- YUp
- Up is positive.
Enums§
- Direction
- A direction type.
Constants§
- DIRECTIONS
- All directions.
Traits§
- Executable
Domain - A domain for which we can run a generic executor.
- Executor
State - User-defined methods for the executor.
- Executor
State Global - User-defined methods for the executor, where world and planner states are different.
- Executor
State Local - User-defined methods for the executor, where world and planner states are similar.
- Global
Domain - A domain that provides a global state, out of which a local state for the planning can be derived.
- Option
Diff Domain - In case your domain has a Diff that is an Option of its State, provides helper functions to retrieve the state in your tasks.
- YUpDown
- A helper trait that tells whether up and down are positive or negative.
Functions§
- keep_
first - Returns a reference to the first element of a tuple reference.
- keep_
first_ mut - Returns a mutable reference to the first element of a mutable tuple reference.
- keep_
second - Returns a reference to the second element of a tuple reference.
- keep_
second_ mut - Returns a mutable reference to the second element of a mutable tuple reference.
- plot_
tree_ in_ tmp - Plots the MCTS tree using graphviz’s dot format.
- plot_
tree_ in_ tmp_ with_ task_ name - Plots the MCTS tree using graphviz’s dot format, with a filename derived from an active task.
- run_
simple_ executor - Creates and runs a single-threaded executor, initializes state and task queue from the
S
trait. - run_
threaded_ executor - Creates and runs a multi-threaded executor, initializes state and task queue from the
S
trait.
Type Aliases§
- Direction
ConverterY Down - Apply direction to coordinates with up being negative.
- Direction
ConverterY Up - Apply direction to coordinates with up being positive.