Skip to content

Commit

Permalink
fix random seed for SMT
Browse files Browse the repository at this point in the history
  • Loading branch information
AbdullinAM committed Jul 19, 2023
1 parent 681b7d0 commit 60f999f
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ private val printSMTLib = kexConfig.getBooleanValue("smt", "logSMTLib", false)
private val maxArrayLength = kexConfig.getIntValue("smt", "maxArrayLength", 1000)
private val ksmtRunners = kexConfig.getIntValue("ksmt", "runners", 4)
private val ksmtSolvers = kexConfig.getMultipleStringValue("ksmt", "solver")
private val ksmtSeed = kexConfig.getIntValue("ksmt", "seed", 42)

@Suppress("UNCHECKED_CAST")
@AsyncSolver("ksmt")
Expand Down Expand Up @@ -300,7 +301,12 @@ class KSMTSolver(

private suspend fun buildSolver(): KPortfolioSolver {
if (!currentCoroutineContext().isActive) yield()
return portfolioSolverManager.createPortfolioSolver(ef.ctx)
return portfolioSolverManager.createPortfolioSolver(ef.ctx).also {
it.configureAsync {
setIntParameter("random_seed", ksmtSeed)
setIntParameter("seed", ksmtSeed)
}
}
}

private fun KSMTContext.recoverBitvectorProperty(
Expand Down
5 changes: 3 additions & 2 deletions kex-test.ini
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,8 @@ memspacing = false
slicing = false

logQuery = true
logFormulae = true
logSMTLib = true
logFormulae = false
logSMTLib = false

simplifyFormulae = true

Expand All @@ -101,6 +101,7 @@ solver = z3
; solver = bitwuzla
; solver = yices
runners = 8
seed = 42

[debug]
saveInstrumentedCode = true
Expand Down
1 change: 1 addition & 0 deletions kex.ini
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ solver = cvc5
solver = bitwuzla
; solver = yices
runners = 4
seed = 42

[view]
dot = /usr/bin/dot
Expand Down

0 comments on commit 60f999f

Please sign in to comment.