/treesearchsolverpy

A solver based on heuristic tree search

Primary LanguagePythonMIT LicenseMIT

TreeSearchSolver (Python)

A solver based on heuristic tree search.

This is the Python3 version of the C++ package fontanf/treesearchsolver.

treesearch

image source

Description

The goal of this repository is to provide a simple framework to quickly implement algorithms based on heuristic tree search.

Solving a problem only requires a couple hundred lines of code (see examples).

Algorithms:

  • Greedy greedy
  • Best First Search best_first_search
  • Iterative Beam Search iterative_beam_search

Examples

Travelling salesman problem

Usage, running examples from command line

Install

pip3 install treesearchsolverpy

Running an example:

mkdir -p data/travellingsalesman/instance
python3 -m examples.travellingsalesman -a generator -i data/travellingsalesman/instance
python3 -m examples.travellingsalesman -a iterative_beam_search -i data/travellingsalesman/instance_50.json

Update:

pip3 install --upgrade treesearchsolverpy

Usage, Python library

See examples.