Commit 3ebeb47e authored by Anastasiia's avatar Anastasiia

limit the size of cartesian product instead of subdiv

parent 242e2b96
......@@ -76,25 +76,29 @@ trait Subdivision extends Taylor{
else
Math.pow(2, divLimit).toInt
var srcCartesian: Map[Identifier, Seq[Interval]] = Map.empty
var counter = split
// sort the list of input vars by width of intervals
val inputSeq = inputValMap.toSeq.sortWith(_._2 > _._2)
// reporter.warning(s"sorted map $inputSeq")
var subdivided = 0
var left = removeDeltasFromMap(inputValMap).keys.size
var counter = split + left - 1
// set of vectors. each vector contains the maps for one var
for (inputVal <- inputSeq) {
if (inputVal._1.isDeltaId || inputVal._1.isEpsilonId || counter > subdivFirst) {
srcCartesian += (inputVal._1 -> Seq(inputVal._2))
left = left - 1
}
else {
val (id, interval) = inputVal
val oneVar = interval.divide(split)
srcCartesian += (id -> oneVar)
counter = counter + split
subdivided = subdivided + 1
left = left - 1
counter = Math.pow(split, subdivided).toInt + left
// reporter.warning(s"counter $counter")
}
}
// reporter.warning(s"src cartesian $srcCartesian")
val result = cartesianProduct(srcCartesian)
//reporter.warning(s"size cartesian " + result.size)
result
}
}
......
......@@ -973,7 +973,7 @@ trait Taylor{
* @return map for variables
*/
def removeDeltasFromMap(in: Map[Identifier, Interval]): Map[Identifier, Interval] ={
in.filterKeys(x => !x.isDeltaId)
in.filterKeys(x => !(x.isDeltaId||x.isEpsilonId))
}
/**
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment