/latplan-fosae

First Order State Auto Encoder implementation for Latplan

Primary LanguagePython

./img/latplanlogo-simple.svg.png

LatPlan FOSAE

This repository contains a reimplementation of First Order State Autoencoder in the following paper:

  • Asai, M.: 2019. Unsupervised Grounding of Plannable First-Order Logic Representation from Images

It is rebased on the latest Latplan code base.

NEWS : Pretrained weights are available in https://github.com/guicho271828/latplan-fosae/releases .

Setup

On Ubuntu, prerequisites can be installed via launching ./install.sh (It requires sudo several times). OSX users should be able to find the equivalents in homebrew. We listed the requirements.

General Requirements

Python 3.5 or later is required.

  • mercurial g++ cmake make python flex bison g++-multilib — these are required for compiling Fast Downward.
  • git build-essential automake libcurl4-openssl-dev — these are required for compiling [Roswell](http://roswell.github.io/). OSX users should use brew install roswell.
  • gnuplot — for plotting.
  • parallel — for running some scripts.

Python Dependency Installation with Anaconda / Miniconda (recommended)

anaconda / miniconda (https://docs.conda.io/en/latest/miniconda.html) is a python version dependency & mini environment management system. We recommend using miniconda, as it is smaller.

Run conda env create -f environment.yml then conda activate latplan.

Also run ./setup.py install, which install latplan.

Python Dependency Installation without Anaconda / Miniconda on Ubuntu

You should install python3-pip and python3-pil from the APT repository. Afterwards, run ./setup.py install, which installs latplan.

Running

Next, customize the following files for your job scheduler before running. The job submission commands are stored in a variable $common, which by default has the value like jbsub -mem 32g -cores 1+1 -queue x86_24h. You also need to uncomment the commands to run. By default, everything is commented out and nothing runs.

# You first need to set up a dataset.
./setup-dataset.sh

# This will train the FOSAE for Blocksworld with 5 objects, 3 towers.
# It uses the best hyperparameter tuning result from the log file we stored in the repository.
# See blocks-5-3/blocksworld_FirstOrderAE_blocks-5-3_None_None_None_10000/grid_search.log
./train_all_blocks.sh 5 3
./train_all_blocks.sh 4 4

# This will train it for hand-crafted 8 puzzle object vectors.
./train_all_puzzle.sh

# This will train FOSAE with an exhaustive list of U, A, P combinations, reproducing Figure 8 and Table 1.
./train_all_contour.sh

Code detail

The code is largely same as Latplan. The main code for FOSAE lies here: https://github.com/guicho271828/latplan-fosae/blob/master/latplan/model.py#L1034

Gallery

./img/render_test.png

./img/render_test_each.png