The R Project SVN R-packages

Rev

Rev 8272 | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed


R Under development (unstable) (2023-10-19 r85356) -- "Unsuffered Consequences"
Copyright (C) 2023 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> ## not run usually:
> if(!cluster:::doExtras()) q("no")
> 
> library(cluster)
> 
> ## generate 1500 objects, divided into 2 clusters.
> suppressWarnings(RNGversion("3.5.0")) # << as long as we don't have R >= 3.6.0
> set.seed(264) ## <-- different than ./clara.R's !
> x <- rbind(cbind(rnorm(700, 0,8), rnorm(700, 0,8)),
+            cbind(rnorm(800,50,8), rnorm(800,10,8)))
> 
> isEq <- function(x,y, epsF = 100)
+     is.logical(r <- all.equal(x,y, tol = epsF * .Machine$double.eps)) && r
> 
> 
> .proctime00 <- proc.time()
> 
> ## full size sample {should be = pam()}:
> n0 <- length(iSml <- c(1:70, 701:720))
> summary(clara0 <- clara(x[iSml,], k = 2, sampsize = n0))
Object of class 'clara' from call:
 clara(x = x[iSml, ], k = 2, sampsize = n0) 
Medoids:
          [,1]       [,2]
[1,]  1.406595  0.4453538
[2,] 48.585270 13.1867947
Objective function:   9.363948 
Numerical information per cluster:
     size max_diss   av_diss isolation
[1,]   70 23.82081  8.941138 0.4874429
[2,]   20 25.80404 10.843782 0.5280255
Average silhouette width per cluster:
[1] 0.7447197 0.6942930
Average silhouette width of best sample: 0.7335138 

Best sample:
 [1]  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
[26] 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
[51] 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75
[76] 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90
Clustering vector:
 [1] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
[39] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2
[77] 2 2 2 2 2 2 2 2 2 2 2 2 2 2

Silhouette plot information for best sample:
   cluster neighbor sil_width
16       1        2 0.8194870
65       1        2 0.8186849
42       1        2 0.8174843
24       1        2 0.8172817
63       1        2 0.8162440
60       1        2 0.8152863
27       1        2 0.8151750
15       1        2 0.8144985
46       1        2 0.8132668
12       1        2 0.8115039
7        1        2 0.8107415
20       1        2 0.8100377
59       1        2 0.8076938
40       1        2 0.8061776
37       1        2 0.8057764
22       1        2 0.8048435
18       1        2 0.8045184
34       1        2 0.8044573
6        1        2 0.8027560
53       1        2 0.8020140
13       1        2 0.8018311
47       1        2 0.8015244
43       1        2 0.8013524
4        1        2 0.8002075
55       1        2 0.7992425
19       1        2 0.7966406
39       1        2 0.7965002
69       1        2 0.7963059
26       1        2 0.7934862
2        1        2 0.7932520
50       1        2 0.7927811
41       1        2 0.7896536
31       1        2 0.7857843
38       1        2 0.7826217
30       1        2 0.7813832
64       1        2 0.7755748
25       1        2 0.7731234
11       1        2 0.7724159
33       1        2 0.7675508
45       1        2 0.7673791
36       1        2 0.7654933
58       1        2 0.7619774
66       1        2 0.7572955
29       1        2 0.7566990
5        1        2 0.7486214
54       1        2 0.7432419
62       1        2 0.7366140
68       1        2 0.7293284
14       1        2 0.7263886
23       1        2 0.7255830
49       1        2 0.7199783
35       1        2 0.7138018
3        1        2 0.7117979
57       1        2 0.6964554
28       1        2 0.6934535
48       1        2 0.6928130
56       1        2 0.6709429
21       1        2 0.6652859
32       1        2 0.6639150
10       1        2 0.6636485
17       1        2 0.6626380
52       1        2 0.6608896
51       1        2 0.6603982
67       1        2 0.6405932
44       1        2 0.6305873
61       1        2 0.6114518
9        1        2 0.5875460
8        1        2 0.5492186
1        1        2 0.5229467
70       1        2 0.2742352
85       2        1 0.7844696
72       2        1 0.7781626
78       2        1 0.7719671
79       2        1 0.7702056
87       2        1 0.7682619
74       2        1 0.7664274
71       2        1 0.7607121
83       2        1 0.7567789
81       2        1 0.7352285
82       2        1 0.7213934
90       2        1 0.7176081
80       2        1 0.6731059
77       2        1 0.6730883
84       2        1 0.6657689
88       2        1 0.6548647
86       2        1 0.6454764
76       2        1 0.6028321
75       2        1 0.6014646
73       2        1 0.5764590
89       2        1 0.4615848

4005 dissimilarities, summarized :
   Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
 0.3757 10.1410 18.1790 26.5090 45.6080 82.6710 
Metric :  euclidean 
Number of objects : 90

Available components:
 [1] "sample"     "medoids"    "i.med"      "clustering" "objective" 
 [6] "clusinfo"   "diss"       "call"       "silinfo"    "data"      
>           pam0 <- pam  (x[iSml,], k = 2)
> stopifnot(identical(clara0$clustering, pam0$clustering)
+         , isEq(clara0$objective, unname(pam0$objective[2]))
+           )
> 
> summary(clara2 <- clara(x, 2))
Object of class 'clara' from call:
 clara(x = x, k = 2) 
Medoids:
            [,1]        [,2]
[1,]  0.04089097  0.02320045
[2,] 51.20275990 11.75050315
Objective function:   9.627208 
Numerical information per cluster:
     size max_diss  av_diss isolation
[1,]  701 28.92506 9.585969 0.5510719
[2,]  799 28.92254 9.663390 0.5510239
Average silhouette width per cluster:
[1] 0.7404738 0.7679151
Average silhouette width of best sample: 0.7548181 

Best sample:
 [1]   17   46   61  152  201  223  254  263  268  291  313  331  479  508  528
[16]  542  543  601  647  655  681  746  778  792  888  951  957 1010 1081 1085
[31] 1105 1110 1122 1136 1231 1265 1272 1307 1342 1365 1383 1393 1395 1467
Clustering vector:
   [1] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
  [38] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
  [75] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
 [112] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
 [149] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
 [186] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
 [223] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
 [260] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
 [297] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
 [334] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
 [371] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
 [408] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
 [445] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
 [482] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
 [519] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
 [556] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
 [593] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
 [630] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
 [667] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 2 2
 [704] 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
 [741] 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
 [778] 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
 [815] 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
 [852] 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
 [889] 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
 [926] 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
 [963] 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
[1000] 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
[1037] 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
[1074] 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
[1111] 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
[1148] 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
[1185] 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
[1222] 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
[1259] 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
[1296] 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
[1333] 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
[1370] 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
[1407] 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
[1444] 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
[1481] 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2

Silhouette plot information for best sample:
     cluster neighbor sil_width
647        1        2 0.8168036
223        1        2 0.8117572
263        1        2 0.8072019
152        1        2 0.8037261
201        1        2 0.7956334
46         1        2 0.7928588
508        1        2 0.7857050
528        1        2 0.7773186
291        1        2 0.7731206
254        1        2 0.7704038
655        1        2 0.7586029
268        1        2 0.7448140
331        1        2 0.7368253
479        1        2 0.7195332
542        1        2 0.6963969
313        1        2 0.6946026
17         1        2 0.6803030
681        1        2 0.6798070
601        1        2 0.6703326
61         1        2 0.6567378
543        1        2 0.5774663
746        2        1 0.8430693
1136       2        1 0.8425778
1383       2        1 0.8386611
1395       2        1 0.8366096
1467       2        1 0.8302860
792        2        1 0.8277142
778        2        1 0.8257732
1110       2        1 0.8217366
1122       2        1 0.8145313
1272       2        1 0.8098449
888        2        1 0.8063853
1265       2        1 0.7957217
951        2        1 0.7940572
1010       2        1 0.7794275
1085       2        1 0.7684807
957        2        1 0.7649281
1081       2        1 0.7370830
1307       2        1 0.7366453
1393       2        1 0.7256275
1231       2        1 0.7029040
1342       2        1 0.6762151
1365       2        1 0.6004453
1105       2        1 0.4833222

946 dissimilarities, summarized :
   Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
 0.8754 11.8110 32.7990 31.9700 51.4100 79.8060 
Metric :  euclidean 
Number of objects : 44

Available components:
 [1] "sample"     "medoids"    "i.med"      "clustering" "objective" 
 [6] "clusinfo"   "diss"       "call"       "silinfo"    "data"      
> 
> clInd <- c("objective", "i.med", "medoids", "clusinfo")
> clInS <- c(clInd, "sample")
> ## clara() {as original code} always draws the *same* random samples !!!!
> clara(x, 2, samples = 50)[clInd]
$objective
[1] 9.600858

$i.med
[1]  610 1076

$medoids
           [,1]       [,2]
[1,] -0.1009724 -0.4444724
[2,] 50.0601381  9.6999505

$clusinfo
     size max_diss  av_diss isolation
[1,]  701 29.34325 9.579557 0.5733721
[2,]  799 27.83521 9.619546 0.5439049

> 
> ## The for() code below *did* hang (in some 64-bit versions of R / clara / ...):
> ## but this has been fixed *long* ago
> xx <- x[sample(nrow(x)),]
> if(FALSE) { ## only run manually
+     ff <- "/u/maechler/R/MM/Pkg-ex/cluster/clara2-ex.rds"
+     if(file.exists(ff))
+         xx <- readRDS(ff)
+     else
+         saveRDS(xx, file=ff)
+ }
> print(clara(xx, 2, samples= 5, trace = 3)[clInd])
C clara(): (nsam,nran,n) = (44,5,1500);
- clara sample  1  finding 1st... new k{ran}:
.. kall: FALSE, 
... nrx [0:1]= 0 0 
... nsel[0:0]= 23 
 [ntt=44, nunfs=0] .. nsel[1:44]= 23 54 87 103 140 199 246 303 306 322 394 408 412 414 428 461 468 521 592 647 859 898 906 967 971 1007 1028 1039 1114 1149 1151 1192 1237 1250 1279 1291 1301 1317 1340 1353 1366 1381 1383 1492  -> dysta2();
 clara -> s:= max{dys[1..946]} = 84.6494;
 bswap2(*, s=84.6494), 1. BUILD:     new repr. 13
    new repr. 6
  after build: medoids are  6 13
  and min.dist dysma[1:n] are
     10     14   7.21   10.5   17.8      0   6.26   3.23   16.7   20.3
   9.36   18.6      0   7.47   4.31     11     18   15.7     23   5.51
   6.99    8.5   15.8   6.82   9.51   19.2   14.9     18   15.5   12.1
   27.6     10   15.7   15.2   20.5    9.7   11.4   9.74    4.5   20.8
   12.7   21.9   8.81   6.32
 --> sky = sum_j D_j= 541.2
   swp new 11 <-> 13 old; decreasing diss. by -104.377
  Last swap: new 11 <-> 13 old; decreasing diss. by 1
 end{bswap2}: sky = 436.824
