From 8f94fdc0a8234c4993148b758f23245d943d2363 Mon Sep 17 00:00:00 2001 From: Richard Taupe Date: Fri, 31 Aug 2018 13:55:05 +0200 Subject: [PATCH] Fix: Avoid duplicate work in ChoicePoint.recomputeActive Fixes #144 --- .../at/ac/tuwien/kr/alpha/solver/ChoiceManager.java | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/main/java/at/ac/tuwien/kr/alpha/solver/ChoiceManager.java b/src/main/java/at/ac/tuwien/kr/alpha/solver/ChoiceManager.java index 1e08c286d..da7e8417f 100644 --- a/src/main/java/at/ac/tuwien/kr/alpha/solver/ChoiceManager.java +++ b/src/main/java/at/ac/tuwien/kr/alpha/solver/ChoiceManager.java @@ -163,14 +163,12 @@ void recomputeActive() { LOGGER.trace("Recomputing activity of atom {}.", atom); final boolean wasActive = isActive; isActive = isNotChosen() && isActiveChoicePoint(); - if (isActive) { + if (isActive && !wasActive) { activeChoicePoints.add(this); LOGGER.debug("Activating choice point for atom {}", this.atom); - } else { - if (wasActive) { - activeChoicePoints.remove(this); - LOGGER.debug("Deactivating choice point for atom {}", this.atom); - } + } else if (wasActive && !isActive) { + activeChoicePoints.remove(this); + LOGGER.debug("Deactivating choice point for atom {}", this.atom); } }