Skip to content

hexken/h-levin

Folders and files

NameName
Last commit message
Last commit date

Latest commit

b13e9a6 · Jun 28, 2024
May 8, 2021
Jun 28, 2024
May 11, 2020
Sep 2, 2020
Feb 3, 2021
Jun 27, 2024
Feb 3, 2021
Jan 5, 2021
May 8, 2021
Jan 5, 2021
Jan 5, 2021
May 8, 2021
Jan 5, 2021
Jan 5, 2021
May 8, 2021
Jan 5, 2021
Feb 3, 2021
May 8, 2021
Feb 3, 2021
Aug 14, 2021
Aug 14, 2021
Aug 14, 2021
Jun 27, 2024
Feb 3, 2021
Feb 3, 2021
Feb 3, 2021
May 8, 2021
Dec 14, 2020
Dec 14, 2020
May 8, 2021
Dec 14, 2020
Dec 14, 2020
May 8, 2021
May 8, 2021
May 8, 2021
May 8, 2021
May 8, 2021
May 8, 2021
May 8, 2021
Dec 14, 2020
Dec 14, 2020
Feb 3, 2021
Feb 3, 2021
Feb 3, 2021
May 8, 2021
Feb 3, 2021
Feb 3, 2021
Feb 3, 2021
May 8, 2021
Feb 3, 2021
Feb 3, 2021
May 8, 2021
Feb 3, 2021
Aug 14, 2021
Aug 14, 2021
Aug 14, 2021
Jun 27, 2024
Jun 27, 2024
Jun 27, 2024

Repository files navigation

Implementation of the algorithms described in "Policy-Guided Heuristic Search with Guarantees" 
by L. Orseau and L. Lelis, published at AAAI'21.

PHS is dubbed BFSLevin (see src/bfs_levin.py). The same class is used to implement LTS, the 
tree search algorithm that uses a policy to guide search (see the paper "Single-Agent Policy 
Tree Search with Guarantees" by L. Orseau, L. Lelis, T. Lattimore, and T. Weber for details).

PHS can be trained for a small set of The Witness puzzles with the following command:

src/main.py --learned-heuristic 
			-a LevinStar 
			-l LevinLoss 
			-m model_test_witness 
			-p problems/witness/puzzles_3x3/ 
			-b 2000 
			-d Witness 
			--learn

The program will save a trained neural model with the name model_test_witness, which can be
used solve other instances with the following command (here we are solving the same set of
instances used to train the model).

python3 src/main.py --learned-heuristic 
					-a LevinStar 
					-l LevinLoss 
					-m model_test_witness 
					-p problems/witness/puzzles_3x3/ 
					-b 2000 
					-d Witness

Here are the options of search algorithms implemented:

AStar (A*, see file src/search/a_star.py)
GBFS (Greedy-Best First Search, see file src/search/gbfs.py)
PUCT (PUCT, see file src/search/puct.py)
LevinStar (PHS, see file src/search/bfs_levin.py)
Levin (LTS, see file src/search/bfs_levin.py)

The instances used to train and test the models are availble in the folder 'problems':

Sokoban
	Train: problems/sokoban/train_50000
	Test: problems/sokoban/train_10000

Sliding-Tile Puzzle
	Training: problems/stp/puzzles_5x5_train
	Test: problems/stp/puzzles_5x5_test
	
Witness
	Training: problems/witness/puzzles_4x4_50k_train
	Test: problems/witness/puzzles_4x4_50k_test