indylab / tabular_xdo

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Tabular XDO

Installation

(Tested on Ubuntu 20.04)

Overview

  1. Clone the repo
  2. Set up a Conda env
  3. Install OpenSpiel

Clone repo with git submodules

git clone --recursive git@github.com:indylab/tabular_xdo.git
cd tabular_xdo

If you've already cloned this repo but not the submodules, you can clone them with:

git submodule update --init --recursive

Set up Conda environment

After installing Anaconda, enter the repo directory and create the new environment:

conda env create -f environment.yml
conda activate grl

Install Python modules

1. DeepMind OpenSpiel (included dependency)

DeepMind's OpenSpiel is used for poker game logic as well as tabular game utilities.

# Starting from the repo root
cd dependencies/open_spiel
export BUILD_WITH_ACPC=ON # to compile with the optional universal poker game variant
./install.sh
pip install -e . # This will start a compilation process. Will take a few minutes.
cd ../..

Installation is now done!

Advanced Installation Notes (Optional)

If you need to compile/recompile OpenSpiel without pip installing it. Perform the following steps with your conda env * active*. (The conda env needs to be active so that OpenSpiel can find and compile against the python development headers in the env. Python version related issues may occur otherwise):

export BUILD_WITH_ACPC=ON # to compile with the optional universal poker game variant
mkdir build
cd build
CXX=clang++ cmake -DPython_TARGET_VERSION=3.6 -DCMAKE_CXX_COMPILER=${CXX} -DPython3_FIND_VIRTUALENV=FIRST -DPython3_FIND_STRATEGY=LOCATION ../open_spiel
make -j$(nproc)
cd ../../..

To import OpenSpiel without using pip, add OpenSpiel directories to your PYTHONPATH in your ~ /.bashrc (more details here):

# Add the following lines to your ~/.bashrc:
# For the python modules in open_spiel.
export PYTHONPATH=$PYTHONPATH:/<path_to_open_spiel_submodule>
# For the Python bindings of Pyspiel
export PYTHONPATH=$PYTHONPATH:/<path_to_open_spiel_submodule>/build/python

Running Experiments

To replicate figure 3.a, run the following commands:

python xdo_psro_fixed_population_comparison.py --num_strats 2
python xdo_psro_fixed_population_comparison.py --num_strats 10
python xdo_psro_fixed_population_comparison.py --num_strats 20
python xdo_psro_fixed_population_comparison.py --num_strats 50
python xdo_psro_fixed_population_comparison.py --num_strats 100
python xdo_psro_fixed_population_comparison.py --num_strats 300
python xdo_psro_fixed_population_comparison.py --num_strats 1000

To replicate figure 3.b, run the following commands:

python main_experiments.py --algorithm xdo --game_name leduc_poker
python main_experiments.py --algorithm psro --game_name leduc_poker

To replicate figure 3.c and figure 4.a, run the following commands:

python main_experiments.py --algorithm xdo --game_name leduc_poker_dummy
python main_experiments.py --algorithm psro --game_name leduc_poker_dummy
python main_experiments.py --algorithm cfr --game_name leduc_poker_dummy
python main_experiments.py --algorithm xfp --game_name leduc_poker_dummy

About

License:MIT License


Languages

Language:Jupyter Notebook 91.6%Language:Python 8.4%