Skip to content

Commit

Permalink
use enum for income dependent scoring
Browse files Browse the repository at this point in the history
  • Loading branch information
rakow committed Jun 9, 2024
1 parent fda4ac7 commit 5b2e9d4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,18 @@ public final class AdvancedScoringConfigGroup extends ReflectiveConfigGroup {

private final List<ScoringParameters> scoringParameters = new ArrayList<>();

public enum IncomeDependentScoring {
none,
avg_by_personal_income,
}

@Parameter
@Comment("The distance groups if marginal utility of distance is adjusted. In meters.")
public List<Integer> distGroups;

@Parameter
@Comment("Enable income dependent marginal utility of money.")
public boolean incomeDependent = true;
public IncomeDependentScoring incomeDependent = IncomeDependentScoring.avg_by_personal_income;


// TODO: maybe option to re-assign variations or use them from attributes
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ static DistanceGroup[] calcDistanceGroups(List<Integer> dists, DoubleList distUt
}

private double computeAvgIncome(Population population) {
if (!scoring.incomeDependent)
if (scoring.incomeDependent == AdvancedScoringConfigGroup.IncomeDependentScoring.none)
return Double.NaN;

log.info("reading income attribute using " + PersonUtils.class + " of all agents and compute global average.\n" +
Expand Down

0 comments on commit 5b2e9d4

Please sign in to comment.