Presentation is loading. Please wait.

Presentation is loading. Please wait.

CS621: Artificial Intelligence

Similar presentations


Presentation on theme: "CS621: Artificial Intelligence"— Presentation transcript:

1 CS621: Artificial Intelligence
Pushpak Bhattacharyya CSE Dept., IIT Bombay Lecture 7: Traveling Salesman Problem as search; Simulated Annealing; Comparison with GA

2 4-city TSP dij not necessarily Equal to dji 2 1 d12 d23 d23 d31 d14 4

3 TSP: State Representation
1 4 3 2 Position (α) City (i) `i’ varies over cities `α’ varies over positions

4 Objective Functions Minimize F = F1 + F2
F1 = k1 ∑i ((∑α xiα) – 1) k2 ∑β ((∑j xjβ) – 1)2 1(a) 1(b) F2 = k3 ∑i ∑j ∑α dij (xiα xi,α+1 + xiα xi,α-1) 2

5 Travelling Salesperson problem through Simulated Annealing, State representation
Position City 1 2 3 4 1 3 4 2 State

6 State/Node expansion 1 Parent State 3 4 2 3  2 4  2 1 1
1 Parent State 3 4 2 3  2 4  2 1 1 Children States 2 4 3 2 1 2 3 4 1 2 3 4 3 4

7 State-Energy diagram

8 Metropolis Algorithm Initialize: Start with a random state matrix S. Compute the objective function value at S. Call this the energy of the state E(S). The states are transformed by the application of an operator (for TSP, inversion of adjacent cities) Compute change the energy ΔE=Enew-Eold if ΔE <=0, accept the new state Snew Else, accept Snew with probability (‘T’ is the “temperature” and KB, the Boltzmann constant)

9 Metropolis Algorithm (contd)
6) Continue 2-5 until there is no appreciable change in energy 7) The current state may be one of the local minima 8) Increase the temperature and continue 2-7 until the global minimum is reached

10 How to probabilistically accept a state?
Suppose the probability =p Generate a random number from a uniform distribution [0,1] Number generated is in the range [0-p]: Accept the new state, else continue search from the old state itself

11 Why? The significance of p (= ) is that if the states are generated infinite number of times then a proportion p of them will be the concerned new state (0,0) (1,1) Uniform distribution Of [0,1] (0,0) (0,1) (0,p)

12 Why? (contd) If numbers in the range [0,1] are generated randomly, p% of them will be in the range [0,p]. Hence this process can simulate the state generation process (0,0) (1,1) Uniform distribution Of [0,1] (0,0) (0,1) (0,p)

13 Compare with Roulette Wheel Algorithm for Selection
Chromosome Fitness % of total 1 6.82 31 2 1.11 5 3 8.48 38 4 2.57 12 3.08 14 Total 22.0 100 Acknowledgement:

14 Roulette Wheel Selection
Let i = 1, where i denotes chromosome index; Calculate P(xi) using proportional selection; sum = P(xi); choose r ~ U(0,1); while sum < r do i = i + 1; i.e. next chromosome sum = sum + P(xi); end return xi as one of the selected parent; repeat until all parents are selected

15 Significance of “temperature”
We have a pseudo temperature T As T increases so does T is a parameter in the algorithm When stuck in the local minima, we increase the temperature The probability of going to a higher energy state increases Shaken out of local minima Similar to annealing of metal

16 Annealing of Metal The metal should have a stable crystal structure so that it is not brittle For this it is repeatedly heated and then cooled slowly


Download ppt "CS621: Artificial Intelligence"

Similar presentations


Ads by Google