1st proper sample obj= 10.1407
- clara sample  2  if (kall && nunfs...): 
.. kall: T, 
... nrx [0:1]= 199 394 
... nsel[0:1]= 199 394 
 [ntt=44, nunfs=0] .. nsel[1:44]= 21 50 97 142 168 191 192 197 199 224 325 328 394 433 458 471 651 712 714 722 797 805 837 909 919 926 999 1006 1018 1019 1049 1081 1084 1132 1144 1150 1201 1207 1291 1307 1330 1374 1426 1428  -> dysta2();
 clara -> s:= max{dys[1..946]} = 82.2326;
 bswap2(*, s=82.2326), 1. BUILD:     new repr. 24
    new repr. 27
  after build: medoids are 24 27
  and min.dist dysma[1:n] are
   9.51      9   12.4   9.47   8.34   17.9   13.1     12   12.3   11.1
   9.17   5.89   4.52   5.11   19.9   5.59   11.4     20   7.41   7.66
   9.16   12.3   5.93      0   15.1   24.6      0   7.13     14   10.5
   7.44   18.2   5.66   11.9   32.8   26.6   21.4   11.1   12.5   9.46
   11.2   28.9    4.6   14.4
 --> sky = sum_j D_j= 526.744
   swp new 30 <-> 24 old; decreasing diss. by -110.942
  Last swap: new 30 <-> 24 old; decreasing diss. by 1
 end{bswap2}: sky = 415.802
new best obj= 9.77929
- clara sample  3  if (kall && nunfs...): 
.. kall: T, 
... nrx [0:1]= 1019 999 
... nsel[0:1]= 999 1019 
 [ntt=44, nunfs=0] .. nsel[1:44]= 10 15 23 46 85 90 94 105 112 225 278 313 485 486 502 513 529 639 641 660 681 757 796 812 814 865 876 896 954 959 973 999 1019 1032 1045 1249 1264 1269 1273 1296 1297 1336 1361 1399  -> dysta2();
 clara -> s:= max{dys[1..946]} = 82.2209;
 bswap2(*, s=82.2209), 1. BUILD:     new repr. 9
    new repr. 33
  after build: medoids are  9 33
  and min.dist dysma[1:n] are
   14.1   5.99   12.1   9.56   9.14   7.24   24.5   10.6      0   10.1
   17.2   14.5   16.4   16.9   9.15   12.6   15.6   5.89   17.3   11.8
     13   8.93   12.9   17.4   13.5   14.3   5.59   1.76   3.86   1.51
   19.7   15.1      0   11.4   21.8   5.73   15.1   2.16   18.3   19.6
   10.3   13.3   19.4   28.3
 --> sky = sum_j D_j= 533.592
   swp new 16 <-> 9 old; decreasing diss. by -161.129
  Last swap: new 28 <-> 33 old; decreasing diss. by 0.438978
 end{bswap2}: sky = 372.463
 obj= 9.78523
- clara sample  4  if (kall && nunfs...): 
.. kall: T, 
... nrx [0:1]= 1019 999 
... nsel[0:1]= 999 1019 
 [ntt=44, nunfs=0] .. nsel[1:44]= 17 46 61 152 201 223 254 263 268 291 313 331 479 508 528 542 543 601 655 681 746 778 792 888 951 957 999 1010 1019 1081 1085 1105 1110 1122 1136 1231 1265 1272 1307 1342 1365 1393 1395 1467  -> dysta2();
 clara -> s:= max{dys[1..946]} = 77.6857;
 bswap2(*, s=77.6857), 1. BUILD:     new repr. 24
    new repr. 28
  after build: medoids are 24 28
  and min.dist dysma[1:n] are
   13.7   8.04   8.56    2.4   16.4    2.6   5.22   12.2   8.64   16.8
    4.3     16   5.07   7.99   9.29   3.52   6.16   13.9   13.4   13.6
    9.1   7.24   11.4      0   11.8   6.74   2.68      0   2.54   11.2
   13.4     12   13.7   7.04   9.78   10.4   17.3   7.93   1.68   6.57
   10.2   11.7   19.9   11.5
 --> sky = sum_j D_j= 403.513
   swp new 14 <-> 24 old; decreasing diss. by -35.3245
  Last swap: new 38 <-> 14 old; decreasing diss. by 0.398398
 end{bswap2}: sky = 368.188
 obj= 9.95647
- clara sample  5  if (kall && nunfs...): 
.. kall: T, 
... nrx [0:1]= 1019 999 
... nsel[0:1]= 999 1019 
 [ntt=44, nunfs=0] .. nsel[1:44]= 7 38 134 140 282 283 311 329 363 461 496 539 572 585 631 655 665 695 758 792 820 823 912 919 962 999 1019 1121 1140 1166 1189 1192 1202 1204 1260 1297 1315 1321 1326 1422 1431 1432 1463 1488  -> dysta2();
 clara -> s:= max{dys[1..946]} = 73.7802;
 bswap2(*, s=73.7802), 1. BUILD:     new repr. 40
    new repr. 26
  after build: medoids are 26 40
  and min.dist dysma[1:n] are
   5.14   20.6   14.8   10.9   12.3   8.62     10   20.1   12.4   22.6
   6.52   18.8   4.41   11.3   5.33   10.7   12.2    8.8   10.6   12.6
   21.5   10.5   16.4   14.3    6.8      0   9.53   12.6   14.7   8.84
   7.12     13   19.9   12.9   15.6   12.2   10.7   15.3   20.3      0
     16   15.2   10.7   25.7
 --> sky = sum_j D_j= 548.29
   swp new 17 <-> 40 old; decreasing diss. by -133.064
  Last swap: new 17 <-> 40 old; decreasing diss. by 1
 end{bswap2}: sky = 415.226
new best obj= 9.66316
C clara() -> best sample _found_ ; nbest[1:44] =
 c(7,38,134,140,282,283,311,329,363,461,496,539,572,585,631,655,665,695,758,792,
  820,823,912,919,962,999,1019,1121,1140,1166,1189,1192,1202,1204,1260,1297,1315,1321,1326,1422,
  1431,1432,1463,1488)
 resul(),  black() and return() from C.
$objective
[1] 9.663163

$i.med
[1] 665 999

$medoids
           [,1]       [,2]
[1,] -0.7570035 -0.8940899
[2,] 51.5040456  9.4101489

$clusinfo
     size max_diss  av_diss isolation
[1,]  701 30.13143 9.602938 0.5656658
[2,]  799 28.92185 9.716001 0.5429579

> 
> print(clara(xx, 2, samples=50, trace = 2)[clInd])
C clara(): (nsam,nran,n) = (44,50,1500);
- clara sample  1  finding 1st... new k{ran}:
.. kall: FALSE, nsel[ntt=1] = 0
 [ntt=44, nunfs=0]  -> dysta2();
 clara -> s:= max{dys[1..946]} = 84.6494;
 bswap2(), 1. BUILD: 13 6  after build: medoids are  6 13
 --> sky = sum_j D_j= 541.2
  Last swap: new 11 <-> 13 old; decreasing diss. by 1
 end{bswap2}: sky = 436.824
1st proper sample obj= 10.1407
- clara sample  2  if (kall && nunfs...): 
.. kall: T, nsel[ntt=2] = 87
 [ntt=44, nunfs=0]  -> dysta2();
 clara -> s:= max{dys[1..946]} = 82.2326;
 bswap2(), 1. BUILD: 24 27  after build: medoids are 24 27
 --> sky = sum_j D_j= 526.744
  Last swap: new 30 <-> 24 old; decreasing diss. by 1
 end{bswap2}: sky = 415.802
new best obj= 9.77929
- clara sample  3  if (kall && nunfs...): 
.. kall: T, nsel[ntt=2] = 97
 [ntt=44, nunfs=0]  -> dysta2();
 clara -> s:= max{dys[1..946]} = 82.2209;
 bswap2(), 1. BUILD: 9 33  after build: medoids are  9 33
 --> sky = sum_j D_j= 533.592
  Last swap: new 28 <-> 33 old; decreasing diss. by 0.438978
 end{bswap2}: sky = 372.463
 obj= 9.78523
- clara sample  4  if (kall && nunfs...): 
.. kall: T, nsel[ntt=2] = 23
 [ntt=44, nunfs=0]  -> dysta2();
 clara -> s:= max{dys[1..946]} = 77.6857;
 bswap2(), 1. BUILD: 24 28  after build: medoids are 24 28
 --> sky = sum_j D_j= 403.513
  Last swap: new 38 <-> 14 old; decreasing diss. by 0.398398
 end{bswap2}: sky = 368.188
 obj= 9.95647
- clara sample  5  if (kall && nunfs...): 
.. kall: T, nsel[ntt=2] = 61
 [ntt=44, nunfs=0]  -> dysta2();
 clara -> s:= max{dys[1..946]} = 73.7802;
 bswap2(), 1. BUILD: 40 26  after build: medoids are 26 40
 --> sky = sum_j D_j= 548.29
  Last swap: new 17 <-> 40 old; decreasing diss. by 1
 end{bswap2}: sky = 415.226
new best obj= 9.66316
- clara sample  6  if (kall && nunfs...): 
.. kall: T, nsel[ntt=2] = 134
 [ntt=44, nunfs=0]  -> dysta2();
 clara -> s:= max{dys[1..946]} = 76.4132;
 bswap2(), 1. BUILD: 24 40  after build: medoids are 24 40
 --> sky = sum_j D_j= 493.892
  Last swap: new 16 <-> 24 old; decreasing diss. by 1
 end{bswap2}: sky = 382.8
 obj= 10.2053
- clara sample  7  if (kall && nunfs...): 
.. kall: T, nsel[ntt=2] = 179
 [ntt=44, nunfs=0]  -> dysta2();
 clara -> s:= max{dys[1..946]} = 91.2407;
 bswap2(), 1. BUILD: 18 39  after build: medoids are 18 39
 --> sky = sum_j D_j= 559.095
  Last swap: new 41 <-> 20 old; decreasing diss. by 0.410198
 end{bswap2}: sky = 413.093
 obj= 9.68805
- clara sample  8  if (kall && nunfs...): 
.. kall: T, nsel[ntt=2] = 45
 [ntt=44, nunfs=0]  -> dysta2();
 clara -> s:= max{dys[1..946]} = 78.2768;
 bswap2(), 1. BUILD: 37 24  after build: medoids are 24 37
 --> sky = sum_j D_j= 526.826
  Last swap: new 14 <-> 29 old; decreasing diss. by 0.887381
 end{bswap2}: sky = 431.746
 obj= 9.66316
- clara sample  9  if (kall && nunfs...): 
.. kall: T, nsel[ntt=2] = 59
 [ntt=44, nunfs=0]  -> dysta2();
 clara -> s:= max{dys[1..946]} = 85.1138;
 bswap2(), 1. BUILD: 42 24  after build: medoids are 24 42
 --> sky = sum_j D_j= 524.654
  Last swap: new 11 <-> 42 old; decreasing diss. by 1
 end{bswap2}: sky = 397.695
 obj= 10.3746
