3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-06-22 05:43:39 +00:00

add randomization to lookahead selection'

Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
Nikolaj Bjorner 2020-02-01 10:48:43 -08:00
parent 615da0e3fb
commit 75fb25a06c
2 changed files with 8 additions and 4 deletions

View file

@ -18,7 +18,8 @@ Revision History:
--*/
#include <cmath>
#include "ast/ast_smt2_pp.h"
#include "ast/ast_pp.h"
#include "ast/ast_ll_pp.h"
#include "smt/smt_lookahead.h"
#include "smt/smt_context.h"
@ -78,7 +79,7 @@ namespace smt {
compare comp(ctx);
std::sort(vars.begin(), vars.end(), comp);
unsigned nf = 0, nc = 0, ns = 0, bound = 2000;
unsigned nf = 0, nc = 0, ns = 0, bound = 2000, n = 0;
for (bool_var v : vars) {
if (!ctx.bool_var2expr(v)) continue;
literal lit(v, false);
@ -108,7 +109,9 @@ namespace smt {
continue;
}
double score = score1 + score2 + 1024*score1*score2;
if (score > best_score) {
if (score > best_score || (score == best_score && ctx.get_random_value() % (++n) == 0)) {
if (score > best_score) n = 0;
best_score = score;
best_v = v;
bound += ns;