-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New path selectors infrastructure #29
Conversation
9c49644
to
2c9e6bd
Compare
28975f8
to
a486334
Compare
10f1c5c
to
01c1833
Compare
} | ||
|
||
internal fun pseudoRandom(i: Int): Int { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please write comment why this can't be replaced by Random
with fixed seed
import org.usvm.memory.UInputArrayRegion | ||
import org.usvm.memory.UInputFieldRegion | ||
import org.usvm.memory.splitUHeapRef | ||
import org.usvm.memory.* |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's not use * in imports
* Generates new deterministic id of state in this context. | ||
*/ | ||
fun getNextStateId(): UInt { | ||
val result = currentStateId |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return currentStateId++
interpreter: UInterpreter<State>, | ||
pathSelector: UPathSelector<State>, | ||
onState: (State) -> Unit, | ||
observer: UMachineObserver<State>, | ||
continueAnalyzing: (State) -> Boolean, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe rename it to isStateTerminated
? @sergeypospelov
pathSelector.remove(state) | ||
observer.onStateTerminated(state) | ||
} | ||
pathSelector.add(aliveForkedStates) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we really want to add empty list of states?
private var counter = 0UL | ||
|
||
override fun shouldStop(): Boolean { | ||
val currentCounter = counter |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return counter++ < limit
import org.usvm.UContext | ||
import org.usvm.UIndexedMocker | ||
import org.usvm.URegisterLValue | ||
import org.usvm.* |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please no stars
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's merge this file into LoanExam.java
* @param comparator comparator for elements to arrange them in tree. It doesn't affect the priorities. | ||
* @param unitIntervalRandom function returning a random value in [[0..1]] interval which is used to peek the element. | ||
*/ | ||
class DiscretePdf<T>(comparator: Comparator<T>, private val unitIntervalRandom: () -> Float) : UPriorityCollection<T, Float> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's rename it to RandomizedPriorityCollection
* [UPriorityCollection] implementation based on [java.util.PriorityQueue]. | ||
*/ | ||
// TODO: what to do if elements have same priority? | ||
class VanillaPriorityQueue<T, Priority>(comparator: Comparator<Priority>) : UPriorityCollection<T, Priority> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's rename it to DeterministicPriorityCollection
* [UPriorityCollection] implementation based on [java.util.PriorityQueue]. | ||
*/ | ||
// TODO: what to do if elements have same priority? | ||
class VanillaPriorityQueue<T, Priority>(comparator: Comparator<Priority>) : UPriorityCollection<T, Priority> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's rename it to DeterministicPriorityCollection
import org.usvm.language.SetLabel | ||
import org.usvm.language.SetValue | ||
import org.usvm.language.Stmt | ||
import org.usvm.language.* |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
star
import org.usvm.UExpr | ||
import org.usvm.USort | ||
import org.usvm.UState | ||
import org.usvm.* |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
star
import org.usvm.language.Stmt | ||
import org.usvm.language.argumentCount | ||
import org.usvm.language.localsCount | ||
import org.usvm.language.* |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
star
import org.usvm.language.SampleType | ||
import org.usvm.ps.DfsPathSelector | ||
import org.usvm.ps.stopstrategies.CollectedStatesLimitStrategy | ||
import org.usvm.language.* |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
star
import org.usvm.ps.stopstrategies.CollectedStatesLimitStrategy | ||
import org.usvm.language.* | ||
import org.usvm.ps.createPathSelector | ||
import org.usvm.statistics.* |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
star
import kotlin.reflect.KFunction2 | ||
import kotlin.reflect.KFunction3 | ||
import kotlin.reflect.KFunction4 | ||
import kotlin.reflect.* |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nope
01c1833
to
d46a23f
Compare
|
||
val originalStateAlive = stateAlive && continueAnalyzing(state) | ||
observer.onState(state, forkedStates) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
onState won't be called on the first state, will it? Is it fine?
* Add general framework for weighted searchers * Add tests for AA-tree and discrete PDF * Little typo fix in tests * Add shortest distance to targets weighter * Add random tree path selector * Add fork depth path selector * Fix interleaved path selector * Add comments and some new java tests, infrastructure fixes * PR comments fixes, add solver type and timeout options
* Add general framework for weighted searchers * Add tests for AA-tree and discrete PDF * Little typo fix in tests * Add shortest distance to targets weighter * Add random tree path selector * Add fork depth path selector * Fix interleaved path selector * Add comments and some new java tests, infrastructure fixes * PR comments fixes, add solver type and timeout options
* First version of logging for usvm * Implementation of the JacoDB interpreter (#18) Co-authored-by: Alexey Menshutin <alex.menshutin99@gmail.com> * New path selectors infrastructure (#29) * Add general framework for weighted searchers * Add tests for AA-tree and discrete PDF * Little typo fix in tests * Add shortest distance to targets weighter * Add random tree path selector * Add fork depth path selector * Fix interleaved path selector * Add comments and some new java tests, infrastructure fixes * PR comments fixes, add solver type and timeout options * First version of logging for usvm * synchronize with master --------- Co-authored-by: Sergey Pospelov <sergeypospelov59@gmail.com> Co-authored-by: Alexey Menshutin <alex.menshutin99@gmail.com> Co-authored-by: Maksim Parshin <mxprshn@gmail.com>
What's new
Further work: