Find a path between two state capitals

Assignment Help Python Programming
Reference no: EM133020967

Problem description:

Consider the graph presented below (fig. 1). Each node represents a single state (or the District of Columbia (DC)). If two states are neighbors, there is an edge between them.

561_figure.jpg

Figure 1: A graph representing all 48 contiguous US states and District of Columbia.

Assume that edge weights represent driving distances between state capitals.

Your task is to implement in Python two informed search algorithms:

• Greedy Best First Search algorithm, and
• A* algorithm,

and apply them to find a path between two state capitals using provided data.

Your program should:
• Accept two (2) command line arguments corresponding to two states / state capitals (initial and goal states) so your code could be executed with

python cs480_P01_AXXXXXXXX.py INITIAL GOAL

where:

• cs480_P01_AXXXXXXXX.py is your python code file name,
• INITIAL is the label/name of the initial state,
• GOAL is the label/name of the initial state.

If the number of arguments provided is NOT two (none, one, or more than two), your program should display the following error message:

ERROR: Not enough or too many input arguments. and exit.

• Load and process both input data files provided (assume that input data files are ALWAYS in the same folder as your code - this is REQUIRED!). Make sure your program is flexible enough to accommodate different input data sets (with a different graph of states and distances). Your submission will be tested using a different set of files!
• Run Greedy Best First Search and A* algorithms searches to find a path between INITIAL and GOAL states and measure execution time (in seconds) for both methods.
• Report results on screen in the following format:

Last Name, First Name, AXXXXXXXX solutiocxn:
Initial state: INITIAL
Goal state: GOAL

Greedy Best First Search:
Solution path: STATE1, STATE2, STATE3, ..., STATEN-1, STATEN
Number of states on a path: X1
Path cost: Y1
Execution time: T1 seconds

A* Search:
Solution path: STATE1, STATE2, STATE3, ..., STATEN-1, STATEN
Number of states on a path: X2
Path cost: Y2
Execution time: T2 seconds

Attachment:- Programming Assignment.rar

Reference no: EM133020967

Questions Cloud

What is the size of the monthly payment : What is the size of the monthly payment - $14,000 loan at 6% compounded monthly is repaid by monthly payments over four years
Determine how much is the stock worth : Assume that the annual dividend grows at a constant rate of 8% indefinitely instead of the supernormal growth. How much is the stock worth
Is the proposed change in policy worth implementing : The company finances working capital from an overdraft at a cost of 15 per cent. Is the proposed change in policy worth implementing
Prepare the current liabilities section of balance sheet : Concord is involved in a lawsuit. Legal counsel feels it is probable Concord will pay damages of $28,000 in 2022. Prepare the current liabilities section
Find a path between two state capitals : Find a path between two state capitals - algorithms searches to find a path between INITIAL and GOAL states and measure execution time (in seconds)
Compute product costs and period costs : The Putney Company reports the following information: Depreciation on factory equipment 4,700. Compute product costs and period costs
What is the most you should pay for the stock now : You are considering buying common stock in Grow On, Inc. The firm yesterday paid a dividend of $5.30. What is the most you should pay for the stock now
What is the breakeven number of bed days : What if the number of additional bed days were as low as 80 or as high as 175? What is the breakeven number of bed days
Determine what kuhn company WACC will be for this project : The company is projected to grow at a constant rate of 9.2%, and they face a tax rate of 40%. Determine what Kuhn Company's WACC will be for this project

Reviews

Write a Review

Python Programming Questions & Answers

  Write the python code that displays the number doubled

In this module you learned about loops. You also began learning about implementing loops in programs makes for more readable code and programs that run.

  Produce a program that effectively solves a real-world data

Produce a program that effectively solves a real-world data manipulation problem about child mortality - how you might solve a given data manipulation problem

  Write a program that reads a set of floating-point values

Write a program that reads a set of floating-point values. Ask the user to enter the values until a sentinel value is input, then print.

  ICT707 Data Science Practice Assignment

ICT707 Data Science Practice Assignment Help and Solution, University of the Sunshine Coast - Assessment Writing Service - implement a recommender system

  The program should allow the student

The program should allow the student to enter the answer. If the answer is correct, a message of congratulations should be displayed. If the answer is incorrect, a message showing the correct answer should be displayed.

  Create a function calledlocker to find your answer

Solve the "locker puzzle." A school has 100 students and 100 lockers. All lockers are closed on the first day of school. As the students enter.

  Write a function rmduplic(l), where l is any list

Write a function rmDuplic(L), where L is any list. The function should return a list M that contains the same items as L, except that repetitions (duplicates) have been removed: only the first occurrence of each entry is kept (i.e., order is prese..

  Write the program that reads from a text file

Write the program that reads from a text file. Read each line and send it to the output file, preceded by line numbers. Whose fleece was white as snow.

  Print a string variable that states the number of loops

Write a program that will calculate the problem and stop after the condition has been met. Print a string variable that states the number of loops require.

  Make your own test cases and think about what the edge cases

The second function you will write should be called 'countLetter'. Your function should take two (2) arguments. The first will be a string.

  Python program that keeps prompting the user for a student

Python program that keeps prompting the user for a student name, and the grade of that student. If a user does not enter a name.

  Write a program that finds the longest word in dictionary

The letters A through F are used for writing hexadecimal numbers and can also spell a few English words.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd