Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
7 views13 pages

Program 4,5and 6

The document outlines the AO* search algorithm, which evaluates paths using the function f(n) = g(n) + h(n), where g(n) is the cost to reach the current node and h(n) is the estimated cost to the goal. It highlights real-life applications of the AO* algorithm in vehicle routing and portfolio optimization. Additionally, it discusses the Traveling Salesman Problem (TSP) and provides a dynamic programming approach to find the shortest path visiting a set of cities.

Uploaded by

Arun Prabha
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views13 pages

Program 4,5and 6

The document outlines the AO* search algorithm, which evaluates paths using the function f(n) = g(n) + h(n), where g(n) is the cost to reach the current node and h(n) is the estimated cost to the goal. It highlights real-life applications of the AO* algorithm in vehicle routing and portfolio optimization. Additionally, it discusses the Traveling Salesman Problem (TSP) and provides a dynamic programming approach to find the shortest path visiting a set of cities.

Uploaded by

Arun Prabha
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 13

Program 4

Implement AO* Search algorithm


Working of AO* algorithm:
The evaluation function in AO* looks like this:

f(n) = g(n) + h(n)

f(n) = Actual cost + Estimated cost

here, f(n) = The actual cost of traversal. g(n) = the cost from the initial node to the
current node. h(n) = estimated cost from the current node to the goal state.

Real-Life Applications of AO* algorithm:


Vehicle Routing Problem:
The vehicle routing problem is determining the shortest routes for a fleet of vehicles
to visit a set of customers and return to the depot, while minimizing the total distance
traveled and the total time taken. The AO* algorithm can be used to find the optimal
routes that satisfy both objectives.
Portfolio Optimization:
Portfolio optimization is choosing a set of investments that maximize returns while
minimizing risks. The AO* algorithm can be used to find the optimal portfolio that
satisfies both objectives, such as maximizing the expected return and minimizing the
standard deviation.

Program
Program 5
Solve 8-Queens Problem with suitable assumptions
Program 6
Implementation of TSP using heuristic approach
Algorithm for Traveling Salesman Problem

Before starting the algorithm, let’s get acquainted with some terminologies:
 A graph G=(V, E), which is a set of vertices and edges.
 V is the set of vertices.
 E is the set of edges.
 Vertices are connected through edges.
 Dist(i,j) denotes the non-negative distance between two vertices, i and j.

Let’s assume S is the subset of cities and belongs to {1, 2, 3, …, n} where 1, 2, 3…n are the cities
and i, j are two cities in that subset. Now cost(i, S, j) is defined in such a way as the length of the
shortest path visiting node in S, which is exactly once having the starting and ending point as i and j
respectively.
For example, cost (1, {2, 3, 4}, 1) denotes the length of the shortest path where:
 Starting city is 1
 Cities 2, 3, and 4 are visited only once
 The ending point is 1

The dynamic programming algorithm would be:

 When |S| > 1, we define cost(i, S, 1) = ∝ where i !=1 . Because initially, we do not know the exact
 Set cost(i, , i) = 0, which means we start and end at i, and the cost is 0.

cost to reach city i to city 1 through other cities.


 Now, we need to start at 1 and complete the tour. We need to select the next city in such a way-

Cost (i, S, j)=min cost (i, S−{i}, j)+dist (i,j) where i∈S and i≠j

You might also like