Download presentation

Presentation is loading. Please wait.

Published byDalton Oldfield Modified over 2 years ago

1
1 CLARANSCLARANS

2
2 data 104 29 69 549 81 54 08 80 41 62 82 96 732 Algorithm CLARANS 1.Input parameters numlocal and maxneighbor. Initialize i to 1, and mincost to a large number. k = 3 numlocal = 10 maxneighbor = 5 i = 1 mincost = 9999

3
3 DatacostK# 1043.16233 2942 6902 542.23613 9932 812.23613 542.23613 086.08282 803.16233 4101 621.41423 821.41423 963.60563 7303 222.23611 Algorithm CLARANS 2.Set current to an arbitrary node in Gn,k. 3.Set j to 1. Step 2. current = Gn,k. = {(4,1), (6,9), (7,3)} cost(current) = 34.7856 Step 3. j = 1 note: S1 and S2 are neighbors if and only if |S1 S2| = k-1

4
4 Algorithm CLARANS 4.Consider a random neighbor S of current, and based on Equation (5) calculate the cost differential of the two nodes. 5.If S has a lower cost, set current to S, and go to Step (3). 6. Otherwise, increment j by 1. If j <= maxneighbor, go to Step (4). Step 4. random S = {(4,1), (6,9), (6,2)} cost(S) = 36.98 Step 5. -- Step 6. j = j + 1, j = 2 j <= maxneighbor goto step (4) DatacostK# 1044.47213 2942 6902 542.23613 9932 812.23613 542.23613 086.08282 802.82843 4101 6203 8223 964.24262 731.41423 222.23611

5
5 Algorithm CLARANS 4.Consider a random neighbor S of current, and based on Equation (5) calculate the cost differential of the two nodes. 5.If S has a lower cost, set current to S, and go to Step (3). 6. Otherwise, increment j by 1. If j <= maxneighbor, go to Step (4). Step 4. random S = {(4,1), (6,9), (8,2)} cost(S) = 35.009 Step 5. -- Step 6. j = j + 1, j = 3 j <= maxneighbor goto step (4) DatacostK# 1042.82843 2942 6902 543.16231 9932 8113 543.16231 086.08282 8023 4101 6223 8203 964.12313 731.41423 222.23611

6
6 Algorithm CLARANS 4.Consider a random neighbor S of current, and based on Equation (5) calculate the cost differential of the two nodes. 5.If S has a lower cost, set current to S, and go to Step (3). 6. Otherwise, increment j by 1. If j <= maxneighbor, go to Step (4). Step 4. random S = {(4,1), (2,9), (7,3)} cost(S) = 34.263 Step 5. cost(S)

7
7 Algorithm CLARANS 3.Set j to 1. 4.Consider a random neighbor S of current, and based on Equation (5) calculate the cost differential of the two nodes. 5.If S has a lower cost, set current to S, and go to Step (3). 6. Otherwise, increment j by 1. If j <= maxneighbor, go to Step (4). current = {(4,1), (2,9), (7,3)} cost(current) = 34.263 Step 3. j = 1 Step 4. random S = {(4,1), (2,9), (9,6)} cost(S) = 38.121 Step 5. -- Step 6. j = j + 1, j = 2 j <= maxneighbor goto step (4) DatacostK# 1042.23613 2902 6942 543.16231 9933 8141 543.16231 082.23612 804.12311 4101 622.23611 824.12311 9603 733.60561 222.23611

8
current = {(4,1), (2,9), (7,3)} cost(current) = 34.263 j = 1random S = {(4,1), (2,9), (9,6)}cost(S) = 38.121 j = 2random S = {(4,1), (2,9), (10,4)}cost(S) = 38.087 j = 3random S = {(4,1), (5,4), (7,3)}cost(S) = 40.888 j = 4random S = {(4,1), (9,9), (7,3)}cost(S) = 39.16 j = 5random S = {(2,2), (2,9), (7,3)}cost(S) = 37.422 j = 6 j > maxneighbor goto step 7 Step 7. cost(current) < mincost mincost = cost(current) = 34.263 bestnode = current = {(4,1), (2,9), (7,3)} Step 8. i = i + 1, i = 2 i < numlocal goto step (2) มีโอกาส random ได้ set เดิม ? หรือ current ก่อนหน้านี้ ? Algorithm CLARANS 7. Otherwise, when j > maxneighbor, compare the cost of current with mincost. If the former is less than mincost, set mincost to the cost of current, and set bestnode to current. 8. Increment i by 1. If i > numlocal, output bestnode and halt. Otherwise, go to Step (2).

Similar presentations

© 2017 SlidePlayer.com Inc.

All rights reserved.

Ads by Google