Skip to content
Snippets Groups Projects
Commit 0ff0f3be authored by Etienne Kneuss's avatar Etienne Kneuss
Browse files

Define WeightedBranches as default cost model

Improve error output by specifying which one is the default.
parent 8f620493
No related branches found
No related tags found
No related merge requests found
...@@ -25,6 +25,8 @@ abstract class CostModel(val name: String) { ...@@ -25,6 +25,8 @@ abstract class CostModel(val name: String) {
} }
object CostModel { object CostModel {
def default: CostModel = WeightedBranchesCostModel
def all: Set[CostModel] = Set( def all: Set[CostModel] = Set(
NaiveCostModel, NaiveCostModel,
WeightedBranchesCostModel WeightedBranchesCostModel
......
...@@ -48,9 +48,12 @@ object SynthesisPhase extends LeonPhase[Program, Program] { ...@@ -48,9 +48,12 @@ object SynthesisPhase extends LeonPhase[Program, Program] {
options = options.copy(costModel = model) options = options.copy(costModel = model)
case None => case None =>
val errorMsg = "Unknown cost model: " + cm + "\n" + var errorMsg = "Unknown cost model: " + cm + "\n" +
"Defined cost models: \n" + "Defined cost models: \n"
(CostModel.all.map(_.name).mkString(" - ", "\n - ", ""))
for (cm <- CostModel.all.toSeq.sortBy(_.name)) {
errorMsg += " - " + cm.name + (if(cm == CostModel.default) " (default)" else "") + "\n"
}
ctx.reporter.fatalError(errorMsg) ctx.reporter.fatalError(errorMsg)
} }
......
...@@ -7,5 +7,5 @@ case class SynthesizerOptions( ...@@ -7,5 +7,5 @@ case class SynthesizerOptions(
searchWorkers: Int = 1, searchWorkers: Int = 1,
firstOnly: Boolean = false, firstOnly: Boolean = false,
timeoutMs: Option[Long] = None, timeoutMs: Option[Long] = None,
costModel: CostModel = NaiveCostModel costModel: CostModel = CostModel.default
) )
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment