1 / 8

CLARANS

CLARANS. data 10 4 2 9 6 9 5 4 9 9 8 1 5 4 0 8 8 0 4 1 6 2 8 2 9 6 7 3 2 2. 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. Data cost K#

loc
Download Presentation

CLARANS

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. CLARANS

  2. data 10 4 2 9 6 9 5 4 9 9 8 1 5 4 0 8 8 0 4 1 6 2 8 2 9 6 7 3 2 2 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. Data cost K# 10 4 3.1623 3 2 9 4 2 6 9 0 2 5 4 2.2361 3 9 9 3 2 8 1 2.2361 3 5 4 2.2361 3 0 8 6.0828 2 8 0 3.1623 3 4 1 0 1 6 2 1.4142 3 8 2 1.4142 3 9 6 3.6056 3 7 3 0 3 2 2 2.2361 1 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. Data cost K# 10 4 4.4721 3 2 9 4 2 6 9 0 2 5 4 2.2361 3 9 9 3 2 8 1 2.2361 3 5 4 2.2361 3 0 8 6.0828 2 8 0 2.8284 3 4 1 0 1 6 2 0 3 8 2 2 3 9 6 4.2426 2 7 3 1.4142 3 2 2 2.2361 1 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)

  5. Data cost K# 10 4 2.8284 3 2 9 4 2 6 9 0 2 5 4 3.1623 1 9 9 3 2 8 1 1 3 5 4 3.1623 1 0 8 6.0828 2 8 0 2 3 4 1 0 1 6 2 2 3 8 2 0 3 9 6 4.1231 3 7 3 1.4142 3 2 2 2.2361 1 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)

  6. Data cost K# 10 4 3.1623 3 2 9 0 2 6 9 4 2 5 4 2.2361 3 9 9 6.3246 3 8 1 2.2361 3 5 4 2.2361 3 0 8 2.2361 2 8 0 3.1623 3 4 1 0 1 6 2 1.4142 3 8 2 1.4142 3 9 6 3.6056 3 7 3 0 3 2 2 2.2361 1 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)<cost(current) current = {(4,1), (2,9), (7,3)} goto step (3)

  7. Data cost K# 10 4 2.2361 3 2 9 0 2 6 9 4 2 5 4 3.1623 1 9 9 3 3 8 1 4 1 5 4 3.1623 1 0 8 2.2361 2 8 0 4.1231 1 4 1 0 1 6 2 2.2361 1 8 2 4.1231 1 9 6 0 3 7 3 3.6056 1 2 2 2.2361 1 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)

  8. current = {(4,1), (2,9), (7,3)} cost(current) = 34.263 j = 1 random S = {(4,1), (2,9), (9,6)} cost(S) = 38.121 j = 2 random S = {(4,1), (2,9), (10,4)} cost(S) = 38.087 j = 3 random S = {(4,1), (5,4), (7,3)} cost(S) = 40.888 j = 4 random S = {(4,1), (9,9), (7,3)} cost(S) = 39.16 j = 5 random 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).

More Related