- clara sample 10  if (kall && nunfs...): 
.. kall: T, nsel[ntt=2] = 119
 [ntt=44, nunfs=0]  -> dysta2();
 clara -> s:= max{dys[1..946]} = 91.3475;
 bswap2(), 1. BUILD: 23 17  after build: medoids are 17 23
 --> sky = sum_j D_j= 606.383
  Last swap: new 21 <-> 17 old; decreasing diss. by 0.597088
 end{bswap2}: sky = 452.021
 obj= 9.75314
- clara sample 11  if (kall && nunfs...): 
.. kall: T, nsel[ntt=2] = 93
 [ntt=44, nunfs=0]  -> dysta2();
 clara -> s:= max{dys[1..946]} = 88.9424;
 bswap2(), 1. BUILD: 5 37  after build: medoids are  5 37
 --> sky = sum_j D_j= 510.544
  Last swap: new 30 <-> 5 old; decreasing diss. by 1
 end{bswap2}: sky = 419.179
new best obj= 9.65359
- clara sample 12  if (kall && nunfs...): 
.. kall: T, nsel[ntt=2] = 44
 [ntt=44, nunfs=0]  -> dysta2();
 clara -> s:= max{dys[1..946]} = 80.4915;
 bswap2(), 1. BUILD: 23 25  after build: medoids are 23 25
 --> sky = sum_j D_j= 423.319
  Last swap: new 1 <-> 23 old; decreasing diss. by 1
 end{bswap2}: sky = 369.493
 obj= 9.78288
- clara sample 13  if (kall && nunfs...): 
.. kall: T, nsel[ntt=2] = 92
 [ntt=44, nunfs=0]  -> dysta2();
 clara -> s:= max{dys[1..946]} = 76.1143;
 bswap2(), 1. BUILD: 22 30  after build: medoids are 22 30
 --> sky = sum_j D_j= 538.28
  Last swap: new 14 <-> 22 old; decreasing diss. by 1
 end{bswap2}: sky = 419.593
 obj= 9.80239
- clara sample 14  if (kall && nunfs...): 
.. kall: T, nsel[ntt=2] = 108
 [ntt=44, nunfs=0]  -> dysta2();
 clara -> s:= max{dys[1..946]} = 79.6275;
 bswap2(), 1. BUILD: 31 35  after build: medoids are 31 35
 --> sky = sum_j D_j= 501.393
  Last swap: new 34 <-> 30 old; decreasing diss. by 0.371241
 end{bswap2}: sky = 404.715
 obj= 9.99603
- clara sample 15  if (kall && nunfs...): 
.. kall: T, nsel[ntt=2] = 41
 [ntt=44, nunfs=0]  -> dysta2();
 clara -> s:= max{dys[1..946]} = 85.1226;
 bswap2(), 1. BUILD: 42 25  after build: medoids are 25 42
 --> sky = sum_j D_j= 479.866
  Last swap: new 10 <-> 42 old; decreasing diss. by 1
 end{bswap2}: sky = 397.846
 obj= 9.91509
- clara sample 16  if (kall && nunfs...): 
.. kall: T, nsel[ntt=2] = 221
 [ntt=44, nunfs=0]  -> dysta2();
 clara -> s:= max{dys[1..946]} = 82.6708;
 bswap2(), 1. BUILD: 7 32  after build: medoids are  7 32
 --> sky = sum_j D_j= 430.691
  Last swap: new 40 <-> 19 old; decreasing diss. by 0.967002
 end{bswap2}: sky = 385.483
 obj= 9.75954
- clara sample 17  if (kall && nunfs...): 
.. kall: T, nsel[ntt=2] = 63
 [ntt=44, nunfs=0]  -> dysta2();
 clara -> s:= max{dys[1..946]} = 75.4038;
 bswap2(), 1. BUILD: 23 35  after build: medoids are 23 35
 --> sky = sum_j D_j= 405.816
  Last swap: new 4 <-> 23 old; decreasing diss. by 1
 end{bswap2}: sky = 332.314
new best obj= 9.65233
- clara sample 18  if (kall && nunfs...): 
.. kall: T, nsel[ntt=2] = 123
 [ntt=44, nunfs=0]  -> dysta2();
 clara -> s:= max{dys[1..946]} = 79.3412;
 bswap2(), 1. BUILD: 19 4  after build: medoids are  4 19
 --> sky = sum_j D_j= 523.479
  Last swap: new 17 <-> 19 old; decreasing diss. by 1
 end{bswap2}: sky = 391.149
 obj= 9.76199
- clara sample 19  if (kall && nunfs...): 
.. kall: T, nsel[ntt=2] = 135
 [ntt=44, nunfs=0]  -> dysta2();
 clara -> s:= max{dys[1..946]} = 81.6923;
 bswap2(), 1. BUILD: 5 4  after build: medoids are  4  5
 --> sky = sum_j D_j= 429.005
  Last swap: new 37 <-> 5 old; decreasing diss. by 1
 end{bswap2}: sky = 391.347
 obj= 9.65233
- clara sample 20  if (kall && nunfs...): 
.. kall: T, nsel[ntt=2] = 84
 [ntt=44, nunfs=0]  -> dysta2();
 clara -> s:= max{dys[1..946]} = 74.6473;
 bswap2(), 1. BUILD: 13 36  after build: medoids are 13 36
 --> sky = sum_j D_j= 397.89
  Last swap: new 16 <-> 36 old; decreasing diss. by 0.311398
 end{bswap2}: sky = 354.641
new best obj= 9.63025
- clara sample 21  if (kall && nunfs...): 
.. kall: T, nsel[ntt=2] = 128
 [ntt=44, nunfs=0]  -> dysta2();
 clara -> s:= max{dys[1..946]} = 82.2868;
 bswap2(), 1. BUILD: 35 34  after build: medoids are 34 35
 --> sky = sum_j D_j= 508.413
  Last swap: new 31 <-> 35 old; decreasing diss. by 1
 end{bswap2}: sky = 362.906
 obj= 9.65359
- clara sample 22  if (kall && nunfs...): 
.. kall: T, nsel[ntt=2] = 105
 [ntt=44, nunfs=0]  -> dysta2();
 clara -> s:= max{dys[1..946]} = 75.1174;
 bswap2(), 1. BUILD: 41 29  after build: medoids are 29 41
 --> sky = sum_j D_j= 493.584
  Last swap: new 23 <-> 41 old; decreasing diss. by 1
 end{bswap2}: sky = 353.321
 obj= 9.63025
- clara sample 23  if (kall && nunfs...): 
.. kall: T, nsel[ntt=2] = 204
 [ntt=44, nunfs=0]  -> dysta2();
 clara -> s:= max{dys[1..946]} = 73.7656;
 bswap2(), 1. BUILD: 13 11  after build: medoids are 11 13
 --> sky = sum_j D_j= 705.978
  Last swap: new 26 <-> 13 old; decreasing diss. by 1
 end{bswap2}: sky = 441.528
 obj= 9.64875
- clara sample 24  if (kall && nunfs...): 
.. kall: T, nsel[ntt=2] = 87
 [ntt=44, nunfs=0]  -> dysta2();
 clara -> s:= max{dys[1..946]} = 87.1927;
 bswap2(), 1. BUILD: 13 7  after build: medoids are  7 13
 --> sky = sum_j D_j= 509.62
  Last swap: new 4 <-> 7 old; decreasing diss. by 0.692058
 end{bswap2}: sky = 417.527
 obj= 9.95795
- clara sample 25  if (kall && nunfs...): 
.. kall: T, nsel[ntt=2] = 140
 [ntt=44, nunfs=0]  -> dysta2();
 clara -> s:= max{dys[1..946]} = 72.5392;
 bswap2(), 1. BUILD: 7 31  after build: medoids are  7 31
 --> sky = sum_j D_j= 420.983
  Last swap: new 27 <-> 7 old; decreasing diss. by 1
 end{bswap2}: sky = 405.433
 obj= 9.63025
- clara sample 26  if (kall && nunfs...): 
.. kall: T, nsel[ntt=2] = 273
 [ntt=44, nunfs=0]  -> dysta2();
 clara -> s:= max{dys[1..946]} = 83.0823;
 bswap2(), 1. BUILD: 34 39  after build: medoids are 34 39
 --> sky = sum_j D_j= 633.387
  Last swap: new 6 <-> 34 old; decreasing diss. by 1
 end{bswap2}: sky = 471.03
new best obj= 9.61429
- clara sample 27  if (kall && nunfs...): 
.. kall: T, nsel[ntt=2] = 128
 [ntt=44, nunfs=0]  -> dysta2();
 clara -> s:= max{dys[1..946]} = 79.4914;
 bswap2(), 1. BUILD: 43 37  after build: medoids are 37 43
 --> sky = sum_j D_j= 524.694
  Last swap: new 6 <-> 43 old; decreasing diss. by 1
 end{bswap2}: sky = 426.746
 obj= 9.61429
- clara sample 28  if (kall && nunfs...): 
.. kall: T, nsel[ntt=2] = 74
 [ntt=44, nunfs=0]  -> dysta2();
 clara -> s:= max{dys[1..946]} = 99.9366;
 bswap2(), 1. BUILD: 40 11  after build: medoids are 11 40
 --> sky = sum_j D_j= 515.562
  Last swap: new 38 <-> 34 old; decreasing diss. by 0.898884
 end{bswap2}: sky = 403.623
 obj= 9.70784
- clara sample 29  if (kall && nunfs...): 
.. kall: T, nsel[ntt=2] = 95
 [ntt=44, nunfs=0]  -> dysta2();
 clara -> s:= max{dys[1..946]} = 89.4153;
 bswap2(), 1. BUILD: 2 35  after build: medoids are  2 35
 --> sky = sum_j D_j= 518.835
  Last swap: new 7 <-> 6 old; decreasing diss. by 0.00389548
 end{bswap2}: sky = 423
 obj= 9.61429
- clara sample 30  if (kall && nunfs...): 
.. kall: T, nsel[ntt=2] = 160
 [ntt=44, nunfs=0]  -> dysta2();
 clara -> s:= max{dys[1..946]} = 75.5398;
 bswap2(), 1. BUILD: 17 11  after build: medoids are 11 17
 --> sky = sum_j D_j= 464.06
  Last swap: new 13 <-> 11 old; decreasing diss. by 0.230267
 end{bswap2}: sky = 398.565
 obj= 9.61429
- clara sample 31  if (kall && nunfs...): 
.. kall: T, nsel[ntt=2] = 45
 [ntt=44, nunfs=0]  -> dysta2();
 clara -> s:= max{dys[1..946]} = 78.2302;
 bswap2(), 1. BUILD: 40 19  after build: medoids are 19 40
 --> sky = sum_j D_j= 580.438
  Last swap: new 13 <-> 40 old; decreasing diss. by 1
 end{bswap2}: sky = 367.223
 obj= 9.91942
- clara sample 32  if (kall && nunfs...): 
.. kall: T, nsel[ntt=2] = 56
 [ntt=44, nunfs=0]  -> dysta2();
 clara -> s:= max{dys[1..946]} = 84.5005;
 bswap2(), 1. BUILD: 12 32  after build: medoids are 12 32
 --> sky = sum_j D_j= 444.913
  Last swap: new 27 <-> 7 old; decreasing diss. by 0.228504
 end{bswap2}: sky = 363.142
 obj= 9.77547
