Skip to content

Instantly share code, notes, and snippets.

@abyrd
Created December 16, 2011 16:45
Show Gist options
  • Save abyrd/1486806 to your computer and use it in GitHub Desktop.
Save abyrd/1486806 to your computer and use it in GitHub Desktop.
three-case epsilon dominance
private boolean eDominates(State s0, State s1) {
final double EPSILON1 = 0.05;
final double EPSILON2 = 0.25;
if (s0.similarTripSeq(s1)) {
return s0.getWeight() <= s1.getWeight() * (1 + EPSILON1) &&
s0.getElapsedTime() <= s1.getElapsedTime() * (1 + EPSILON1) &&
s0.getWalkDistance() <= s1.getWalkDistance() * (1 + EPSILON1) &&
s0.getNumBoardings() <= s1.getNumBoardings();
} else if (s0.getTripId() != null && s0.getTripId() == s1.getTripId()) {
return s0.getNumBoardings() < s1.getNumBoardings() &&
s0.getWeight() < s1.getWeight() * (1 + EPSILON2) &&
s0.getElapsedTime() < s1.getElapsedTime() * (1 + EPSILON2) &&
s0.getWalkDistance() < s1.getWalkDistance() * (1 + EPSILON2);
} else {
return false;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment