DZIGA
Documentation for DZIGA.
DZIGA.CityGraphDZIGA.best_first_searchDZIGA.get_best_moveDZIGA.get_junction_scoreDZIGA.get_upper_boundDZIGA.greedy_bstDZIGA.greedy_planner
DZIGA.CityGraph — TypeCityGraphStore the junctions and streets of a City as an adjacency matrix for easy traversal and lookup. Given a 'City', produce a adj_matrix adjacency matrix dictionary with {endpointA : {endpointB : Street}} as key-value pairs. Also hashes all Junction objects in the city by id (and vice versa) for easy lookup.
Fields
matrix::Dict{Int,Dict{Int,Street}} a dictionary of dictionaries where the first key is the starting junction and the ending junction, which maps to theStreet` value.ids_to_junctions::Dict{Int,Junction}a dictionary ofJunctions by junction idjunctions_to_ids::Dict{Junction,Int}a dictionary of junction ids byJunction
DZIGA.best_first_search — Methodbest_first_search(visited::Dict{Int,Int}, city_graph::CityGraph, city::City) ::Vector{Int}Implements best-first search with a special heuristic function. Returns an itinerary for a single car.
DZIGA.get_best_move — Methodget_best_move(time_elapsed, visited, city, city_graph, current_junction, candidates) ::Pair{Int,Street}Returns the best move given a set of candidates. Uses a heuristic that rewards previously-unvisited streets.
DZIGA.get_junction_score — Methodget_junction_score(junction, street, city_graph, visited, total_duration, time_elapsed) ::NumberImplementation of the heuristic function f(x) that rewards previously-unvisited streets and penalizes time-consuming streets, as described more fully in the final writeup. Returns the heuristic score of input junction.
DZIGA.get_upper_bound — Methodget_upper_bound(city::City) ::IntReturn the greatest possible distance you can traverse for the given City by summing the longest streets first. The summing concludes once the total duration of the streets exceeds the total duration of the simulation * total number of cars in the City.
DZIGA.greedy_bst — Methodgreedy_bst(city::City) ::IntUses a best-first search to greedily generate a plan that covers the greatest possible distance you can traverse for the given City across all City.nb_cars.
DZIGA.greedy_planner — Methodgreedy_planner(city::City) ::IntDZGIA's state of the art planner for the HashCode 2014 challenge. Returns a Solution that greedily covers the greatest possible distance you can traverse for the given City. Calls greedy_bst.