- clara sample 33  if (kall && nunfs...): 
.. kall: T, nsel[ntt=2] = 50
 [ntt=44, nunfs=0]  -> dysta2();
 clara -> s:= max{dys[1..946]} = 76.488;
 bswap2(), 1. BUILD: 25 26  after build: medoids are 25 26
 --> sky = sum_j D_j= 419.591
  Last swap: new 38 <-> 5 old; decreasing diss. by 0.631655
 end{bswap2}: sky = 357.699
 obj= 9.61429
- clara sample 34  if (kall && nunfs...): 
.. kall: T, nsel[ntt=2] = 165
 [ntt=44, nunfs=0]  -> dysta2();
 clara -> s:= max{dys[1..946]} = 78.0499;
 bswap2(), 1. BUILD: 40 37  after build: medoids are 37 40
 --> sky = sum_j D_j= 424.572
  Last swap: new 9 <-> 10 old; decreasing diss. by 0.233331
 end{bswap2}: sky = 354.223
 obj= 10.2203
- clara sample 35  if (kall && nunfs...): 
.. kall: T, nsel[ntt=2] = 123
 [ntt=44, nunfs=0]  -> dysta2();
 clara -> s:= max{dys[1..946]} = 79.8045;
 bswap2(), 1. BUILD: 5 42  after build: medoids are  5 42
 --> sky = sum_j D_j= 515.209
  Last swap: new 41 <-> 42 old; decreasing diss. by 0.913161
 end{bswap2}: sky = 397.716
 obj= 9.6157
- clara sample 36  if (kall && nunfs...): 
.. kall: T, nsel[ntt=2] = 58
 [ntt=44, nunfs=0]  -> dysta2();
 clara -> s:= max{dys[1..946]} = 83.3107;
 bswap2(), 1. BUILD: 10 34  after build: medoids are 10 34
 --> sky = sum_j D_j= 503.551
  Last swap: new 16 <-> 7 old; decreasing diss. by 0.893467
 end{bswap2}: sky = 402.752
 obj= 9.61429
- clara sample 37  if (kall && nunfs...): 
.. kall: T, nsel[ntt=2] = 94
 [ntt=44, nunfs=0]  -> dysta2();
 clara -> s:= max{dys[1..946]} = 82.2963;
 bswap2(), 1. BUILD: 1 31  after build: medoids are  1 31
 --> sky = sum_j D_j= 712.371
  Last swap: new 7 <-> 1 old; decreasing diss. by 1
 end{bswap2}: sky = 447.183
 obj= 9.61429
- clara sample 38  if (kall && nunfs...): 
.. kall: T, nsel[ntt=2] = 117
 [ntt=44, nunfs=0]  -> dysta2();
 clara -> s:= max{dys[1..946]} = 95.8048;
 bswap2(), 1. BUILD: 26 1  after build: medoids are  1 26
 --> sky = sum_j D_j= 516.385
  Last swap: new 15 <-> 1 old; decreasing diss. by 0.188094
 end{bswap2}: sky = 425.344
 obj= 9.86458
- clara sample 39  if (kall && nunfs...): 
.. kall: T, nsel[ntt=2] = 63
 [ntt=44, nunfs=0]  -> dysta2();
 clara -> s:= max{dys[1..946]} = 86.6027;
 bswap2(), 1. BUILD: 37 6  after build: medoids are  6 37
 --> sky = sum_j D_j= 481.819
  Last swap: new 23 <-> 6 old; decreasing diss. by 0.242997
 end{bswap2}: sky = 417.783
 obj= 9.96942
- clara sample 40  if (kall && nunfs...): 
.. kall: T, nsel[ntt=2] = 96
 [ntt=44, nunfs=0]  -> dysta2();
 clara -> s:= max{dys[1..946]} = 86.7782;
 bswap2(), 1. BUILD: 27 21  after build: medoids are 21 27
 --> sky = sum_j D_j= 724.939
  Last swap: new 10 <-> 27 old; decreasing diss. by 1
 end{bswap2}: sky = 428.52
 obj= 10.8484
- clara sample 41  if (kall && nunfs...): 
.. kall: T, nsel[ntt=2] = 125
 [ntt=44, nunfs=0]  -> dysta2();
 clara -> s:= max{dys[1..946]} = 82.3384;
 bswap2(), 1. BUILD: 2 29  after build: medoids are  2 29
 --> sky = sum_j D_j= 714.103
  Last swap: new 6 <-> 2 old; decreasing diss. by 1
 end{bswap2}: sky = 411.244
 obj= 10.3511
- clara sample 42  if (kall && nunfs...): 
.. kall: T, nsel[ntt=2] = 23
 [ntt=44, nunfs=0]  -> dysta2();
 clara -> s:= max{dys[1..946]} = 74.2665;
 bswap2(), 1. BUILD: 3 30  after build: medoids are  3 30
 --> sky = sum_j D_j= 541.34
  Last swap: new 21 <-> 30 old; decreasing diss. by 0.0870194
 end{bswap2}: sky = 413.299
 obj= 10.5262
- clara sample 43  if (kall && nunfs...): 
.. kall: T, nsel[ntt=2] = 112
 [ntt=44, nunfs=0]  -> dysta2();
 clara -> s:= max{dys[1..946]} = 70.5586;
 bswap2(), 1. BUILD: 41 31  after build: medoids are 31 41
 --> sky = sum_j D_j= 383.305
  Last swap: new 14 <-> 41 old; decreasing diss. by 1
 end{bswap2}: sky = 323.571
 obj= 10.2205
- clara sample 44  if (kall && nunfs...): 
.. kall: T, nsel[ntt=2] = 100
 [ntt=44, nunfs=0]  -> dysta2();
 clara -> s:= max{dys[1..946]} = 81.0334;
 bswap2(), 1. BUILD: 28 13  after build: medoids are 13 28
 --> sky = sum_j D_j= 695.34
  Last swap: new 8 <-> 13 old; decreasing diss. by 0.260756
 end{bswap2}: sky = 393.903
 obj= 11.2797
- clara sample 45  if (kall && nunfs...): 
.. kall: T, nsel[ntt=2] = 186
 [ntt=44, nunfs=0]  -> dysta2();
 clara -> s:= max{dys[1..946]} = 80.4615;
 bswap2(), 1. BUILD: 2 39  after build: medoids are  2 39
 --> sky = sum_j D_j= 488.193
  Last swap: new 9 <-> 39 old; decreasing diss. by 0.396945
 end{bswap2}: sky = 422.85
 obj= 9.97243
- clara sample 46  if (kall && nunfs...): 
.. kall: T, nsel[ntt=2] = 72
 [ntt=44, nunfs=0]  -> dysta2();
 clara -> s:= max{dys[1..946]} = 90.7292;
 bswap2(), 1. BUILD: 22 37  after build: medoids are 22 37
 --> sky = sum_j D_j= 559.363
  Last swap: new 34 <-> 22 old; decreasing diss. by 1
 end{bswap2}: sky = 423.583
 obj= 9.75509
- clara sample 47  if (kall && nunfs...): 
.. kall: T, nsel[ntt=2] = 141
 [ntt=44, nunfs=0]  -> dysta2();
 clara -> s:= max{dys[1..946]} = 81.6717;
 bswap2(), 1. BUILD: 41 2  after build: medoids are  2 41
 --> sky = sum_j D_j= 463.14
  Last swap: new 34 <-> 2 old; decreasing diss. by 0.879526
 end{bswap2}: sky = 391.527
 obj= 9.86629
- clara sample 48  if (kall && nunfs...): 
.. kall: T, nsel[ntt=2] = 67
 [ntt=44, nunfs=0]  -> dysta2();
 clara -> s:= max{dys[1..946]} = 75.0878;
 bswap2(), 1. BUILD: 42 31  after build: medoids are 31 42
 --> sky = sum_j D_j= 570.247
  Last swap: new 37 <-> 31 old; decreasing diss. by 0.844474
 end{bswap2}: sky = 408.073
 obj= 9.92563
- clara sample 49  if (kall && nunfs...): 
.. kall: T, nsel[ntt=2] = 121
 [ntt=44, nunfs=0]  -> dysta2();
 clara -> s:= max{dys[1..946]} = 87.5173;
 bswap2(), 1. BUILD: 13 34  after build: medoids are 13 34
 --> sky = sum_j D_j= 504.821
  Last swap: new 35 <-> 13 old; decreasing diss. by 1
 end{bswap2}: sky = 408.675
 obj= 9.76274
- clara sample 50  if (kall && nunfs...): 
.. kall: T, nsel[ntt=2] = 78
 [ntt=44, nunfs=0]  -> dysta2();
 clara -> s:= max{dys[1..946]} = 87.7511;
 bswap2(), 1. BUILD: 23 30  after build: medoids are 23 30
 --> sky = sum_j D_j= 502.458
  Last swap: new 12 <-> 23 old; decreasing diss. by 1
 end{bswap2}: sky = 400.127
 obj= 9.64357
C clara() -> best sample _found_ ; nbest[1:44] =
 c(65,126,128,136,211,219,340,413,420,421,432,433,463,498,528,546,558,565,606,615,
  621,705,715,722,744,754,788,840,842,935,964,1001,1010,1011,1082,1105,1106,1138,1147,1239,
  1242,1326,1347,1385)
 resul(),  black() and return() from C.
$objective
[1] 9.61429

$i.med
[1] 1147  219

$medoids
            [,1]       [,2]
[1,]  0.04086397 -0.4319988
[2,] 51.31958457 11.3088406

$clusinfo
     size max_diss  av_diss isolation
[1,]  701 29.22993 9.582446 0.5556424
[2,]  799 28.46765 9.642228 0.5411520

> ##                             ^^^^^^^^^ a bit less output ...
> ## for sample 45
> ## From that output I gather the sample indices nsel[] and all k{ran} are
> ii <- c(194, 1411,
+         1430,398,570,72,27,62,1301,368,1390,991,296,431,1019,186,558,258,413,
+         647,585,1352,1073,873,377,711,1498,865,1436,1335,189,622,760,226,146,
+         145,1349,382,1368,934,204,303,856,1489)
> ## Trying
> pp <- pam(x[ii,], k =2) # gives no problem
> 
> for(i in 1:19)
+     print(clara(x[sample(nrow(x)),], 2, samples = 50)[clInd])
$objective
[1] 9.611541

$i.med
[1] 521  20

$medoids
          [,1]      [,2]
[1,] 50.345402 10.336172
[2,] -1.017259 -1.286059

$clusinfo
     size max_diss  av_diss isolation
[1,]  800 30.06899 9.612016 0.5709897
[2,]  700 29.57957 9.610998 0.5616961

$objective
[1] 9.586637

$i.med
[1]  448 1406

$medoids
            [,1]        [,2]
[1,]  0.04089097  0.02320045
[2,] 49.86457170 10.52278658

$clusinfo
     size max_diss  av_diss isolation
