Edge variables are private.

This commit is contained in:
Nick Klose committed 2014-02-03 14:34:28 +01:00
1 parent a24c054af4
commit b1c159fdfb
3 files changed
+21 -14

No files matched your search

@@ -41,7 +41,7 @@ public class CandidateChooser implements AbstractCandidateChooser {
private Candidate start;
private Candidate end;
private final DynamicTrackedRace race;
private final double penaltyForSkipping = 1 - Edge.penaltyForSkipped;
private final double penaltyForSkipping = 1 - Edge.getPenaltyForSkipping();
private static double strictness = 1000;
public CandidateChooser(DynamicTrackedRace race) {
@@ -99,9 +99,9 @@ public class CandidateChooser implements AbstractCandidateChooser {
allEdges.get(co).add(e);
}
} else {
if (early == start && late.getID() == 1 && numberOfCloseStarts(late.getTimePoint()) > penaltyForSkipping) {
/*if (early == start && late.getID() == 1 && numberOfCloseStarts(late.getTimePoint()) > penaltyForSkipping) {
allEdges.get(co).add(new Edge(early, late, numberOfCloseStarts(late.getTimePoint())));
} else if (late == end || early == start) {
} else*/ if (late == end || early == start) {
allEdges.get(co).add(new Edge(early, late, 1));
} else if (!(early.getID() == late.getID()) && late.getTimePoint().after(early.getTimePoint()) && estimatedDistance(co, early, late) > penaltyForSkipping) {
allEdges.get(co).add(new Edge(early, late, estimatedDistance(co, early, late)));
@@ -42,7 +42,7 @@ public class CandidateFinder implements AbstractCandidateFinder {
private LinkedHashMap<Competitor, LinkedHashMap<Waypoint, LinkedHashMap<List<GPSFix>, Candidate>>> cteCandidates = new LinkedHashMap<>();
private LinkedHashMap<Competitor, LinkedHashMap<Waypoint, LinkedHashMap<GPSFix, Candidate>>> distanceCandidates = new LinkedHashMap<>();
private final DynamicTrackedRace race;
private final double penaltyForSkipping = 1 - Edge.penaltyForSkipped;
private final double penaltyForSkipping = 1 - Edge.getPenaltyForSkipping();
private final LinkedHashMap<Waypoint, PassingInstruction> passingInstructions = new LinkedHashMap<>();
private final Comparator<GPSFix> comp = new Comparator<GPSFix>() {
@Override
@@ -86,6 +86,7 @@ public class CandidateFinder implements AbstractCandidateFinder {
}
passingInstructions.put(w, instruction);
}
Edge.setNumberOfWayoints(passingInstructions.keySet().size());
}
}
@@ -199,7 +200,7 @@ public class CandidateFinder implements AbstractCandidateFinder {
if (dis1 != null && dis3 != null && dis2 < dis1 && dis2 < dis3) {
t = fix.getTimePoint();
p = fix.getPosition();
cost = getDistanceLikelyhood(w, p, t) * 0.85;
cost = getDistanceLikelyhood(w, p, t) * 0.95;
if (cost > penaltyForSkipping) {
isCan = true;
}
@@ -382,7 +383,7 @@ public class CandidateFinder implements AbstractCandidateFinder {
private double getDistanceLikelyhood(Waypoint w, Position p, TimePoint t) {
double distance = calculateDistance(p, w, t);
double legLength = getLegLength(t, w);
double result = 1 / (20 * Math.abs( distance/legLength ) + 1);
double result = 1 / (15 * Math.abs( distance/legLength ) + 1);
// Auch NormalVerteilung??!
return result;
}
@@ -16,7 +16,8 @@ import com.sap.sailing.domain.base.Waypoint;
public class Edge {
private Candidate start;
private Candidate end;
static double penaltyForSkipped = 0.8;
private static int numberOfWaypoints;
private static double penaltyForSkipped = 0.6;
private double timeEstimationOrCloseStartsProbability;
public Edge(Candidate start, Candidate end, double timeEstimationOrStartAnalysis) {
@@ -25,13 +26,17 @@ public class Edge {
this.timeEstimationOrCloseStartsProbability = timeEstimationOrStartAnalysis;
}
public String getIDs() {
return start.getID() + "-" + end.getID();
public static double getPenaltyForSkipping() {
return penaltyForSkipped;
}
public static void setNumberOfWayoints(int number) {
numberOfWaypoints = number;
}
public double getProbability() {
return 1 - (start.getProbability() * end.getProbability() * timeEstimationOrCloseStartsProbability)
+ 2*penaltyForSkipped * (end.getID() - start.getID()- 1) ;
double penalty = end.getID() == numberOfWaypoints + 1 ? penaltyForSkipped : 0.9;
return 1 - (start.getProbability() * end.getProbability() * timeEstimationOrCloseStartsProbability) + 2 * penalty * (end.getID() - start.getID() - 1);
}
public Candidate getStart() {
@@ -41,7 +46,8 @@ public class Edge {
public Candidate getEnd() {
return end;
}
public String toString(){
return "From ID " + start.getID()+ " to "+end.getID()+": "+ getProbability();
public String toString() {
return "From ID " + start.getID() + " to " + end.getID() + ": " + getProbability();
}
}