From 7e2b462e79eeb11be1fc631f1f99b2f1457c1522 Mon Sep 17 00:00:00 2001 From: Timotheus Kampik Date: Sun, 11 Feb 2024 10:02:58 +0100 Subject: [PATCH] Change sign of value impact measures --- AgreementScenarios.md | 8 ++++---- .../java/diarg/values/ValueBasedAgreementScenario.java | 9 ++++----- .../diarg/values/ValueBasedAgreementScenarioTest.java | 8 ++++---- 3 files changed, 12 insertions(+), 13 deletions(-) diff --git a/AgreementScenarios.md b/AgreementScenarios.md index d80ff33..4a850f6 100644 --- a/AgreementScenarios.md +++ b/AgreementScenarios.md @@ -184,9 +184,9 @@ In addition, we can determine the impact of a value on a degree of satisfaction counterfactual measure that determines the change to the degree when "removing" all preferences that relate to this value. ```java -double satisfactionImpact = vbScenario.determineSatisfactionImpact(0, 1, bv); // 1/2 -double minimalAgreementImpact = vbScenario.determineMinimalAgreementImpact(bv); // 1/4 -double meanAgreementImpact = vbScenario.determineMeanAgreementImpact(bv); // 1/6 -double medianAgreementImpact = vbScenario.determineMedianAgreementImpact(bv); // 1/4 +double satisfactionImpact = vbScenario.determineSatisfactionImpact(0, 1, bv); // -1/2 +double minimalAgreementImpact = vbScenario.determineMinimalAgreementImpact(bv); // -1/4 +double meanAgreementImpact = vbScenario.determineMeanAgreementImpact(bv); // -1/6 +double medianAgreementImpact = vbScenario.determineMedianAgreementImpact(bv); // -1/4 ``` diff --git a/src/main/java/diarg/values/ValueBasedAgreementScenario.java b/src/main/java/diarg/values/ValueBasedAgreementScenario.java index d354675..5edf341 100644 --- a/src/main/java/diarg/values/ValueBasedAgreementScenario.java +++ b/src/main/java/diarg/values/ValueBasedAgreementScenario.java @@ -163,8 +163,7 @@ public double determineMedianAgreement() { public double determineSatisfactionImpact(int index1, int index2, Value value) { ValueBasedAgreementScenario counterfactualVBAScenario = this.clone(); counterfactualVBAScenario.removeValue(value); - return counterfactualVBAScenario.determineSatisfaction(index1, index2) - - determineSatisfaction(index1, index2); + return determineSatisfaction(index1, index2) - counterfactualVBAScenario.determineSatisfaction(index1, index2); } /** @@ -176,7 +175,7 @@ public double determineSatisfactionImpact(int index1, int index2, Value value) { public double determineMinimalAgreementImpact(Value value) { ValueBasedAgreementScenario counterfactualVBAScenario = this.clone(); counterfactualVBAScenario.removeValue(value); - return counterfactualVBAScenario.determineMinimalAgreement() - determineMinimalAgreement(); + return determineMinimalAgreement() - counterfactualVBAScenario.determineMinimalAgreement(); } /** @@ -188,7 +187,7 @@ public double determineMinimalAgreementImpact(Value value) { public double determineMeanAgreementImpact(Value value) { ValueBasedAgreementScenario counterfactualVBAScenario = this.clone(); counterfactualVBAScenario.removeValue(value); - return counterfactualVBAScenario.determineMeanAgreement() - determineMeanAgreement(); + return determineMeanAgreement() - counterfactualVBAScenario.determineMeanAgreement(); } /** @@ -200,7 +199,7 @@ public double determineMeanAgreementImpact(Value value) { public double determineMedianAgreementImpact(Value value) { ValueBasedAgreementScenario counterfactualVBAScenario = this.clone(); counterfactualVBAScenario.removeValue(value); - return counterfactualVBAScenario.determineMedianAgreement() - determineMedianAgreement(); + return determineMedianAgreement()- counterfactualVBAScenario.determineMedianAgreement(); } diff --git a/src/test/java/diarg/values/ValueBasedAgreementScenarioTest.java b/src/test/java/diarg/values/ValueBasedAgreementScenarioTest.java index b48ec00..7ec98ea 100644 --- a/src/test/java/diarg/values/ValueBasedAgreementScenarioTest.java +++ b/src/test/java/diarg/values/ValueBasedAgreementScenarioTest.java @@ -126,25 +126,25 @@ void determineMedianAgreement() { @Test void determineSatisfactionImpact() { double satisfactionImpact = vbScenario.determineSatisfactionImpact(0, 1, bv); - assertEquals(1/2d, satisfactionImpact); + assertEquals(-1/2d, satisfactionImpact); } @Test void determineMinimalAgreementImpact() { double minimalAgreementImpact = vbScenario.determineMinimalAgreementImpact(bv); - assertEquals(1/4d, minimalAgreementImpact); + assertEquals(-1/4d, minimalAgreementImpact); } @Test void determineMeanAgreementImpact() { double meanAgreementImpact = vbScenario.determineMeanAgreementImpact(bv); - assertEquals(0.16666666666666663d, meanAgreementImpact); + assertEquals(-0.16666666666666663d, meanAgreementImpact); } @Test void determineMedianAgreementImpact() { double medianAgreementImpact = vbScenario.determineMedianAgreementImpact(bv); - assertEquals(1/4d, medianAgreementImpact); + assertEquals(-1/4d, medianAgreementImpact); } }