Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
data
10
2
6
5
9
8
5
0
8
4
6
8
9
7
2
8
7
6
5
4
3
2
1
0
Algorithm CLARANS
1.Input parameters numlocal and maxneighbor.
Initialize i to 1, and mincost to a large number.
4
9
9
4
9
1
4
8
0
1
2
2
6
3
2
10
k=3
numlocal = 10
maxneighbor = 5
i=1
mincost = 9999
Data
10
2
6
5
9
8
5
0
8
4
6
8
9
7
2
8
7
6
5
4
3
2
1
0
Algorithm CLARANS
2.Set current to an arbitrary node in Gn,k.
3.Set j to 1.
4
9
9
4
9
1
4
8
0
1
2
2
6
3
2
cost
3.1623
4
0
2.2361
3
2.2361
2.2361
6.0828
3.1623
0
1.4142
1.4142
3.6056
0
2.2361
K#
3
2
2
3
2
3
3
2
3
1
3
3
3
3
1
10
Data
10
2
6
5
9
8
5
0
8
4
6
8
9
7
2
8
7
6
5
4
3
2
1
0
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).
4
9
9
4
9
1
4
8
0
1
2
2
6
3
2
cost
4.4721
4
0
2.2361
3
2.2361
2.2361
6.0828
2.8284
0
0
2
4.2426
1.4142
2.2361
K#
3
2
2
3
2
3
3
2
3
1
3
3
2
3
1
10
Data
8
7
6
5
4
3
2
1
0
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).
10
10
2
6
5
9
8
5
0
8
4
6
8
9
7
2
4
9
9
4
9
1
4
8
0
1
2
2
6
3
2
cost
K#
2.8284
4
0
3.1623
3
1
3.1623
6.0828
2
0
2
0
4.1231
1.4142
2.2361
3
2
2
1
2
3
1
2
3
1
3
3
3
3
1
Data
8
7
6
5
4
3
2
1
0
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).
10
10
2
6
5
9
8
5
0
8
4
6
8
9
7
2
4
9
9
4
9
1
4
8
0
1
2
2
6
3
2
cost
K#
3.1623
0
4
2.2361
6.3246
2.2361
2.2361
2.2361
3.1623
0
1.4142
1.4142
3.6056
0
2.2361
3
2
2
3
3
3
3
2
3
1
3
3
3
3
1
Data
8
7
6
5
4
3
2
1
0
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).
10
10
2
6
5
9
8
5
0
8
4
6
8
9
7
2
4
9
9
4
9
1
4
8
0
1
2
2
6
3
2
cost
K#
2.2361
0
4
3.1623
3
4
3.1623
2.2361
4.1231
0
2.2361
4.1231
0
3.6056
2.2361
3
2
2
1
3
1
1
2
1
1
1
1
3
1
1
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).
8