sokoloowski / psi-lab02-state-space-search

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Lab 2. State Space Search

wakatime

TODO:

Fill missing code according to the TODO: comments in the following files:

  • solvers/generic/uninformed.py
  • solvers/generic/best_first.py
  • solvers/iddfs.py
  • solvers/idastar.py
  • problems/grid_pathfinding/heuristics/euclidean_heuristic.py
  • problems/grid_pathfinding/heuristics/manhattan_heuristic.py
  • problems/grid_pathfinding/heuristics/diagonal_heuristic.py
  • problems/n_puzzle/heuristics/n_puzzle_tiles_out_of_place_heuristic.py
  • problems/n_puzzle/heuristics/n_puzzle_manhattan_heuristic.py
  • problems/blocks_world/blocks_world_heuristic.py
  • problems/blocks_world/blocks_world_problem.py
  • problems/blocks_world/blocks_world_action.py

Useful links:

Grading

How To Submit Solutions

  • Clone repository: git clone:
    git clone <repository url>
  • Solve the exercises
    • use MiniZincIDE, whatever
  • Commit your changes
    git add <path to the changed files>
    git commit -m <commit message>
  • Push changes to the gitlab master branch
    git push -u origin master

The rest will be taken care of automatically. You can check the GRADE.md file for your grade / test results. Be aware that it may take some time (up to one hour) till this file

How To Run

This class requires Python with version at least 3.8. Recommended way to run is to create a virtual environment first:

  • python -m venv state-search
  • source state-search/bin/activate

Then install required packages:

  • pip install -r requirements.txt

Finally you can run a solver:

  • python solve.py -a <algorithm> -p <problem> -h <heuristic> <path_to_instance>, e.g.
  • python solve.py -p rush_hour -a astar -h rush_hour_indirect problems/rush_hour/instances/81.txt (every problem has several instances in the instances directory)

You can also run a benchmark:

  • python benchmark.py -p <problem> -t timeout <path_to_instance>, e.g.
  • python benchmark.py -p rush_hour problems/rush_hour/instances/54.txt

If you run script with incorrect arguments, you will get some helpful info ;)

Project Structure

.
├── base                # API for problem and solver classes
├── problems            # List of defined problems (place to define problems)
│   ├── ...
│   ├── n_puzzle        # directory with a problem
│   │   ├── instances   # directory with problem instances
│   │   └── ...
│   └── ...
├── solvers             # directory with algorithms
│   ├── generic         # code shared by several algorithms
│   ├── bfs.py          # example of an algorithm
│   └── ...
├── tree                # search tree representation
├── utils               # various utilities
├── solve.py            # solve tool (run as a script)
├── benchmark.py        # benchmark tool (run as a script)
└── cli_config.py       # configuration of the cli tools (do not touch)

About


Languages

Language:Python 100.0%