Compute the shortest path between two cities

Assignment Help Basic Computer Science
Reference no: EM131213559

Flight planning. This exercise uses the relation class implemented in section 9.6. Fly By Night airlines asks you to write a program that can plan flights for its passengers. We are given a database containing a set of facts of the form

1297_fa2ffcbf-f59e-4a7b-a5d0-4a786755888a.png

The first two arguments represent a pair of cities served by Fly By Night airlines, the third argument is the great circle distance between the two cities, and the fourth argument is a boolean that is true if there is a direct flight between the two cities and false otherwise. For this exercise, do the following:

(a) Write a planner that, given a source city and a destination city, returns a path between the two cities that is noncircular, i.e., no city appears twice in the path. Define the planner as a function {Plan City1 City2} that returns a pair Distance#Path, where Distance is the total distance flown on the path from City1 to City2 and Path is a list of cities representing the path from City1 to City2.The function should be nondeterministic so that Solve can use it to generate different plans.

(b) Use the above planner to compute the shortest path between two cities. Define a function {Best Plan City1 City2} that returns the shortest path.

(c) The implementation of Best Plan will enumerate all solutions to find the best one. This can be very costly in time. To reduce the time, we can use a heuristic called best first. Whenever we need to choose a city, we choose first a connected city that has the shortest direct distance to the destination. Define a function {Good Plan City1 City2} that uses this heuristic.

Reference no: EM131213559

Questions Cloud

Explain your position in a clear and well-argued essay : Assume that you are Mr. Hegarty, the CEO of Mebel-Doran. What will you do now? What avenues are open to you? Explain your position in a clear and well-argued essay.
Attempted to remain anonymous : Outline a scenario in which you might be acting ethically but might still want to remain anonymous while using the Internet. Identify two approaches someone might take to learn your identity even if you attempted to remain anonymous.
Whether covered interest parity holds for one year : Determine whether covered interest parity holds for one-year government bonds issued by the U.S. and British governments.
Reduce the effect they have on the phosphorus cycle : What are some ways that humans can reduce the effect they have on the phosphorus cycle?
Compute the shortest path between two cities : Use the above planner to compute the shortest path between two cities. Define a function {Best Plan City1 City2} that returns the shortest path.
Construct a projected balance sheet and income statement : Sales for 2016 were $350 million, while net income for the year was $10.5 million. Construct a projected Balance Sheet and Income Statement for the year-ended 12/31/2016.
Identify key metrics that you propose for your organization : Using the balanced scorecard approach as detailed in Chapter 14 (Figure 14.1), identify four key metrics that you would propose for your organization's supply management system and how you propose to measure those 4 key metrics in your supply chai..
Explain the nature of the exchange rate risk : Explain the nature of the exchange-rate risk for each of the given, from the perspective of the U.S. firm or person.
Desirable properties of the relational computation model : For this exercise, investigate how to remove this restriction while maintaining the desirable properties of the relational computation model, i.e., its simple logical semantics and efficient implementation.

Reviews

Write a Review

Basic Computer Science Questions & Answers

  Problem regarding the cryptographic methods

You have found an old ciphertext, where you know that the plaintext discusses cryptographic methods. You suspect that a Vigenere cipher has been used and therefore look for repeated strings in the ciphertext.

  Create a t-sql script that returns the student id

Write a T-SQL statement that returns the faculty ID, last name and monthly salary of two faculty members with the two lowest monthly salary values.

  Develop an excel retail or business workbook

You will develop an Excel retail/business workbook and show how to use excel in real life. When learning a business tool like Excel, its power and capabilities are best understood when Excel is used to solve a "REAL LIFE" problem

  Discuss your personal and professional future story

Create and present a 8- to 12-slide Microsoft PowerPoint presentation in class, in which you discuss your personal and professional future story.

  What differences might you expect to find

What differences might you expect to find

  Develop a multi-agent based recommender system architecture

Develop a multi-agent based recommender system architecture for multi-site software development to support collaborative behavior around the software engineering ontology.

  What factors contribute to strong cross-unit relationship

ECOM - module 13The text emphasizes the need for strong business/IT relationships for managing IT. Describe what factors or variables contribute to a strong cross-unit relationship. Provide examples and cite your sources as appropriate. One page ..

  Write a menu driven program

Write a menu driven program that allows the user to enter five numbers and then choose between finding the smallest , sum or average of the numbers.

  What can we say about the relative prices of a and b

Asset A pays I if the stock price over the next year is at some point above 100. Asset B pays 1 if the stock price is above 100 a year from now. What can we say about the relative prices of A and B?

  Social-ethical issues in information systems

Write a report about social and ethical issues in information systems.

  Use a temporary location t to store the intermediate results

Compare zero-, one, two-, and three- address machines by writing programs to compute.

  What is parsing

What is parsing? Write down the drawback of top down parsing of backtracking.

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