From af131149544092c72acb2738175fa3d13c2cc6a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafael=20Caba=C3=B1as?= Date: Fri, 24 Sep 2021 11:22:12 +0200 Subject: [PATCH] bug at removeNorm constraints --- .../linear/separate/SeparateHalfspaceDefaultFactor.java | 4 ++-- .../crema/inference/ve/ConditionalVariableElimination.java | 5 +++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/main/java/ch/idsia/crema/factor/credal/linear/separate/SeparateHalfspaceDefaultFactor.java b/src/main/java/ch/idsia/crema/factor/credal/linear/separate/SeparateHalfspaceDefaultFactor.java index 0632b2bc..efeea4bd 100644 --- a/src/main/java/ch/idsia/crema/factor/credal/linear/separate/SeparateHalfspaceDefaultFactor.java +++ b/src/main/java/ch/idsia/crema/factor/credal/linear/separate/SeparateHalfspaceDefaultFactor.java @@ -185,7 +185,7 @@ public SeparateHalfspaceDefaultFactor removeNormConstraints() { final TIntObjectMap> constraints = getDataStructure(); for (int i : data.keys()) { - constraints.get(i).addAll(i, ConstraintsUtil.removeNormalization(getLinearProblemAt(i).getConstraints())); + constraints.get(i).addAll(ConstraintsUtil.removeNormalization(getLinearProblemAt(i).getConstraints())); } return new SeparateHalfspaceDefaultFactor(getDataDomain(), getSeparatingDomain(), constraints); } @@ -195,7 +195,7 @@ public SeparateHalfspaceDefaultFactor removeNonNegativeConstraints() { final TIntObjectMap> constraints = getDataStructure(); for (int i : data.keys()) { - constraints.get(i).addAll(i, ConstraintsUtil.removeNonNegative(getLinearProblemAt(i).getConstraints())); + constraints.get(i).addAll(ConstraintsUtil.removeNonNegative(getLinearProblemAt(i).getConstraints())); } return new SeparateHalfspaceDefaultFactor(getDataDomain(), getSeparatingDomain(), constraints); } diff --git a/src/main/java/ch/idsia/crema/inference/ve/ConditionalVariableElimination.java b/src/main/java/ch/idsia/crema/inference/ve/ConditionalVariableElimination.java index e6b8a03b..ebd9aa03 100644 --- a/src/main/java/ch/idsia/crema/inference/ve/ConditionalVariableElimination.java +++ b/src/main/java/ch/idsia/crema/inference/ve/ConditionalVariableElimination.java @@ -7,6 +7,7 @@ import ch.idsia.crema.utility.ArraysUtil; import com.google.common.primitives.Ints; import gnu.trove.map.TIntIntMap; +import gnu.trove.map.hash.TIntIntHashMap; /** * Author: Claudio "Dna" Bonesana @@ -63,4 +64,8 @@ public BayesianFactor query(GraphicalModel model, TIntIntMap obs return cond; } + public BayesianFactor query(GraphicalModel model, int... target) { + return this.query(model, new TIntIntHashMap(), target); + } + }