Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change sign of value impact measures #22

Merged
merged 1 commit into from
Feb 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions AgreementScenarios.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
```

9 changes: 4 additions & 5 deletions src/main/java/diarg/values/ValueBasedAgreementScenario.java
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

/**
Expand All @@ -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();
}

/**
Expand All @@ -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();
}

/**
Expand All @@ -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();
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

}
Loading