[1,]  701 28.92506 9.585969 0.5680717
[2,]  799 28.27901 9.587224 0.5553837

$objective
[1] 9.585964

$i.med
[1] 451 740

$medoids
           [,1]       [,2]
[1,] -0.5009691 -0.6486965
[2,] 50.3454017 10.3361719

$clusinfo
     size max_diss  av_diss isolation
[1,]  701 29.77696 9.585453 0.5724200
[2,]  799 27.91861 9.586413 0.5366958

$objective
[1] 9.583641

$i.med
[1] 539 387

$medoids
           [,1]       [,2]
[1,] 49.8645717 10.5227866
[2,] -0.1009724 -0.4444724

$clusinfo
     size max_diss  av_diss isolation
[1,]  799 28.27901 9.587224 0.5528101
[2,]  701 29.34325 9.579557 0.5736142

$objective
[1] 9.58722

$i.med
[1]  58 207

$medoids
            [,1]       [,2]
[1,]  0.04086397 -0.4319988
[2,] 50.53763943 11.1072301

$clusinfo
     size max_diss  av_diss isolation
[1,]  701 29.22993 9.582446 0.5643014
[2,]  799 28.55938 9.591408 0.5513560

$objective
[1] 9.583641

$i.med
[1] 676 337

$medoids
           [,1]       [,2]
[1,] -0.1009724 -0.4444724
[2,] 49.8645717 10.5227866

$clusinfo
     size max_diss  av_diss isolation
[1,]  701 29.34325 9.579557 0.5736142
[2,]  799 28.27901 9.587224 0.5528101

$objective
[1] 9.61429

$i.med
[1]  152 1319

$medoids
            [,1]       [,2]
[1,] 51.31958457 11.3088406
[2,]  0.04086397 -0.4319988

$clusinfo
     size max_diss  av_diss isolation
[1,]  799 28.46765 9.642228 0.5411520
[2,]  701 29.22993 9.582446 0.5556424

$objective
[1] 9.605953

$i.med
[1] 1033  864

$medoids
           [,1]       [,2]
[1,] -0.5554117  0.3590557
[2,] 50.4054368 11.4682101

$clusinfo
     size max_diss  av_diss isolation
[1,]  701 29.15394 9.604919 0.5589579
[2,]  799 28.94365 9.606860 0.5549261

$objective
[1] 9.583485

$i.med
[1] 631 665

$medoids
           [,1]       [,2]
[1,] 50.3454017 10.3361719
[2,] -0.4618501 -0.3644744

$clusinfo
     size max_diss  av_diss isolation
[1,]  799 27.91861 9.586413 0.5377042
[2,]  701 29.55835 9.580148 0.5692851

$objective
[1] 9.583641

$i.med
[1] 1231  925

$medoids
           [,1]       [,2]
[1,] -0.1009724 -0.4444724
[2,] 49.8645717 10.5227866

$clusinfo
     size max_diss  av_diss isolation
[1,]  701 29.34325 9.579557 0.5736142
[2,]  799 28.27901 9.587224 0.5528101

$objective
[1] 9.584559

$i.med
[1]  979 1481

$medoids
            [,1]       [,2]
[1,]  0.04086397 -0.4319988
[2,] 50.34540167 10.3361719

$clusinfo
     size max_diss  av_diss isolation
[1,]  701 29.22993 9.582446 0.5681877
[2,]  799 27.91861 9.586413 0.5426975

$objective
[1] 9.583641

$i.med
[1] 1182 1333

$medoids
           [,1]       [,2]
[1,] 49.8645717 10.5227866
[2,] -0.1009724 -0.4444724

$clusinfo
     size max_diss  av_diss isolation
[1,]  799 28.27901 9.587224 0.5528101
[2,]  701 29.34325 9.579557 0.5736142

$objective
[1] 9.589808

$i.med
[1] 1406 1112

$medoids
            [,1]       [,2]
[1,] 50.34540167 10.3361719
[2,]  0.03259824  0.2228907

$clusinfo
     size max_diss  av_diss isolation
[1,]  799 27.91861 9.586413 0.5440191
[2,]  701 28.79880 9.593678 0.5611705

$objective
[1] 9.583915

$i.med
[1] 608 146

$medoids
           [,1]       [,2]
[1,] -0.4618501 -0.3644744
[2,] 49.8645717 10.5227866

$clusinfo
     size max_diss  av_diss isolation
[1,]  700 28.55288 9.551608 0.5545261
[2,]  800 29.55445 9.612183 0.5739776

$objective
[1] 9.583641

$i.med
[1] 1042  201

$medoids
           [,1]       [,2]
[1,] 49.8645717 10.5227866
[2,] -0.1009724 -0.4444724

$clusinfo
     size max_diss  av_diss isolation
[1,]  799 28.27901 9.587224 0.5528101
[2,]  701 29.34325 9.579557 0.5736142

$objective
[1] 9.603614

$i.med
[1] 1016 1459

$medoids
           [,1]       [,2]
[1,] 50.0601381  9.6999505
[2,] -0.5009691 -0.6486965

$clusinfo
     size max_diss  av_diss isolation
[1,]  799 27.83521 9.619546 0.5393449
[2,]  701 29.77696 9.585453 0.5769689

$objective
[1] 9.603018

$i.med
[1] 747 329

$medoids
           [,1]       [,2]
[1,] -0.7570035 -0.8940899
[2,] 49.8526971 11.3178899

$clusinfo
     size max_diss  av_diss isolation
[1,]  700 29.13678 9.573612 0.5596531
[2,]  800 29.31755 9.628749 0.5631253

$objective
[1] 9.612711

$i.med
[1] 975 593

$medoids
           [,1]      [,2]
[1,] -0.5554117 0.3590557
[2,] 50.0601381 9.6999505

$clusinfo
     size max_diss  av_diss isolation
[1,]  701 29.15394 9.604919 0.5664231
[2,]  799 27.83521 9.619546 0.5408020

$objective
[1] 9.583915

$i.med
[1]  457 1078

$medoids
           [,1]       [,2]
[1,] -0.4618501 -0.3644744
[2,] 49.8645717 10.5227866

$clusinfo
     size max_diss  av_diss isolation
[1,]  700 28.55288 9.551608 0.5545261
[2,]  800 29.55445 9.612183 0.5739776

> 
> clara(x, 2, samples = 101)[clInd]
$objective
[1] 9.583209

$i.med
[1]  610 1348

$medoids
           [,1]       [,2]
[1,] -0.1009724 -0.4444724
[2,] 50.3454017 10.3361719

$clusinfo
     size max_diss  av_diss isolation
[1,]  701 29.34325 9.579557 0.5688279
[2,]  799 27.91861 9.586413 0.5412108

> clara(x, 2, samples = 149)[clInd]
$objective
[1] 9.583209

$i.med
[1]  610 1348

$medoids
           [,1]       [,2]
[1,] -0.1009724 -0.4444724
[2,] 50.3454017 10.3361719

$clusinfo
     size max_diss  av_diss isolation
[1,]  701 29.34325 9.579557 0.5688279
[2,]  799 27.91861 9.586413 0.5412108

> clara(x, 2, samples = 200)[clInd]
$objective
[1] 9.583209

$i.med
[1]  610 1348

$medoids
           [,1]       [,2]
[1,] -0.1009724 -0.4444724
[2,] 50.3454017 10.3361719

$clusinfo
     size max_diss  av_diss isolation
[1,]  701 29.34325 9.579557 0.5688279
[2,]  799 27.91861 9.586413 0.5412108

> ## Note that this last one is practically identical to the slower  pam() one
> 
> x[print(sample(length(x), 20))] <- NA
 [1] 2602 1026 1287  708   21 1768  759 2213 1255 2094 1919 2268 2055 2667  872
[16]  357 1444 2831  537 1763
> clara(x, 2, samples = 50)[clInd]
$objective
[1] 8.3444

$i.med
[1]  21 876

$medoids
         [,1]      [,2]
[1,]       NA  4.090334
[2,] 50.61538 14.930754

$clusinfo
     size max_diss  av_diss isolation
[1,] 1029 35.44244 8.571381  2.311865
[2,]  471 87.53589 7.760733  5.709855

Warning message:
In clara(x, 2, samples = 50) :
  Distance computations with NAs: using correct instead of pre-2016 wrong formula.
Use  'correct.d=FALSE'  to get previous results or set 'correct.d=TRUE' explicitly
to suppress this warning.
> 
> ###--- Start a version of  example(clara) -------
> 
> ## xclara : artificial data with 3 clusters of 1000 bivariate objects each.
> data(xclara)
> (clx3 <- clara(xclara, 3))
Call:    clara(x = xclara, k = 3) 
Medoids:
            V1        V2
[1,]  5.553391 13.306260
[2,] 43.198760 60.360720
[3,] 74.591890 -6.969018
Objective function:  13.225
Clustering vector:   int [1:3000] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...
Cluster sizes:           900 1148 952 
Best sample:
 [1]   20   30   46   91   92  169  179  187  209  223  382  450  555  971 1004
[16] 1025 1058 1277 1281 1302 1319 1361 1362 1513 1591 1623 1628 1729 1752 1791
[31] 1907 1917 1946 2064 2089 2498 2527 2537 2545 2591 2672 2722 2729 2790 2797
[46] 2852

Available components:
 [1] "sample"     "medoids"    "i.med"      "clustering" "objective" 
 [6] "clusinfo"   "diss"       "call"       "silinfo"    "data"      
> ## Plot similar to Figure 5 in Struyf et al (1996)
> plot(clx3)
> 
> ## The  rngR = TRUE case is currently in the non-strict tests
> ## ./clara-ex.R
> ## ~~~~~~~~~~~~
> 
> ## trace output checking
> RNGversion("4.3"); RNGkind()
[1] "Mersenne-Twister" "Inversion"        "Rejection"       
> set.seed(144)
> xc120 <- xclara[sort(sample.int(nrow(xclara), 120)), ]
> cx3.1 <- clara(xc120, 3, trace = 1)
C clara(): (nsam,nran,n) = (46,5,120);
- clara sample  1  [ntt=46, nunfs=0]  -> dysta2();  obj= 13.4142
- clara sample  2  [ntt=46, nunfs=0]  -> dysta2();  obj= 13.349
- clara sample  3  [ntt=46, nunfs=0]  -> dysta2();  obj= 12.8491
- clara sample  4  [ntt=46, nunfs=0]  -> dysta2();  obj= 12.6975
- clara sample  5  [ntt=46, nunfs=0]  -> dysta2();  obj= 13.7493
C clara() -> best sample _found_  resul(),  black() and return() from C.
> cx3.2 <- clara(xc120, 3, trace = 2)
C clara(): (nsam,nran,n) = (46,5,120);
- clara sample  1  finding 1st... new k{ran}:
.. kall: FALSE, nsel[ntt=1] = 0
 [ntt=46, nunfs=0]  -> dysta2();
 clara -> s:= max{dys[1..1035]} = 115.819;
 bswap2(), 1. BUILD: 7 20 44  after build: medoids are  7 20 44
 --> sky = sum_j D_j= 711.359
  Last swap: new 3 <-> 7 old; decreasing diss. by 1
 end{bswap2}: sky = 570.725
