Skip to content

Commit 954132e

Browse files
committed
Catch an error and don't fail
1 parent d46b555 commit 954132e

File tree

2 files changed

+14
-12
lines changed

2 files changed

+14
-12
lines changed

experiments/Synth/src/evaluator.jl

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -81,15 +81,10 @@ function evaluate_qn(problem::UndirectedProblem, expr, vertex_names)
8181
sat_examples = BitVector[]
8282

8383
function _eval_1_dir(in, out)
84-
try
85-
res = interpret(expr, in[:state], vertex_names)
86-
expected = out[:state][findfirst(==(problem.name), vertex_names)]
87-
success = expected == res
88-
89-
return success
90-
catch
91-
error("$(problem.name) $(in[:state]) $expr")
92-
end
84+
res = interpret(expr, in[:state], vertex_names)
85+
expected = out[:state][findfirst(==(problem.name), vertex_names)]
86+
success = expected == res
87+
return success
9388
end
9489

9590
for example problem.examples

experiments/Synth/src/synth_process.jl

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,17 @@ function synth_biodivine(
1515

1616
expr = rulenode2expr(ex, grammar)
1717

18-
sat_examples = evaluator(problem, expr, vertex_names)
18+
sat_examples = nothing
19+
try
20+
sat_examples = evaluator(problem, expr, vertex_names)
21+
catch
22+
@error "Problem evaluating: Problem name $(problem.name) state: $(in[:state]) $expr, i: $i."
23+
end
1924

20-
# if all examples worked in at least one direction
21-
if sum(all.(==(false), sat_examples)) == 0
25+
if isnothing(sat_examples)
26+
push!(exprs_and_scores, (expr, nothing, nothing, i))
27+
# if all examples worked in at least one direction
28+
elseif sum(all.(==(false), sat_examples)) == 0
2229
score = sum(count.(sat_examples)) / (2 * length(problem.examples))
2330
push!(exprs_and_scores, (expr, score, sat_examples, i))
2431
end

0 commit comments

Comments
 (0)