diff options
-rw-r--r-- | monkey/edits.py | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/monkey/edits.py b/monkey/edits.py index 4774c9a..1863d73 100644 --- a/monkey/edits.py +++ b/monkey/edits.py @@ -169,9 +169,10 @@ def get_edits_from_solutions(solutions, test): edits = new_edits # Tweak the edit distribution to improve search. - avg_p = avg(edits.values()) - for edit, p in edits.items(): - edits[edit] = logistic(p, k=3, x_0=avg_p) + if edits: + avg_p = avg(edits.values()) + for edit, p in edits.items(): + edits[edit] = logistic(p, k=3, x_0=avg_p) return edits, submissions, queries @@ -236,7 +237,7 @@ if __name__ == '__main__': if code_key in test_results[pid]: return test_results[pid][code_key] - aux_code = '\n' + solutions_for_problems('prolog', dependencies) + '\n' + facts + aux_code = '\n' + solutions_for_problems(problem.language, dependencies) + '\n' + facts correct, hints = problem_module.test(code, aux_code) test_results[pid][code_key] = correct return correct |