1st proper sample obj= 13.4142
- clara sample  2  if (kall && nunfs...): 
.. kall: T, nsel[ntt=3] = 9
 [ntt=46, nunfs=0]  -> dysta2();
 clara -> s:= max{dys[1..1035]} = 114.718;
 bswap2(), 1. BUILD: 17 44 9  after build: medoids are  9 17 44
 --> sky = sum_j D_j= 786.108
  Last swap: new 33 <-> 17 old; decreasing diss. by 1
 end{bswap2}: sky = 617.268
new best obj= 13.349
- clara sample  3  if (kall && nunfs...): 
.. kall: T, nsel[ntt=3] = 8
 [ntt=46, nunfs=0]  -> dysta2();
 clara -> s:= max{dys[1..1035]} = 109.395;
 bswap2(), 1. BUILD: 27 11 44  after build: medoids are 11 27 44
 --> sky = sum_j D_j= 774.014
  Last swap: new 5 <-> 11 old; decreasing diss. by 1
 end{bswap2}: sky = 532.229
new best obj= 12.8491
- clara sample  4  if (kall && nunfs...): 
.. kall: T, nsel[ntt=3] = 5
 [ntt=46, nunfs=0]  -> dysta2();
 clara -> s:= max{dys[1..1035]} = 111.407;
 bswap2(), 1. BUILD: 15 41 9  after build: medoids are  9 15 41
 --> sky = sum_j D_j= 702.577
  Last swap: new 31 <-> 41 old; decreasing diss. by 0.561914
 end{bswap2}: sky = 590.348
new best obj= 12.6975
- clara sample  5  if (kall && nunfs...): 
.. kall: T, nsel[ntt=3] = 11
 [ntt=46, nunfs=0]  -> dysta2();
 clara -> s:= max{dys[1..1035]} = 115.819;
 bswap2(), 1. BUILD: 27 12 45  after build: medoids are 12 27 45
 --> sky = sum_j D_j= 810.101
  Last swap: new 21 <-> 33 old; decreasing diss. by 0.313188
 end{bswap2}: sky = 559.796
 obj= 13.7493
C clara() -> best sample _found_ ; nbest[1:46] =
 c(1,3,8,11,12,20,23,25,27,29,32,37,40,41,44,46,47,48,51,52,
  53,54,56,61,64,66,74,77,81,88,90,92,94,95,96,97,101,104,106,107,
  110,114,115,116,118,120)
 resul(),  black() and return() from C.
> cx3.3 <- clara(xc120, 3, trace = 3)
C clara(): (nsam,nran,n) = (46,5,120);
- clara sample  1  finding 1st... new k{ran}:
.. kall: FALSE, 
... nrx [0:2]= 0 0 0 
... nsel[0:0]= 2 
 [ntt=46, nunfs=0] .. nsel[1:46]= 2 5 7 9 12 14 16 20 25 26 27 32 33 34 35 37 38 42 48 52 58 64 65 69 72 73 78 81 83 84 87 90 92 93 96 99 100 103 104 105 106 108 109 110 111 120  -> dysta2();
 clara -> s:= max{dys[1..1035]} = 115.819;
 bswap2(*, s=115.819), 1. BUILD:     new repr. 7
    new repr. 20
    new repr. 44
  after build: medoids are  7 20 44
  and min.dist dysma[1:n] are
   35.4   25.1   17.2   45.5   31.6   22.8      0   14.5     13   40.7
   17.1   13.8     34   4.46   26.3   16.7   22.8   15.2   5.33      0
   8.82   28.1   28.7   18.1   8.11   5.51   6.57   8.57   2.58   6.01
   9.96   11.2   24.1   21.3   12.9   5.18   6.63   8.49   20.3   4.64
   12.1   3.79   13.9      0   13.1   21.1
 --> sky = sum_j D_j= 711.359
   swp new 3 <-> 7 old; decreasing diss. by -140.634
  Last swap: new 3 <-> 7 old; decreasing diss. by 1
 end{bswap2}: sky = 570.725
1st proper sample obj= 13.4142
- clara sample  2  if (kall && nunfs...): 
.. kall: T, 
... nrx [0:2]= 7 52 110 
... nsel[0:2]= 7 52 110 
 [ntt=46, nunfs=0] .. nsel[1:46]= 2 4 7 8 9 12 16 18 23 26 35 37 38 39 41 52 53 57 58 61 64 67 71 73 74 75 77 78 80 81 82 83 84 87 91 92 97 100 102 104 105 107 109 110 112 115  -> dysta2();
 clara -> s:= max{dys[1..1035]} = 114.718;
 bswap2(*, s=114.718), 1. BUILD:     new repr. 17
    new repr. 44
    new repr. 9
  after build: medoids are  9 17 44
  and min.dist dysma[1:n] are
   7.72     10   11.9   5.68   26.6   10.8   28.2   20.3      0   14.5
   10.9   31.1   11.7   34.8   22.4   21.6      0   18.9   21.2   8.36
   10.6   24.9   28.9     26   29.2   18.8   14.4   18.6   31.7   13.5
   21.9   21.1   15.6   31.5   14.7   24.1   19.8   6.63   13.8   20.3
   4.64   16.6   13.9      0   10.3   17.8
 --> sky = sum_j D_j= 786.108
   swp new 33 <-> 17 old; decreasing diss. by -168.839
  Last swap: new 33 <-> 17 old; decreasing diss. by 1
 end{bswap2}: sky = 617.268
new best obj= 13.349
- clara sample  3  if (kall && nunfs...): 
.. kall: T, 
... nrx [0:2]= 23 84 110 
... nsel[0:2]= 23 84 110 
 [ntt=46, nunfs=0] .. nsel[1:46]= 1 2 4 5 8 9 13 17 18 21 22 23 24 26 27 39 41 43 44 49 52 53 55 60 63 64 65 66 70 72 73 77 81 84 87 89 90 91 99 102 104 105 108 110 112 118  -> dysta2();
 clara -> s:= max{dys[1..1035]} = 109.395;
 bswap2(*, s=109.395), 1. BUILD:     new repr. 27
    new repr. 11
    new repr. 44
  after build: medoids are 11 27 44
  and min.dist dysma[1:n] are
   12.6   18.9     16    8.1   6.03   31.1   15.1   5.77   9.37   16.9
      0   11.3   10.7     25   1.54   38.7   22.1   34.8   4.99   17.1
   28.7   12.9   21.6   17.7   27.1   21.6      0   38.5   15.9   23.4
     34     25   20.3   23.5   37.5     28   11.2   14.7   5.18   13.8
   20.3   4.64   3.79      0   10.3   8.28
 --> sky = sum_j D_j= 774.014
   swp new 33 <-> 27 old; decreasing diss. by -218.738
   swp new 5 <-> 11 old; decreasing diss. by -23.0466
  Last swap: new 5 <-> 11 old; decreasing diss. by 1
 end{bswap2}: sky = 532.229
new best obj= 12.8491
- clara sample  4  if (kall && nunfs...): 
.. kall: T, 
... nrx [0:2]= 8 81 110 
... nsel[0:2]= 8 81 110 
 [ntt=46, nunfs=0] .. nsel[1:46]= 1 3 8 11 12 20 23 25 27 29 32 37 40 41 44 46 47 48 51 52 53 54 56 61 64 66 74 77 81 88 90 92 94 95 96 97 101 104 106 107 110 114 115 116 118 120  -> dysta2();
 clara -> s:= max{dys[1..1035]} = 111.407;
 bswap2(*, s=111.407), 1. BUILD:     new repr. 15
    new repr. 41
    new repr. 9
  after build: medoids are  9 15 41
  and min.dist dysma[1:n] are
   12.8      9   6.37   10.4   16.7   5.34   11.1   9.52      0   4.43
   15.8   36.9   10.6   19.5      0   14.1   13.9   29.1   17.9   24.2
   8.48   7.37     14   8.44   18.2   36.4   24.5     20   15.7   37.6
   11.2   24.1     27   17.9   12.9   19.8   1.78   20.3   12.1   16.6
      0   22.9   17.8   10.2   8.28   21.1
 --> sky = sum_j D_j= 702.577
   swp new 29 <-> 15 old; decreasing diss. by -112.229
  Last swap: new 31 <-> 41 old; decreasing diss. by 0.561914
 end{bswap2}: sky = 590.348
new best obj= 12.6975
- clara sample  5  if (kall && nunfs...): 
.. kall: T, 
... nrx [0:2]= 27 81 110 
... nsel[0:2]= 27 81 110 
 [ntt=46, nunfs=0] .. nsel[1:46]= 2 3 4 6 9 10 11 15 18 19 21 27 28 30 31 35 38 42 45 46 50 51 52 53 56 61 62 64 69 70 73 77 81 83 87 91 96 103 104 107 110 111 112 116 118 119  -> dysta2();
 clara -> s:= max{dys[1..1035]} = 115.819;
 bswap2(*, s=115.819), 1. BUILD:     new repr. 27
    new repr. 12
    new repr. 45
  after build: medoids are 12 27 45
  and min.dist dysma[1:n] are
   18.5      9   14.9   2.66   32.3   10.7   10.4   12.8   9.21   11.6
   18.3      0   19.7   24.9   2.77   12.7   15.4   46.5   16.8   25.2
   22.6   27.9     33   11.7   15.3   17.9      0   14.4   47.4   24.1
   37.6   26.1   24.5   32.2   42.8   18.2     16   2.98   12.2    8.3
   8.28   13.3     10   7.83      0   20.9
 --> sky = sum_j D_j= 810.101
   swp new 33 <-> 27 old; decreasing diss. by -247.879
   swp new 8 <-> 12 old; decreasing diss. by -2.42584
  Last swap: new 21 <-> 33 old; decreasing diss. by 0.313188
 end{bswap2}: sky = 559.796
 obj= 13.7493
C clara() -> best sample _found_ ; nbest[1:46] =
 c(1,3,8,11,12,20,23,25,27,29,32,37,40,41,44,46,47,48,51,52,
  53,54,56,61,64,66,74,77,81,88,90,92,94,95,96,97,101,104,106,107,
  110,114,115,116,118,120)
 resul(),  black() and return() from C.
