You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
31 lines
847 B
31 lines
847 B
import model.Customer
|
|
import util._
|
|
class HHCSim(
|
|
private val epsilonMax: Int,
|
|
private val iterations: Int,
|
|
// private val customers: IndexedSeq[Customer],
|
|
private val WLDMax: Float
|
|
) {
|
|
// private val graph: Array[Array[T]]
|
|
def go(
|
|
customers: Either[String, IndexedSeq[Customer]]
|
|
): String Either Map[Int, IndexedSeq[(Int, Double)]] =
|
|
customers
|
|
.map(Util.formAdjMatrix)
|
|
.map(edges => Util.mstUsingPrims(edges))
|
|
.map(mst => Util.findCentroids(mst))
|
|
.map(
|
|
e =>
|
|
e match {
|
|
case (mst, centroids, removed) =>
|
|
Util.findClusters(mst, centroids, removed)
|
|
}
|
|
)
|
|
.map(
|
|
e =>
|
|
e match {
|
|
case (centroids, clusters, removed) =>
|
|
Util.groupClusters(centroids, clusters, removed)
|
|
}
|
|
)
|
|
}
|