Skip to content

MHenderson/greedy-maximal-room-squares

Repository files navigation

more-maximal-room-squares

n <- 10

r <- Room$new(size = n)

tic()
for(e in r$empty_cells) {
  for(p in r$free_pairs) {
    if(r$is_available(e, p)) {
      r$set(e, p)
      break()
    }
  }
}
toc()
#> 0.314 sec elapsed

Results

n nc2 t1 t2 t3 r1 r2 r3
50 1225 1074 973 1094 0.877 0.794 0.8930612
52 1326 1165 1084 1178 0.879 0.817 0.8883861
54 1431 1250 1195 1278 0.874 0.835 0.8930818
56 1540 1346 1303 1376 0.874 0.846 0.8935065
58 1653 1442 1401 1481 0.872 0.848 0.8959468
60 1770 1540 1489 1587 0.870 0.841 0.8966102
62 1891 1652 1596 1699 0.874 0.844 0.8984664
64 2016 1755 1721 1809 0.871 0.854 0.8973214
66 2145 1873 1854 1937 0.873 0.864 0.9030303
68 2278 1993 1988 2060 0.875 0.873 0.9043020
70 2415 2104 2119 2178 0.871 0.877 0.9018634
72 2556 2228 2212 2312 0.872 0.865 0.9045383
74 2701 2354 2291 2439 0.872 0.848 0.9029989
76 2850 2490 2345 2586 0.874 0.823 0.9073684
78 3003 2617 2405 2725 0.871 0.801 0.9074259
80 3160 2765 2460 2872 0.875 0.778 0.9088608
82 3321 2911 2536 3022 0.877 0.764 0.9099669
84 3486 3049 2632 3178 0.875 0.755 0.9116466
86 3655 3204 2742 3328 0.877 0.750 0.9105335
88 3828 3370 2870 3492 0.880 0.750 0.9122257
90 4005 3513 3017 3663 0.877 0.753 0.9146067
92 4186 3674 3178 3824 0.878 0.759 0.9135213
94 4371 3854 3351 3989 0.882 0.767 0.9126058
96 4560 4013 3536 4173 0.880 0.775 0.9151316
98 4753 4178 3733 4357 0.879 0.785 0.9166842
100 4950 4341 3941 4534 0.877 0.796 0.9159596