implement search stations
This commit is contained in:
@@ -65,7 +65,7 @@ public class RouteGraphTest extends Assert {
|
||||
|
||||
@Test
|
||||
public void testRoutes() throws Exception {
|
||||
RouteGraph graph = new RouteGraph(v1, market.getVendors(), 1, 1, true, 4);
|
||||
RouteGraph graph = new RouteGraph(v1, market.getVendors(true), 1, 1, true, 4);
|
||||
graph.setBalance(500);
|
||||
graph.setCargo(5);
|
||||
//Profit: 150 180 200 230 670 620 950 890 620 950 1015 1180 890 950 930
|
||||
@@ -97,7 +97,7 @@ public class RouteGraphTest extends Assert {
|
||||
|
||||
@Test
|
||||
public void testRoutes2() throws Exception {
|
||||
RouteGraph graph = new RouteGraph(v5, market.getVendors(), 1, 15, true, 4);
|
||||
RouteGraph graph = new RouteGraph(v5, market.getVendors(true), 1, 15, true, 4);
|
||||
graph.setBalance(500);
|
||||
graph.setCargo(5);
|
||||
ArrayList<Path<Vendor>> routes = (ArrayList<Path<Vendor>>) graph.getPathsTo(v1, 5);
|
||||
|
||||
@@ -28,7 +28,7 @@ public class RouteSearcherTest extends Assert {
|
||||
Vendor ithaca = market.get().stream().filter((v)->v.getName().equals("Ithaca")).findFirst().get().get().iterator().next();
|
||||
|
||||
RouteSearcher searcher = new RouteSearcher(13.4, 40);
|
||||
RouteGraph graph = new RouteGraph(ithaca, market.getVendors(), 40, 13.4, true, 6);
|
||||
RouteGraph graph = new RouteGraph(ithaca, market.getVendors(true), 40, 13.4, true, 6);
|
||||
graph.setCargo(440);
|
||||
graph.setBalance(6000000);
|
||||
|
||||
@@ -36,7 +36,7 @@ public class RouteSearcherTest extends Assert {
|
||||
List<Path<Vendor>> epaths = graph.getPathsTo(ithaca, 10);
|
||||
PathRoute expect = epaths.stream().map(p -> (PathRoute) p).findFirst().get();
|
||||
|
||||
List<PathRoute> apaths = searcher.getPaths(ithaca, ithaca, market.getVendors(), 6, 6000000, 440, 10);
|
||||
List<PathRoute> apaths = searcher.getPaths(ithaca, ithaca, market.getVendors(true), 6, 6000000, 440, 10);
|
||||
PathRoute actual = apaths.stream().findFirst().get();
|
||||
assertTrue("Routes is different",expect.isRoute(actual));
|
||||
|
||||
@@ -51,23 +51,23 @@ public class RouteSearcherTest extends Assert {
|
||||
Vendor lhs3262 = market.get().stream().filter((v)->v.getName().equals("LHS 3262")).findFirst().get().get().iterator().next();
|
||||
|
||||
RouteSearcher searcher = new RouteSearcher(13.6, 40);
|
||||
RouteGraph graph = new RouteGraph(ithaca, market.getVendors(), 40, 13.6, true, 6);
|
||||
RouteGraph graph = new RouteGraph(ithaca, market.getVendors(true), 40, 13.6, true, 6);
|
||||
graph.setCargo(440);
|
||||
graph.setBalance(6000000);
|
||||
|
||||
List<Path<Vendor>> epaths = graph.getPathsTo(ithaca, 10);
|
||||
PathRoute expect = epaths.stream().map(p -> (PathRoute) p).findFirst().get();
|
||||
|
||||
List<PathRoute> apaths = searcher.getPaths(ithaca, ithaca, market.getVendors(), 6, 6000000, 440, 10);
|
||||
List<PathRoute> apaths = searcher.getPaths(ithaca, ithaca, market.getVendors(true), 6, 6000000, 440, 10);
|
||||
PathRoute actual = apaths.stream().findFirst().get();
|
||||
assertTrue("Routes is different",expect.isRoute(actual));
|
||||
|
||||
graph = new RouteGraph(lhs3262, market.getVendors(), 40, 13.6, true, 6);
|
||||
graph = new RouteGraph(lhs3262, market.getVendors(true), 40, 13.6, true, 6);
|
||||
graph.setCargo(440);
|
||||
graph.setBalance(6000000);
|
||||
|
||||
expect = graph.getPathsTo(lhs3262, 10).stream().map(p -> (PathRoute)p).findFirst().get();
|
||||
apaths = searcher.getPaths(lhs3262, lhs3262, market.getVendors(), 6, 6000000, 440, 10);
|
||||
apaths = searcher.getPaths(lhs3262, lhs3262, market.getVendors(true), 6, 6000000, 440, 10);
|
||||
actual = apaths.stream().findFirst().get();
|
||||
assertEquals("Routes is different",expect.getAvgProfit(), actual.getAvgProfit(), 0.00001);
|
||||
|
||||
|
||||
@@ -166,7 +166,6 @@ public class MarketTest extends Assert {
|
||||
|
||||
int c = 3;
|
||||
for (Vendor vendor : market.getVendors()) {
|
||||
if ("Transit".equals(vendor.toString())) continue;
|
||||
if ("Vendor 1".equals(vendor.getName())){
|
||||
assertEquals(vendor1, vendor);
|
||||
assertEquals(place1, vendor.getPlace());
|
||||
@@ -208,12 +207,12 @@ public class MarketTest extends Assert {
|
||||
place1.remove(vendor2);
|
||||
place2.remove(vendor3);
|
||||
|
||||
assertEquals(2, market.getVendors().size());
|
||||
assertEquals(0, market.getVendors().size());
|
||||
|
||||
market.remove(place1);
|
||||
market.remove(place2);
|
||||
|
||||
assertEquals(0, market.getVendors().size());
|
||||
assertEquals(0, market.getVendors(true).size());
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -340,7 +339,7 @@ public class MarketTest extends Assert {
|
||||
|
||||
assertEquals(0, market.getSell(item1).size());
|
||||
assertEquals(0, market.getBuy(item1).size());
|
||||
assertEquals(0, market.getVendors().size());
|
||||
assertEquals(0, market.getVendors(true).size());
|
||||
assertEquals(0, market.get().size());
|
||||
assertEquals(0, sellStat.getOffers().size());
|
||||
assertEquals(0, buyStat.getOffers().size());
|
||||
|
||||
Reference in New Issue
Block a user