diff --git a/java/com.sap.sailing.domain/src/com/sap/sailing/domain/markpassingcalculation/CandidateChooser.java b/java/com.sap.sailing.domain/src/com/sap/sailing/domain/markpassingcalculation/CandidateChooser.java index 89294e3606c..a11849c1bab 100755 --- a/java/com.sap.sailing.domain/src/com/sap/sailing/domain/markpassingcalculation/CandidateChooser.java +++ b/java/com.sap.sailing.domain/src/com/sap/sailing/domain/markpassingcalculation/CandidateChooser.java @@ -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))); diff --git a/java/com.sap.sailing.domain/src/com/sap/sailing/domain/markpassingcalculation/CandidateFinder.java b/java/com.sap.sailing.domain/src/com/sap/sailing/domain/markpassingcalculation/CandidateFinder.java index 78671884639..347539d3952 100755 --- a/java/com.sap.sailing.domain/src/com/sap/sailing/domain/markpassingcalculation/CandidateFinder.java +++ b/java/com.sap.sailing.domain/src/com/sap/sailing/domain/markpassingcalculation/CandidateFinder.java @@ -42,7 +42,7 @@ public class CandidateFinder implements AbstractCandidateFinder { private LinkedHashMap, Candidate>>> cteCandidates = new LinkedHashMap<>(); private LinkedHashMap>> distanceCandidates = new LinkedHashMap<>(); private final DynamicTrackedRace race; - private final double penaltyForSkipping = 1 - Edge.penaltyForSkipped; + private final double penaltyForSkipping = 1 - Edge.getPenaltyForSkipping(); private final LinkedHashMap passingInstructions = new LinkedHashMap<>(); private final Comparator comp = new Comparator() { @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; } diff --git a/java/com.sap.sailing.domain/src/com/sap/sailing/domain/markpassingcalculation/Edge.java b/java/com.sap.sailing.domain/src/com/sap/sailing/domain/markpassingcalculation/Edge.java index 16e7afc9705..57a86430302 100755 --- a/java/com.sap.sailing.domain/src/com/sap/sailing/domain/markpassingcalculation/Edge.java +++ b/java/com.sap.sailing.domain/src/com/sap/sailing/domain/markpassingcalculation/Edge.java @@ -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(); } } \ No newline at end of file