From 4144b8b6b35de29aecad6c72ff235fc9b5daa2dc Mon Sep 17 00:00:00 2001 From: Alinson S Xavier Date: Mon, 5 Oct 2020 11:28:30 -0500 Subject: [PATCH] Primal: In evaluate, skip variables without predictions --- miplearn/components/primal.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/miplearn/components/primal.py b/miplearn/components/primal.py index 4a9f4b3..6c2cc84 100644 --- a/miplearn/components/primal.py +++ b/miplearn/components/primal.py @@ -119,6 +119,8 @@ class PrimalSolutionComponent(Component): vars_all, vars_one, vars_zero = set(), set(), set() pred_one_positive, pred_zero_positive = set(), set() for (varname, var_dict) in solution_actual.items(): + if varname not in solution_pred.keys(): + continue for (idx, value) in var_dict.items(): vars_all.add((varname, idx)) if value > 0.5: