look "through" BEAR_AWAY/HEAD_UP nodes and use WindCourseRange of last TACK/JIBE node preceding current;

this is to avoid HEAD_UP/BEAR_AWAY large wind ranges accidentally
"joining" TACK/JIBE maneuvers with flipped wind directions

Change-Id: I5298a45aaa7b329c8c985e807f79f2f8f7e1a4a6
This commit is contained in:
Axel Uhl
2019-07-17 23:25:49 +02:00
parent 6a27f4e3d7
commit b6e2b97712
4 changed files with 124 additions and 71 deletions
@@ -15,7 +15,7 @@ import org.junit.Before;
import org.junit.Test;
import com.sap.sailing.windestimation.aggregator.graph.DijkstraShortestPathFinderImpl;
import com.sap.sailing.windestimation.aggregator.graph.DijsktraShortestPathFinder.Result;
import com.sap.sailing.windestimation.aggregator.graph.DijsktraShortestPathFinder;
import com.sap.sailing.windestimation.aggregator.graph.ElementAdjacencyQualityMetric;
import com.sap.sailing.windestimation.aggregator.graph.ElementWithQuality;
import com.sap.sailing.windestimation.aggregator.graph.GroupOutOfWhichToPickTheBestElement;
@@ -25,7 +25,6 @@ import com.sap.sse.common.Util.Pair;
import com.sap.sse.common.impl.NamedImpl;
public class DijkstraTest {
private DijkstraShortestPathFinderImpl<Node> dijkstra;
private Node startNode;
private Node endNode;
private Map<Node, Set<Node>> successors;
@@ -79,7 +78,6 @@ public class DijkstraTest {
@Before
public void setUp() {
dijkstra = new DijkstraShortestPathFinderImpl<DijkstraTest.Node>();
startNode = new Node("Start", 1.0);
endNode = new Node("End", 1.0);
successors = new HashMap<>();
@@ -138,10 +136,10 @@ public class DijkstraTest {
()->root, nodeName->new Node(nodeName, 1.0));
// the edge qualities for the additional artificial nodes will all default to 1.0
// ...and solve the inner graph's shortest path problem, once for each artificial leaf:
final Iterable<Node> bestPathStartingAtLevel3Left = new DijkstraShortestPathFinderImpl<Node>().getShortestPath(
final Iterable<Node> bestPathStartingAtLevel3Left = new DijkstraShortestPathFinderImpl<Node>(
successorSupplier.getArtificialLeaf(level3Left), successorSupplier.getArtificialRoot(),
successorSupplier, getEdgeQualitySupplier()).getShortestPath();
final Iterable<Node> bestPathStartingAtLevel3Right = new DijkstraShortestPathFinderImpl<Node>().getShortestPath(
final Iterable<Node> bestPathStartingAtLevel3Right = new DijkstraShortestPathFinderImpl<Node>(
successorSupplier.getArtificialLeaf(level3Right), successorSupplier.getArtificialRoot(),
successorSupplier, getEdgeQualitySupplier()).getShortestPath();
// We expect the two solutions to provide different best inner nodes for the converging level1 node.
@@ -166,7 +164,7 @@ public class DijkstraTest {
}
private Iterable<Node> getShortestPath() {
final Result<Node> result = dijkstra.getShortestPath(startNode, endNode,
final DijsktraShortestPathFinder<Node> result = new DijkstraShortestPathFinderImpl<Node>(startNode, endNode,
n -> successors.get(n), getEdgeQualitySupplier());
return result == null ? null : result.getShortestPath();
}