diff options
| author | Timotej Kapus <tk1713@ic.ac.uk> | 2019-12-02 15:05:03 +0000 |
|---|---|---|
| committer | MartinNowack <2443641+MartinNowack@users.noreply.github.com> | 2019-12-12 16:17:09 +0000 |
| commit | ebd3eb0ec11b053ddf5eee44c1217436948279d9 (patch) | |
| tree | 640f1a1832b9ae6b4b18fd4815379df4614f2f93 /lib/Core/Searcher.cpp | |
| parent | 0de67b9f0c3f7f331f873f19561aef311d2bed4a (diff) | |
| download | klee-ebd3eb0ec11b053ddf5eee44c1217436948279d9.tar.gz | |
[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).
Diffstat (limited to 'lib/Core/Searcher.cpp')
| -rw-r--r-- | lib/Core/Searcher.cpp | 12 |
1 files changed, 8 insertions, 4 deletions
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 <cassert> -#include <fstream> #include <climits> +#include <cmath> +#include <fstream> using namespace klee; using namespace llvm; @@ -168,7 +169,8 @@ WeightedRandomSearcher::WeightedRandomSearcher(WeightType _type) : states(new DiscretePDF<ExecutionState*>()), 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); |
