-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathChecker.scala
29 lines (22 loc) · 875 Bytes
/
Checker.scala
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
27
28
29
import scala.io.Source
import scala.collection.mutable.Set
object Checker {
def main(args: Array[String]) {
val file = args(0)
val lines = Source.fromFile(file).getLines.toList
val inst = Solomon.load(lines(0).trim+".txt")
// linea 1 = largo / vehiculos
val line1 = lines(1).split("\\s+").toList
val largo = java.lang.Double.parseDouble(line1(0))
val vehiculos = Integer.parseInt(line1(1))
var customers = List[List[Customer]]()
for (n <- (2 until lines.length)) {
val params = lines(n).split("\\s+").toList
customers = params.map(p => inst.customers(p.toInt)) :: customers
}
println("segun txt: " + largo + " | " + vehiculos)
println("segun inst: " + inst.solLength(customers) + " | " + customers.length)
println("factible: " + inst.factible(customers))
println("visitados: " + customers.foldLeft(0)(_ + _.size - 1))
}
}