From ebd3eb0ec11b053ddf5eee44c1217436948279d9 Mon Sep 17 00:00:00 2001 From: Timotej Kapus Date: Mon, 2 Dec 2019 15:05:03 +0000 Subject: [Searchers] Remove weight from es, add nurs_depth Having both weight and depth in execution state is wasteful, therefore this patch removes weight. The nurs:depth searcher is replaced by nurs:rp, which uses pow to compute the weight A new nurs:depth searcher is introduced that biases the search with depth, making it the only other searcher that prefers to go deep (similar to dfs). --- lib/Core/Searcher.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'lib/Core/Searcher.cpp') diff --git a/lib/Core/Searcher.cpp b/lib/Core/Searcher.cpp index e576e8bc..1e9e5b9b 100644 --- a/lib/Core/Searcher.cpp +++ b/lib/Core/Searcher.cpp @@ -32,8 +32,9 @@ #include "llvm/Support/CommandLine.h" #include -#include #include +#include +#include using namespace klee; using namespace llvm; @@ -168,7 +169,8 @@ WeightedRandomSearcher::WeightedRandomSearcher(WeightType _type) : states(new DiscretePDF()), type(_type) { switch(type) { - case Depth: + case Depth: + case RP: updateWeights = false; break; case InstCount: @@ -194,8 +196,10 @@ ExecutionState &WeightedRandomSearcher::selectState() { double WeightedRandomSearcher::getWeight(ExecutionState *es) { switch(type) { default: - case Depth: - return es->weight; + case Depth: + return es->depth; + case RP: + return std::pow(0.5, es->depth); case InstCount: { uint64_t count = theStatisticManager->getIndexedValue(stats::instructions, es->pc->info->id); -- cgit 1.4.1