> cx3.4 <- clara(xc120, 3, trace = 4)
C clara(): (nsam,nran,n) = (46,5,120);
- clara sample  1  finding 1st... new k{ran}:
... {180}nrun=  999 -> k{ran}=2
.. kall: FALSE, 
... nrx [0:2]= 0 0 0 
... nsel[0:0]= 2 
... {210}nrun=54606 -> k{ran}=100
... {210}nrun=13365 -> k{ran}=25
... {210}nrun=57500 -> k{ran}=106
... {210}nrun=39555 -> k{ran}=73
... {210}nrun= 8682 -> k{ran}=16
... {210}nrun=14033 -> k{ran}=26
... {210}nrun=39224 -> k{ran}=72
... {210}nrun= 2335 -> k{ran}=5
... {210}nrun=18054 -> k{ran}=34
... {210}nrun= 4461 -> k{ran}=9
... {210}nrun=10708 -> k{ran}=20
... {210}nrun=20411 -> k{ran}=38
... {210}nrun=17186 -> k{ran}=32
... {210}nrun=50185 -> k{ran}=92
... {210}nrun=37488 -> k{ran}=69
... {210}nrun=28247 -> k{ran}=52
... {210}nrun= 6078 -> k{ran}=12
... {210}nrun=20133 -> k{ran}=37
... {210}nrun=54028 -> k{ran}=99
... {210}nrun=25843 -> k{ran}=48
... {210}nrun=50266 -> k{ran}=93
... {210}nrun=45377 -> k{ran}=84
... {210}nrun=60328 -> k{ran}=111
... {210}nrun=13199 -> k{ran}=25
... {210}nrun=18678 -> k{ran}=35
... {210}nrun=60381 -> k{ran}=111
... {210}nrun=56388 -> k{ran}=104
... {210}nrun=55851 -> k{ran}=103
... {210}nrun=42386 -> k{ran}=78
... {210}nrun=65145 -> k{ran}=120
... {210}nrun=42208 -> k{ran}=78
... {210}nrun=22727 -> k{ran}=42
... {210}nrun=55854 -> k{ran}=103
... {210}nrun=59669 -> k{ran}=110
... {210}nrun=17788 -> k{ran}=33
... {210}nrun=44899 -> k{ran}=83
... {210}nrun=59082 -> k{ran}=109
... {210}nrun=43953 -> k{ran}=81
... {210}nrun=48664 -> k{ran}=90
... {210}nrun=56831 -> k{ran}=105
... {210}nrun=52070 -> k{ran}=96
... {210}nrun=17997 -> k{ran}=33
... {210}nrun= 3764 -> k{ran}=7
... {210}nrun=58523 -> k{ran}=108
... {210}nrun=34818 -> k{ran}=64
... {210}nrun=47337 -> k{ran}=87
... {210}nrun=14160 -> k{ran}=26
... {210}nrun=49975 -> k{ran}=92
... {210}nrun= 7326 -> k{ran}=14
... {210}nrun=  901 -> k{ran}=2
... {210}nrun=14316 -> k{ran}=27
... {210}nrun=31187 -> k{ran}=58
... {210}nrun=35130 -> k{ran}=65
 [ntt=46, nunfs=0] .. nsel[1:46]= 2 5 7 9 12 14 16 20 25 26 27 32 33 34 35 37 38 42 48 52 58 64 65 69 72 73 78 81 83 84 87 90 92 93 96 99 100 103 104 105 106 108 109 110 111 120  -> dysta2();
 clara -> s:= max{dys[1..1035]} = 115.819;
 bswap2(*, s=115.819), 1. BUILD:     new repr. 7
    new repr. 20
    new repr. 44
  after build: medoids are  7 20 44
  and min.dist dysma[1:n] are
   35.4   25.1   17.2   45.5   31.6   22.8      0   14.5     13   40.7
   17.1   13.8     34   4.46   26.3   16.7   22.8   15.2   5.33      0
   8.82   28.1   28.7   18.1   8.11   5.51   6.57   8.57   2.58   6.01
   9.96   11.2   24.1   21.3   12.9   5.18   6.63   8.49   20.3   4.64
   12.1   3.79   13.9      0   13.1   21.1
 --> sky = sum_j D_j= 711.359
   swp new 3 <-> 7 old; decreasing diss. by -140.634
  Last swap: new 3 <-> 7 old; decreasing diss. by 1
 end{bswap2}: sky = 570.725
1st proper sample obj= 13.4142
- clara sample  2  if (kall && nunfs...): 
.. kall: T, 
... nrx [0:2]= 7 52 110 
... nsel[0:2]= 7 52 110 
... {210}nrun= 9761 -> k{ran}=18
... {210}nrun= 4232 -> k{ran}=8
... {210}nrun= 2159 -> k{ran}=4
... {210}nrun=52694 -> k{ran}=97
... {210}nrun= 8381 -> k{ran}=16
... {210}nrun=49444 -> k{ran}=91
... {210}nrun=28427 -> k{ran}=53
... {210}nrun=60018 -> k{ran}=110
... {210}nrun=62297 -> k{ran}=115
... {210}nrun=18880 -> k{ran}=35
... {210}nrun=44455 -> k{ran}=82
... {210}nrun=57102 -> k{ran}=105
... {210}nrun=40437 -> k{ran}=75
... {210}nrun=43612 -> k{ran}=80
... {210}nrun=50243 -> k{ran}=92
... {210}nrun=43946 -> k{ran}=81
... {210}nrun= 8337 -> k{ran}=16
... {210}nrun=58104 -> k{ran}=107
... {210}nrun=45791 -> k{ran}=84
... {210}nrun=20550 -> k{ran}=38
... {210}nrun=31533 -> k{ran}=58
... {210}nrun=62356 -> k{ran}=115
... {210}nrun=31099 -> k{ran}=57
... {210}nrun=52450 -> k{ran}=97
... {210}nrun=44489 -> k{ran}=82
... {210}nrun=56368 -> k{ran}=104
... {210}nrun= 6167 -> k{ran}=12
... {210}nrun= 8574 -> k{ran}=16
... {210}nrun=47205 -> k{ran}=87
... {210}nrun=40140 -> k{ran}=74
... {210}nrun=36531 -> k{ran}=67
... {210}nrun=19994 -> k{ran}=37
... {210}nrun=39681 -> k{ran}=73
... {210}nrun=13672 -> k{ran}=26
... {210}nrun=56655 -> k{ran}=104
... {210}nrun=21174 -> k{ran}=39
... {210}nrun=21917 -> k{ran}=41
... {210}nrun=42500 -> k{ran}=78
... {210}nrun= 1003 -> k{ran}=2
... {210}nrun=12114 -> k{ran}=23
... {210}nrun=59449 -> k{ran}=109
... {210}nrun=61088 -> k{ran}=112
... {210}nrun=  647 -> k{ran}=2
... {210}nrun=58350 -> k{ran}=107
... {210}nrun=21205 -> k{ran}=39
... {210}nrun= 3900 -> k{ran}=8
... {210}nrun=55587 -> k{ran}=102
... {210}nrun=28810 -> k{ran}=53
... {210}nrun=38257 -> k{ran}=71
... {210}nrun= 2008 -> k{ran}=4
... {210}nrun=34751 -> k{ran}=64
... {210}nrun=54566 -> k{ran}=100
... {210}nrun=45069 -> k{ran}=83
... {210}nrun=55412 -> k{ran}=102
... {210}nrun= 3675 -> k{ran}=7
... {210}nrun= 4546 -> k{ran}=9
... {210}nrun=41641 -> k{ran}=77
... {210}nrun=33040 -> k{ran}=61
 [ntt=46, nunfs=0] .. nsel[1:46]= 2 4 7 8 9 12 16 18 23 26 35 37 38 39 41 52 53 57 58 61 64 67 71 73 74 75 77 78 80 81 82 83 84 87 91 92 97 100 102 104 105 107 109 110 112 115  -> dysta2();
 clara -> s:= max{dys[1..1035]} = 114.718;
 bswap2(*, s=114.718), 1. BUILD:     new repr. 17
    new repr. 44
    new repr. 9
  after build: medoids are  9 17 44
  and min.dist dysma[1:n] are
   7.72     10   11.9   5.68   26.6   10.8   28.2   20.3      0   14.5
   10.9   31.1   11.7   34.8   22.4   21.6      0   18.9   21.2   8.36
   10.6   24.9   28.9     26   29.2   18.8   14.4   18.6   31.7   13.5
   21.9   21.1   15.6   31.5   14.7   24.1   19.8   6.63   13.8   20.3
   4.64   16.6   13.9      0   10.3   17.8
 --> sky = sum_j D_j= 786.108
   swp new 33 <-> 17 old; decreasing diss. by -168.839
  Last swap: new 33 <-> 17 old; decreasing diss. by 1
 end{bswap2}: sky = 617.268
new best obj= 13.349
- clara sample  3  if (kall && nunfs...): 
.. kall: T, 
... nrx [0:2]= 23 84 110 
... nsel[0:2]= 23 84 110 
... {210}nrun=27895 -> k{ran}=52
... {210}nrun= 9822 -> k{ran}=18
... {210}nrun=27973 -> k{ran}=52
... {210}nrun=  428 -> k{ran}=1
... {210}nrun=41875 -> k{ran}=77
... {210}nrun= 4858 -> k{ran}=9
... {210}nrun= 4065 -> k{ran}=8
... {210}nrun=23112 -> k{ran}=43
... {210}nrun=45615 -> k{ran}=84
... {210}nrun=55190 -> k{ran}=102
... {210}nrun=35453 -> k{ran}=65
... {210}nrun=35556 -> k{ran}=66
... {210}nrun=39115 -> k{ran}=72
... {210}nrun=29746 -> k{ran}=55
... {210}nrun=56601 -> k{ran}=104
... {210}nrun=37760 -> k{ran}=70
... {210}nrun=22375 -> k{ran}=41
... {210}nrun=59598 -> k{ran}=110
... {210}nrun= 1973 -> k{ran}=4
... {210}nrun=29724 -> k{ran}=55
... {210}nrun=60931 -> k{ran}=112
... {210}nrun=13674 -> k{ran}=26
... {210}nrun= 2641 -> k{ran}=5
... {210}nrun=11448 -> k{ran}=21
... {210}nrun=23711 -> k{ran}=44
... {210}nrun=23046 -> k{ran}=43
... {210}nrun=58605 -> k{ran}=108
... {210}nrun=48468 -> k{ran}=89
... {210}nrun=41787 -> k{ran}=77
... {210}nrun=22178 -> k{ran}=41
... {210}nrun=38793 -> k{ran}=72
... {210}nrun= 9712 -> k{ran}=18
... {210}nrun=49623 -> k{ran}=91
... {210}nrun=11070 -> k{ran}=21
... {210}nrun= 8741 -> k{ran}=17
... {210}nrun=26252 -> k{ran}=49
... {210}nrun=47219 -> k{ran}=87
... {210}nrun=55258 -> k{ran}=102
... {210}nrun=33985 -> k{ran}=63
... {210}nrun=32552 -> k{ran}=60
... {210}nrun=34575 -> k{ran}=64
... {210}nrun=23670 -> k{ran}=44
... {210}nrun=48989 -> k{ran}=90
... {210}nrun=28612 -> k{ran}=53
... {210}nrun=11691 -> k{ran}=22
... {210}nrun=47378 -> k{ran}=87
... {210}nrun=53753 -> k{ran}=99
... {210}nrun=14432 -> k{ran}=27
... {210}nrun=44103 -> k{ran}=81
... {210}nrun=60846 -> k{ran}=112
... {210}nrun=48277 -> k{ran}=89
... {210}nrun=55548 -> k{ran}=102
... {210}nrun=  739 -> k{ran}=2
... {210}nrun=64074 -> k{ran}=118
... {210}nrun=32561 -> k{ran}=60
... {210}nrun=20888 -> k{ran}=39
... {210}nrun=12671 -> k{ran}=24
... {210}nrun=57062 -> k{ran}=105
... {210}nrun= 6605 -> k{ran}=13
... {210}nrun=41524 -> k{ran}=77
... {210}nrun=14363 -> k{ran}=27
... {210}nrun=39810 -> k{ran}=73
 [ntt=46, nunfs=0] .. nsel[1:46]= 1 2 4 5 8 9 13 17 18 21 22 23 24 26 27 39 41 43 44 49 52 53 55 60 63 64 65 66 70 72 73 77 81 84 87 89 90 91 99 102 104 105 108 110 112 118  -> dysta2();
 clara -> s:= max{dys[1..1035]} = 109.395;
 bswap2(*, s=109.395), 1. BUILD:     new repr. 27
    new repr. 11
    new repr. 44
  after build: medoids are 11 27 44
  and min.dist dysma[1:n] are
   12.6   18.9     16    8.1   6.03   31.1   15.1   5.77   9.37   16.9
      0   11.3   10.7     25   1.54   38.7   22.1   34.8   4.99   17.1
   28.7   12.9   21.6   17.7   27.1   21.6      0   38.5   15.9   23.4
     34     25   20.3   23.5   37.5     28   11.2   14.7   5.18   13.8
   20.3   4.64   3.79      0   10.3   8.28
 --> sky = sum_j D_j= 774.014
   swp new 33 <-> 27 old; decreasing diss. by -218.738
   swp new 5 <-> 11 old; decreasing diss. by -23.0466
  Last swap: new 5 <-> 11 old; decreasing diss. by 1
 end{bswap2}: sky = 532.229
