Monday, January 15, 2018

Get Open AI (gym) up and running on Windows Subsystem Linux

Quick list of steps to get Open AI running on Windows

1. Activate WSL (Bash on Windows). Refer this for detailed steps.


2. Run the following commands on Bash. These replace the default libzmq3 installation with one having a bug-fix.

pip uninstall pyzmq
sudo add-apt-repository ppa:aseering/wsl
sudo apt-get update
sudo apt-get install libzmq3 libzmq3-dev
export LD_LIBRARY_PATH=/usr/lib/x86_64-linux-gnu
pip install --no-use-wheel -v pyzmq
pip install jupyter

3. Install dependencies for gym:

sudo apt-get install -y build-essential
sudo apt-get install -y zlib1g-dev liblapack-dev libatlas-base-dev libopenblas-dev libhdf5-dev libedit-dev
pip install gym[all]








Sunday, January 14, 2018

Heuristic Sudoku Solver

A quick google search will provide you with numerous Sudoku  solvers and algorithms including ones using backtracking, exploratory search, etc. Such algorithms can find a solution (if exists) to a Sudoku problem even if it is not humanly possible find deterministic cell values. Of course, a brute force approach by a human being will probably eventually yield the correct solution, but for this post I consider the approach used to selectively use constraints to determine the correct cell values one by one. One can trivially reduce a Sudoku problem to one that doesn't have enough values to apply constraints and find correct values in a deterministic way.

This solver uses the same constraint based approaches to selectively determine the solution cell by cell. In other words, I have tried to make this solver akin to human heuristic solving and any sudoku problem solvable by this is guaranteed to be solvable by a human in the deterministic approach described above. Overall, this solver can double as a classifier of sudoku puzzles into difficulty levels based on certain parameters. Code available here.