private Node addNode(Network net, Node n){ Node newNode = net.getFactory().createNode(n.getId(), n.getCoord()); net.addNode(newNode); return newNode; }
@Override public double getLinkMinimumTravelDisutility(Link link) { return link.getLength(); } }
@Override public double getWidth(final Link link) { return link.getCapacity() * this.widthCoefficient; } }
private static Link findLinkBetween(final Network network, final Id<Link> fromLinkId, final Id<Link> toLinkId) { Link fromLink = network.getLinks().get(fromLinkId); Link toLink = network.getLinks().get(toLinkId); Node from = fromLink.getToNode(); Node to = toLink.getFromNode(); for (Link link : from.getOutLinks().values()) { if (link.getToNode() == to) { return link; } } return null; }
private static Link createLink(final Network network, final Id<Link> id, final Id<Node> fromNodeId, final Id<Node> toNodeId, final Set<String> modes) { Link link = network.getFactory().createLink(id, network.getNodes().get(fromNodeId), network.getNodes().get(toNodeId)); link.setAllowedModes(modes); link.setCapacity(2000.0); link.setFreespeed(10.0); link.setLength(100.0); link.setNumberOfLanes(1); return link; }
@Override public double getLinkTravelDisutility(final Link link, final double time, final Person person, final Vehicle vehicle) { if (this.marginalUtlOfDistance == 0.0) { return (link.getLength() / link.getFreespeed(time)) * this.travelCostFactor; } return (link.getLength() / link.getFreespeed(time)) * this.travelCostFactor - this.marginalUtlOfDistance * link.getLength(); }
public void initForLink(final Link link) { this.fromNode = link.getFromNode(); this.toNode = link.getToNode(); this.tmpToNodeData = null; }
private void setDefaultLinkAttributes(final Link link) { link.setLength(1000.0); link.setFreespeed(10.0); link.setCapacity(3600.0); link.setNumberOfLanes(1); } }
@Override public Id<Link> getLinkId() { return l.getId(); } }
@Override public Attributes getAttributes() { return this.network.getAttributes(); } }
/** * Writes the network in the current default format (currently network_v1.dtd). */ @Override public void write(final String filename) { writeV2(filename); }
@Override public double getFlowCapacityPerSec() { return this.link.getFlowCapacityPerSec() ; } @Override
@Override public double getLinkMinimumTravelDisutility(Link link) { if (this.marginalUtlOfDistance == 0.0) { return (link.getLength() / link.getFreespeed()) * this.travelCostFactor; } return (link.getLength() / link.getFreespeed()) * this.travelCostFactor - this.marginalUtlOfDistance * link.getLength(); }
@SuppressWarnings("static-method") private boolean checkNextLinkSemantics(Link currentLink, Link nextLink, MobsimAgent personAgent){ if (currentLink.getToNode() != nextLink.getFromNode()) { // throw new RuntimeException("Cannot move PersonAgent " + personAgent.getId() + // " from link " + currentLink.getId() + " to link " + nextLink.getId()); return false ; } return true ; }
private void setDefaultLinkAttributes(final Link link) { link.setLength(1000.0); link.setFreespeed(10.0); link.setCapacity(3600.0); link.setNumberOfLanes(1); }
@Override public double getTollAmount(Cost cost, Link link) { if(cost == null) return 0.0; return cost.amount*link.getLength(); }
@Override public double getLinkMinimumTravelDisutility(Link link) { return link.getLength() / link.getFreespeed(); } }
private void setDefaultLinkAttributes(final Link link) { link.setLength(1000.0); link.setFreespeed(10.0); link.setCapacity(3600.0); link.setNumberOfLanes(1); } }
public static double calcDistance( final LeastCostPathCalculator.Path path ) { double length = 0. ; for ( Link link : path.links ) { length += link.getLength() ; } return length ; }
@Override public double getLinkTravelDisutility(final Link link, final double time, final Person person, final Vehicle vehicle) { return link.getLength(); }