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

  Create a datapath diagram

• Using Microsoft Visio or its open source alternative, create a Datapath Diagram for the following scenario: • Local user sends email to a Yahoo recipient. Local (corporate) user having email address [email protected] sends an email to [email protected]..

  What effects do they have on the price of a call option

What qualitative effects do altering µ and a have? What effects do they have on the price of a call option?

  Provide a plan that addresses planned organizational change

Question 6.6. (TCO F) Provide a plan that addresses planned organizational change using judicious automation, rationalization of procedures, business process redesign, and constructive paradigm shifts that improve the way business is managed.

  Categorize the point-of-sale system in supermarket

Categorize the following systems and explain your classification: A point-of-sale system in a supermarket, A system which sends out reminders that magazine subscriptions are due to be paid.

  What server type would you most likely need to deploy

What server type would you most likely need to deploy at each physical location in a WAN?

  Is congestion better managed at the cell level or at the tc

Give an argument why the congestion-control problem is better managed at the internet level than the ATM level, at least when only part of the internet is ATM. In an exclusively IP-over-ATM network, is congestion better managed at the cell level o..

  Calculate the totals for each of the resources and expenses

Using Column F, calculate the totals for each of the resources and expenses. Label the column appropriately. Format the total values with an accounting style and two decimal places.

  Describe how concepts such as risc

In this six pages research paper, you will investigate the evolution of and current trends in improving system performance with concepts such as RISC, pipelining, cache memory, and virtual memory. In this paper you must, as part of your conclus..

  Problem regarding the responsible for security

As a DBA, you are responsible for security. Provide three (3) reasons to complete a security baseline, and describe the key ways that the Security Compliance Manager can help achieve a company's security goals.

  Create an employeeexception class

Create an EmployeeException class whose constructor receives a String that consists of an employee's ID and pay rate. Create an Employee class with two fields, idNum and hourlyWage.

  Establish a software process that provides flexibility

Since tradeoffs are inherent to software engineering, make them explicit and document them.

  Applications of synchronous motors

How does a three-phase synchronous motor differ from a three-phase induction motor? Give a few applications of synchronous motors.

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