Git Product home page Git Product logo

route_finder's Introduction

route_finder

This is Implemention of A * search algorithm that can find a route between any two cities.

Graph

Usage

The program will take exactly commandline arguments as follows:

main_file input_filename origin_city destination_city heuristic_filename

An example command line is:

main.py input1.txt Munich Berlin (For doing Uninformed search) 

or

main.py input1.txt Munich Berlin h_kassel.txt (For doing Informed search) 

Description

The program will compute a route between the origin city and the destination city, and will print out both the length of the route and the list of all cities that lie on that route. It should also display the number of nodes expanded. For example,

main.py input1.txt Bremen Kassel should have the following output:

nodes expanded: 8
distance: 297 km
route:
bremen to hannover, 132 km
hannover to kassel, 165 km 

and main.py input1.txt London Kassel should have the following output:

nodes expanded: 5
distance: infinity
route: none

If a heuristic file is provided then program perform Informed search. The heuristic file gives the estimate of what the cost could be to get to the given destination from any start state (note this is just an estimate). In this case the command line would look like

main.py input1.txt Munich Kassel h_kassel.txt

Here the last argument contains a text file what has the heuristic values for every state wrt the given destination city (note different destinations will need different heuristic values). For example, you have been provided a sample file h_kassel.txt which gives the heuristic value for every state (assuming kassel is the goal). The program uses this information to reduce the number of nodes it ends up expanding. Other than that, the solution returned by the program is same as the uninformed version. For example,

find_route input1.txt Bremen Kassel h_kassel.txt should have the following output:

nodes expanded: 3
distance: 297 km
route:
bremen to hannover, 132 km
hannover to kassel, 165 km 

route_finder's People

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.