new best obj= 12.8491
- clara sample  4  if (kall && nunfs...): 
.. kall: T, 
... nrx [0:2]= 8 81 110 
... nsel[0:2]= 8 81 110 
... {210}nrun=35945 -> k{ran}=66
... {210}nrun=51920 -> k{ran}=96
... {210}nrun= 5815 -> k{ran}=11
... {210}nrun=12318 -> k{ran}=23
... {210}nrun=55045 -> k{ran}=101
... {210}nrun=52076 -> k{ran}=96
... {210}nrun=52563 -> k{ran}=97
... {210}nrun=40122 -> k{ran}=74
... {210}nrun=63905 -> k{ran}=118
... {210}nrun=41992 -> k{ran}=77
... {210}nrun=23535 -> k{ran}=44
... {210}nrun=57686 -> k{ran}=106
... {210}nrun=62525 -> k{ran}=115
... {210}nrun=21668 -> k{ran}=40
... {210}nrun=49803 -> k{ran}=92
... {210}nrun=65010 -> k{ran}=120
... {210}nrun=50905 -> k{ran}=94
... {210}nrun=56640 -> k{ran}=104
... {210}nrun=  295 -> k{ran}=1
... {210}nrun=62094 -> k{ran}=114
... {210}nrun=29045 -> k{ran}=54
... {210}nrun=15836 -> k{ran}=29
... {210}nrun= 6083 -> k{ran}=12
... {210}nrun=48938 -> k{ran}=90
... {210}nrun=62481 -> k{ran}=115
... {210}nrun=30328 -> k{ran}=56
... {210}nrun= 1631 -> k{ran}=3
... {210}nrun=25542 -> k{ran}=47
... {210}nrun=20141 -> k{ran}=37
... {210}nrun=34580 -> k{ran}=64
... {210}nrun=52475 -> k{ran}=97
... {210}nrun=57442 -> k{ran}=106
... {210}nrun=33097 -> k{ran}=61
... {210}nrun=28592 -> k{ran}=53
... {210}nrun=27543 -> k{ran}=51
... {210}nrun=13566 -> k{ran}=25
... {210}nrun=35813 -> k{ran}=66
... {210}nrun=12364 -> k{ran}=23
... {210}nrun=57907 -> k{ran}=107
... {210}nrun=24986 -> k{ran}=46
... {210}nrun=28289 -> k{ran}=52
... {210}nrun=51432 -> k{ran}=95
... {210}nrun=12495 -> k{ran}=23
... {210}nrun=26166 -> k{ran}=48
... {210}nrun=10525 -> k{ran}=20
... {210}nrun=14724 -> k{ran}=27
... {210}nrun=22379 -> k{ran}=41
... {210}nrun=17106 -> k{ran}=32
... {210}nrun=48057 -> k{ran}=88
... {210}nrun=33312 -> k{ran}=61
... {210}nrun=22023 -> k{ran}=41
... {210}nrun=63342 -> k{ran}=116
 [ntt=46, nunfs=0] .. nsel[1:46]= 1 3 8 11 12 20 23 25 27 29 32 37 40 41 44 46 47 48 51 52 53 54 56 61 64 66 74 77 81 88 90 92 94 95 96 97 101 104 106 107 110 114 115 116 118 120  -> dysta2();
 clara -> s:= max{dys[1..1035]} = 111.407;
 bswap2(*, s=111.407), 1. BUILD:     new repr. 15
    new repr. 41
    new repr. 9
  after build: medoids are  9 15 41
  and min.dist dysma[1:n] are
   12.8      9   6.37   10.4   16.7   5.34   11.1   9.52      0   4.43
   15.8   36.9   10.6   19.5      0   14.1   13.9   29.1   17.9   24.2
   8.48   7.37     14   8.44   18.2   36.4   24.5     20   15.7   37.6
   11.2   24.1     27   17.9   12.9   19.8   1.78   20.3   12.1   16.6
      0   22.9   17.8   10.2   8.28   21.1
 --> sky = sum_j D_j= 702.577
   swp new 29 <-> 15 old; decreasing diss. by -112.229
  Last swap: new 31 <-> 41 old; decreasing diss. by 0.561914
 end{bswap2}: sky = 590.348
new best obj= 12.6975
- clara sample  5  if (kall && nunfs...): 
.. kall: T, 
... nrx [0:2]= 27 81 110 
... nsel[0:2]= 27 81 110 
... {210}nrun= 9813 -> k{ran}=18
... {210}nrun=41660 -> k{ran}=77
... {210}nrun=11427 -> k{ran}=21
... {210}nrun=33802 -> k{ran}=62
... {210}nrun=26865 -> k{ran}=50
... {210}nrun=39768 -> k{ran}=73
... {210}nrun=56127 -> k{ran}=103
... {210}nrun=59558 -> k{ran}=110
... {210}nrun=33677 -> k{ran}=62
... {210}nrun=27636 -> k{ran}=51
... {210}nrun=25051 -> k{ran}=46
... {210}nrun= 9538 -> k{ran}=18
... {210}nrun=30249 -> k{ran}=56
... {210}nrun= 5264 -> k{ran}=10
... {210}nrun=49271 -> k{ran}=91
... {210}nrun=14814 -> k{ran}=28
... {210}nrun=16581 -> k{ran}=31
... {210}nrun=38188 -> k{ran}=70
... {210}nrun=63251 -> k{ran}=116
... {210}nrun= 9850 -> k{ran}=19
... {210}nrun=58209 -> k{ran}=107
... {210}nrun=60872 -> k{ran}=112
... {210}nrun= 1455 -> k{ran}=3
... {210}nrun=60182 -> k{ran}=111
... {210}nrun=24061 -> k{ran}=45
... {210}nrun= 7780 -> k{ran}=15
... {210}nrun=60491 -> k{ran}=111
... {210}nrun=34738 -> k{ran}=64
... {210}nrun=45209 -> k{ran}=83
... {210}nrun= 9984 -> k{ran}=19
... {210}nrun=43751 -> k{ran}=81
... {210}nrun=64590 -> k{ran}=119
... {210}nrun=56117 -> k{ran}=103
... {210}nrun= 1948 -> k{ran}=4
... {210}nrun=16771 -> k{ran}=31
... {210}nrun=18666 -> k{ran}=35
... {210}nrun=56785 -> k{ran}=104
... {210}nrun=49208 -> k{ran}=91
... {210}nrun=45087 -> k{ran}=83
... {210}nrun=28038 -> k{ran}=52
... {210}nrun=47213 -> k{ran}=87
... {210}nrun=20692 -> k{ran}=38
... {210}nrun=63163 -> k{ran}=116
... {210}nrun=27170 -> k{ran}=50
... {210}nrun=27401 -> k{ran}=51
... {210}nrun=47472 -> k{ran}=87
... {210}nrun= 5463 -> k{ran}=11
... {210}nrun=16062 -> k{ran}=30
... {210}nrun=62885 -> k{ran}=116
... {210}nrun=64012 -> k{ran}=118
... {210}nrun= 3059 -> k{ran}=6
... {210}nrun=60250 -> k{ran}=111
... {210}nrun=22593 -> k{ran}=42
... {210}nrun= 4776 -> k{ran}=9
... {210}nrun=55951 -> k{ran}=103
... {210}nrun=28662 -> k{ran}=53
... {210}nrun=37597 -> k{ran}=69
... {210}nrun=  836 -> k{ran}=2
... {210}nrun=33067 -> k{ran}=61
... {210}nrun=52370 -> k{ran}=96
 [ntt=46, nunfs=0] .. nsel[1:46]= 2 3 4 6 9 10 11 15 18 19 21 27 28 30 31 35 38 42 45 46 50 51 52 53 56 61 62 64 69 70 73 77 81 83 87 91 96 103 104 107 110 111 112 116 118 119  -> dysta2();
 clara -> s:= max{dys[1..1035]} = 115.819;
 bswap2(*, s=115.819), 1. BUILD:     new repr. 27
    new repr. 12
    new repr. 45
  after build: medoids are 12 27 45
  and min.dist dysma[1:n] are
   18.5      9   14.9   2.66   32.3   10.7   10.4   12.8   9.21   11.6
   18.3      0   19.7   24.9   2.77   12.7   15.4   46.5   16.8   25.2
   22.6   27.9     33   11.7   15.3   17.9      0   14.4   47.4   24.1
   37.6   26.1   24.5   32.2   42.8   18.2     16   2.98   12.2    8.3
   8.28   13.3     10   7.83      0   20.9
 --> sky = sum_j D_j= 810.101
   swp new 33 <-> 27 old; decreasing diss. by -247.879
   swp new 8 <-> 12 old; decreasing diss. by -2.42584
  Last swap: new 21 <-> 33 old; decreasing diss. by 0.313188
 end{bswap2}: sky = 559.796
 obj= 13.7493
C clara() -> best sample _found_ ; nbest[1:46] =
 c(1,3,8,11,12,20,23,25,27,29,32,37,40,41,44,46,47,48,51,52,
  53,54,56,61,64,66,74,77,81,88,90,92,94,95,96,97,101,104,106,107,
  110,114,115,116,118,120)
 resul(),  black() and return() from C.
> if(FALSE) # no change
+ cx3.5 <- clara(xc120, 3, trace = 5)
> 
> ###--- End version of example(clara) -------
> 
> ## Last Line:
> cat('Time elapsed: ', proc.time() - .proctime00,'\n')
Time elapsed:  0.36 0.02 0.397 0 0 
> 
> proc.time()
   user  system elapsed 
  0.476   0.072   0.581