Interactive visualizer
The same six algorithms, running in your browser. Click & drag to draw walls; drag the green start and red goal. Then press Run.
start
goal
wall
expanded
frontier
path
Pick an algorithm and press Run.
The framework
Implement three things and any algorithm can solve your problem:
#include "symphony/symphony.h"
using namespace symphony;
struct MyState : State {
std::string key() const override; // canonical id for de-duplication
};
struct MyProblem : Problem {
std::shared_ptr<State> initial_state() const override;
bool goal_test(const State&) const override;
std::vector<std::shared_ptr<Action>> actions(const std::shared_ptr<State>&) const override;
double heuristic(const State&) const override; // optional; 0 = uninformed
};
MyProblem p;
auto s = create_search(Algorithm::ASTAR, &p);
auto goal = s->search();
reconstruct(goal).print(std::cout);
std::cout << s->stats().expanded << " nodes expanded\n";
- Six strategies behind one
create_search()factory. - Graph search with proper visited-set de-duplication (keyed by
State::key()). - Optimal BFS / UCS / A* (with an admissible heuristic); search stats for every run.
- Three example problems: grid maze, vacuum world, sliding 8-puzzle.
- Header-only includes + a single
search.cpp; CMake build and a test suite.