/** * Merges all qualifying links, ignoring length threshold. * @param network */ public void run(final Network network){ run(network, Double.POSITIVE_INFINITY, ThresholdExceeded.EITHER); }
/** * Merges all qualifying links while ensuring no link is shorter than the * given threshold. * <br/> * Comments:<ul> * <li>I would argue against setting the thresholdLength to anything different from POSITIVE_INFINITY, since * the result of the method depends on the sequence in which the algorithm goes through the nodes. </li> * </ul> * @param network * @param thresholdLength */ @Deprecated public void run(final Network network, double thresholdLength){ run(network, thresholdLength, ThresholdExceeded.BOTH); run(network, thresholdLength, ThresholdExceeded.EITHER); }
public static void runNetworkSimplifier( Network network ) { new NetworkSimplifier().run(network) ; } public static void writeNetwork(Network network, String string) {
public static void main(String[] args) { final String inNetworkFile = args[ 0 ]; final String outNetworkFile = args[ 1 ]; Set<Integer> nodeTypesToMerge = new TreeSet<>(); nodeTypesToMerge.add(4); nodeTypesToMerge.add(5); Scenario scenario = ScenarioUtils.createScenario(ConfigUtils.createConfig()); final Network network = scenario.getNetwork(); new MatsimNetworkReader(scenario.getNetwork()).readFile( inNetworkFile ); NetworkSimplifier nsimply = new NetworkSimplifier(); nsimply.setNodesToMerge(nodeTypesToMerge); // nsimply.setMergeLinkStats(true); nsimply.run(network, Double.NEGATIVE_INFINITY); new NetworkWriter(network).write( outNetworkFile ); }
public static void run(String[] args) { String input = args[0]; String output = args[1]; Network network = NetworkUtils.createNetwork(); new MatsimNetworkReader(network).readFile(input); IntersectionSimplifier ns = new IntersectionSimplifier(30.0, 2); Network newNetwork = ns.simplify(network); NetworkCalcTopoType nct = new NetworkCalcTopoType(); nct.run(newNetwork); LOG.info("Simplifying the network..."); new NetworkSimplifier().run(newNetwork); LOG.info("Cleaning the network..."); new NetworkCleaner().run(newNetwork); IntersectionSimplifier.reportNetworkStatistics(newNetwork); new NetworkWriter(newNetwork).write(output); }
@Test public void testRunMergeLinkStats() { Network network = buildNetwork(); NetworkSimplifier nst = new NetworkSimplifier(); nst.setMergeLinkStats(true); nst.run(network, 20.0); assertEquals("Wrong number of links", 2, network.getLinks().size()); assertNotNull("Expected link not found.", network.getLinks().get(Id.createLinkId("AB-BC"))); assertNotNull("Expected link not found.", network.getLinks().get(Id.createLinkId("CD-DE-EF"))); network = buildNetwork(); nst.run(network, 40.0); assertEquals("Wrong number of links", 1, network.getLinks().size()); assertNotNull("Expected link not found.", network.getLinks().get(Id.createLinkId("AB-BC-CD-DE-EF"))); network = buildNetwork(); nst.run(network, 5.0); assertEquals("Wrong number of links", 5, network.getLinks().size()); }
@Test public void testRun() { Network network = buildNetwork(); NetworkSimplifier nst = new NetworkSimplifier(); nst.run(network, 20.0); assertEquals("Wrong number of links", 3, network.getLinks().size()); assertNotNull("Expected link not found.", network.getLinks().get(Id.createLinkId("AB-BC"))); assertNotNull("Expected link not found.", network.getLinks().get(Id.createLinkId("CD"))); assertNotNull("Expected link not found.", network.getLinks().get(Id.createLinkId("DE-EF"))); }
networkSimplifier.run(network);
nct.run(simpleNetwork); NetworkSimplifier ns = new NetworkSimplifier(); ns.run(simpleNetwork); new NetworkCleaner().run(simpleNetwork); new NetworkWriter(simpleNetwork).write(utils.getOutputDirectory() + "network.xml");
simplifier.run(newClusteredIntersectionsRoadNetwork); new NetworkCleaner().run(newClusteredIntersectionsRoadNetwork);
new NetworkSimplifier().run(net,500); new NetworkCleaner().run(net); new NetworkWriter(net).write(xmlfile);