Skip to content

Commit

Permalink
added new path selector type
Browse files Browse the repository at this point in the history
  • Loading branch information
tochilinak committed May 23, 2024
1 parent f270820 commit 008425c
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 21 deletions.
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
package org.usvm.python.ps

enum class PyPathSelectorType {
BaselinePriorityDfs, // passes tests
BaselineWeightedDfs, // passes tests
BaselinePriorityNumberOfVirtualDfs, // passes tests
BaselineWeightedNumberOfVirtualRandomTree, // passes tests
BaselinePriorityNumberOfInstructionsDfs, // passes tests
BaselinePriorityNumberOfInstructionsRandomTree, // passes tests
BaselinePriorityPlusTypeRatingByHintsDfs, // passes tests
DelayedForkByInstructionWeightedDfs, // passes tests
DelayedForkByInstructionWeightedRandomTree, // passes tests
DelayedForkByInstructionPriorityNumberOfVirtualDfs, // passes tests
DelayedForkByInstructionWeightedNumberOfVirtualRandomTree, // passes tests
DelayedForkByInstructionPriorityNumberOfInstructionsDfs, // passes tests
DelayedForkByInstructionPriorityNumberOfInstructionsRandomTree, // passes tests
DelayedForkByInstructionWeightedNumberOfInstructionsRandomTree, // fails testAddAndCompare
BaselinePriorityDfs, // passes tests
BaselineWeightedDfs, // passes tests
BaselinePriorityNumberOfVirtualDfs, // passes tests
BaselineWeightedNumberOfVirtualRandomTree, // passes tests
BaselinePriorityNumberOfInstructionsDfs, // passes tests
BaselinePriorityNumberOfInstructionsRandomTree, // passes tests
BaselinePriorityPlusTypeRatingByHintsDfs, // passes tests
DelayedForkByInstructionWeightedDfs, // passes tests
DelayedForkByInstructionWeightedRandomTree, // passes tests
DelayedForkByInstructionPriorityNumberOfVirtualDfs, // passes tests
DelayedForkByInstructionWeightedNumberOfVirtualRandomTree, // passes tests
DelayedForkByInstructionPriorityNumberOfInstructionsDfs, // passes tests
DelayedForkByInstructionPriorityNumberOfInstructionsRandomTree, // passes tests
DelayedForkByInstructionPriorityNumberOfInstructionsRandomTreePlusTypeRating, // passes tests
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ import kotlin.random.Random
class PyMachine(
private val program: PyProgram,
private val typeSystem: PythonTypeSystem,
private val pathSelectorType: PyPathSelectorType = PyPathSelectorType.BaselinePriorityNumberOfInstructionsRandomTree,
private val printErrorMsg: Boolean = false,
private val pathSelectorType: PyPathSelectorType = PyPathSelectorType.DelayedForkByInstructionPriorityNumberOfInstructionsRandomTreePlusTypeRating,
private val printErrorMsg: Boolean = false
) : UMachine<PyState>() {
private val ctx = PyContext(typeSystem)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,8 @@ fun createPyPathSelector(
newStateObserver
)

PyPathSelectorType.DelayedForkByInstructionWeightedNumberOfInstructionsRandomTree ->
createDelayedForkByInstructionWeightedNumberOfInstructionsRandomTreePyPathSelector(
PyPathSelectorType.DelayedForkByInstructionPriorityNumberOfInstructionsRandomTreePlusTypeRating ->
createDelayedForkByInstructionPriorityNumberOfInstructionsRandomTreePlusTypeRatingPyPathSelector(
initialNode,
ctx,
random,
Expand Down Expand Up @@ -352,16 +352,17 @@ fun createDelayedForkByInstructionPriorityNumberOfInstructionsRandomTreePyPathSe
newStateObserver
)

fun createDelayedForkByInstructionWeightedNumberOfInstructionsRandomTreePyPathSelector(

fun createDelayedForkByInstructionPriorityNumberOfInstructionsRandomTreePlusTypeRatingPyPathSelector(
initialNode: PathNode<PyInstruction>,
ctx: PyContext,
random: Random,
newStateObserver: NewStateObserver,
): PyVirtualPathSelector<*, *> =
PyVirtualPathSelector(
ctx,
makeDelayedForkByInstructionWeightedStrategy(random),
BaselineDelayedForkStrategy(),
makeDelayedForkByInstructionPriorityStrategy(random),
TypeRatingByNumberOfHints(),
DelayedForkByInstructionGraphCreation {
WeightedPyPathSelector(
random,
Expand All @@ -378,6 +379,7 @@ fun createDelayedForkByInstructionWeightedNumberOfInstructionsRandomTreePyPathSe
newStateObserver
)


fun createTypeRatingByHintsDfsPyPathSelector(
ctx: PyContext,
random: Random,
Expand Down

0 comments on commit 008425c

Please sign in to comment.