424
|
1 |
import M4a._
|
386
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
3 |
def count_all_tours_urban(dim: Int) = {
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
4 |
for (i <- (0 until dim).toList;
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
5 |
j <- (0 until dim).toList) yield count_tours(dim, List((i, j)))
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
6 |
}
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
7 |
|
463
|
8 |
import scala.concurrent._
|
|
9 |
import scala.concurrent.duration._
|
|
10 |
import ExecutionContext.Implicits.global
|
|
11 |
import scala.language.postfixOps
|
|
12 |
|
|
13 |
lazy val f = Future {
|
386
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
14 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
15 |
assert(count_all_tours_urban(1) == List(1))
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
16 |
assert(count_all_tours_urban(2) == List(0, 0, 0, 0))
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
17 |
assert(count_all_tours_urban(3) == List(0, 0, 0, 0, 0, 0, 0, 0, 0))
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
18 |
assert(count_all_tours_urban(4) == List(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0))
|
463
|
19 |
}
|
386
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
20 |
|
463
|
21 |
Await.result(f, 32 second)
|
386
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
22 |
|