Pinyon is a library for research and development of search and solving algorithms for (perfect information) simultaneous move, stochastic games. The code emphasizes:
This library uses the template metaprogramming features of C++ to eliminate the cost of game/alorithm/etc agnosticism of similar libraries like alpha-zero-general. Pinyon is then fully capable of tasks like powering expensive reinforcement-learning projects or server analysis.
The game, evaluation function, and search algorithm are liberally interchangible. The interface was designed from the beginning to unify the major methods. Serveral other basic utilities are provided as well.
Virtually any game can be augmented with a simple and fast monte-carlo search function, providing guarantees of convergence to Nash Equilibrium.
The interface uses a template convention that facilitates the layering of multiple utilities to trivialize the implementation of otherwise intricate scripts, exemplified by TODO (pkmn-pinyon-test script to replicate q-value matrices of bull.cc
via a depth=1 FullTraversal
backed by two layer AlphaBeta
+ Exp3
model at leaf nodes.)
Various implementations of the same object can be quickly and automatically benchmarked for cheaper compute. See /benchmarking
.
Many tasks can be settled with a small script. Once a process is described in terms of the interface it's usually almost complete.
This is a header library that only depends on the GNU Multiple Precision Library. Inclusion into projects is done via cmake, i.e. add_directory(extern/pinyon)
and #include <pinyon.h>
.
The library is extensively documented and the points above are expanded therein. The organization of the abstraction/modularity layers is reflected by the directory structure.
The interface is codified with the use of C++20 Concepts
which serve as another for of documentation.
The tests and benchmarking tools can be built via
sudo apt install libgmp3-dev
git clone --recurse-submodules https://github.com/baskuit/pinyon
cd pinyon
mkdir build
cd build
cmake ..
make
The library comes with several tests to check the correctness of the algorothm implementations, among other things. To run, simply uncomment the #tests
portion of the CMakeLists; It is a script that builds everything in /tests
and marks it as such. Then simply run
cd build
ctest tests