Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Optimal Strategy for Minimum cost from city 1 to city 1 using Dynamic Programming Write a program that solve minimum cost for traveling from city

Optimal Strategy for Minimum cost from city1 to city1 using Dynamic Programming
Write a program that solve minimum cost for traveling from city 1 to city 2 Problem using Dynamic Programming technique.
Problem definition:
Travelling from home in city1 to a hotel in city2.
N stopovers on the way
a. a number of choices of towns for each stop,
b. a number of hotels to choose from in each city.
Each trip has a different distance resulting in a different cost (petrol).
Hotels have different costs.
The goal is to select a route to and a hotel in city 2 so that the overall cost of the trip is minimized.
Your program should print out the following:
Read the input data from a file
File format:
Number of cities
Start city, end city
List of adjacent cities
A,[D,8,50],[E,10,70]
B,[D,25,50],[E,10,70]
C,D,13,50
E,13,70
D.F,25,50
G,30,70
H,18,70
1,27,60
E.[F,12,50],[G,10,70],[H,8,70],[1,7,60]
F,[],26,50
G,J,8,50
K,10,70
L,10,60
H,[J,20,50],[K,10,70],[L,10,60]
L.[J,15,50],[K,10,70],[L,7,60]92
J.[End,10,0]
K,[End,10,0]
L.[End,10,0
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Marketing The New Profit Frontier

Authors: Ed Burnett

1st Edition

0964535629, 978-0964535626

More Books

Students also viewed these Databases questions