1
0

Improve AddressDecoder optimization function

This function is better 27% of the time but worse 6% of the time.
This commit is contained in:
Andrew Waterman 2017-09-19 17:45:10 -07:00
parent cbd65cd247
commit fb2ad11347

View File

@ -70,10 +70,10 @@ object AddressDecoder
def bitScore(partitions: Partitions): Seq[Int] = { def bitScore(partitions: Partitions): Seq[Int] = {
val maxPortsPerPartition = partitions.map(_.size).max val maxPortsPerPartition = partitions.map(_.size).max
val sumPortsPerPartition = partitions.map(_.size).sum
val maxSetsPerPartition = partitions.map(_.map(_.size).sum).max val maxSetsPerPartition = partitions.map(_.map(_.size).sum).max
val sumSetsPerPartition = partitions.map(_.map(_.size).sum).sum val sumSquarePortsPerPartition = partitions.map(p => p.size * p.size).sum
Seq(maxPortsPerPartition, sumPortsPerPartition, maxSetsPerPartition, sumSetsPerPartition) val sumSquareSetsPerPartition = partitions.map(_.map(p => p.size * p.size).sum).max
Seq(maxPortsPerPartition, maxSetsPerPartition, sumSquarePortsPerPartition, sumSquareSetsPerPartition)
} }
def partitionPort(port: Port, bit: BigInt): (Port, Port) = { def partitionPort(port: Port, bit: BigInt): (Port, Port) = {