Archived
0

new more fasted route finder

This commit is contained in:
iMoHax
2015-07-13 15:20:09 +03:00
parent 6e0fe05576
commit 12716b7d3e
14 changed files with 801 additions and 201 deletions

View File

@@ -78,6 +78,10 @@ public class RouteSearcherTest extends Assert{
assertEquals(route.getDistance(), 72.42, 0.01);
List<Route> apaths = searcher.getRoutes(ithaca_st, ithaca_st, fWorld.getMarkets(true).collect(Collectors.toList()));
/* List<Route> apaths = searcher.getRoutes(ithaca_st, ithaca_st, Arrays.asList(ithaca_st, lhs3262_st,
morgor_st, lhs3006_st, ithaca.asTransit(), lhs3262.asTransit(),
morgor.asTransit(), lhs3006.asTransit()));
*/
Route actual = apaths.stream().findFirst().get();
assertEquals("Routes is different", route, actual);

View File

@@ -6,6 +6,7 @@ import org.junit.Before;
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import ru.trader.analysis.graph.ConnectibleGraph;
import ru.trader.analysis.graph.Crawler;
import ru.trader.analysis.graph.SimpleCollector;
import ru.trader.analysis.graph.Vertex;
@@ -58,10 +59,10 @@ public class VendorsGraphTest extends Assert {
LOG.info("Build vendors graph");
VendorsGraph vGraph = new VendorsGraph(scorer);
vGraph.build(cabreraDock, fWorld.getMarkets(true).collect(Collectors.toList()));
LOG.info("Search");
SimpleCollector<Vendor> paths = new SimpleCollector<>();
Crawler<Vendor> crawler = vGraph.crawler(paths::add);
// Cabrera Dock -> Transit Wolf 1323 -> Transit Wolf 1325 -> Quimper Ring -> Transit Bhadaba -> Transit Wolf 1325 -> Cabrera Dock]
crawler.findMin(cabreraDock, 100);
assertEquals(100, paths.get().size());
paths.clear();