MATSIM
OnlyTimeDependentTravelDisutility.java
Go to the documentation of this file.
1 /* *********************************************************************** *
2  * project: org.matsim.*
3  * OnlyTimeDependentTravelCostCalculator.java
4  * *
5  * *********************************************************************** *
6  * *
7  * copyright : (C) 2008 by the members listed in the COPYING, *
8  * LICENSE and WARRANTY file. *
9  * email : info at matsim dot org *
10  * *
11  * *********************************************************************** *
12  * *
13  * This program is free software; you can redistribute it and/or modify *
14  * it under the terms of the GNU General Public License as published by *
15  * the Free Software Foundation; either version 2 of the License, or *
16  * (at your option) any later version. *
17  * See also COPYING, LICENSE and WARRANTY file *
18  * *
19  * *********************************************************************** */
20 
21 package org.matsim.core.router.costcalculators;
22 
23 import org.apache.logging.log4j.LogManager;
24 import org.apache.logging.log4j.Logger;
30 import org.matsim.vehicles.Vehicle;
31 
38 
39  private static final Logger log = LogManager.getLogger(OnlyTimeDependentTravelDisutility.class);
40 
41  protected final TravelTime travelTime;
42 
43  public OnlyTimeDependentTravelDisutility(final TravelTime travelTime) {
44  if (travelTime == null) {
45  log.warn("TimeCalculator is null so FreeSpeedTravelTimes will be calculated!");
46  this.travelTime = new FreeSpeedTravelTime();
47  } else this.travelTime = travelTime;
48  }
49 
50  @Override
51  public double getLinkTravelDisutility(final Link link, final double time, final Person person, final Vehicle vehicle) {
52  return this.travelTime.getLinkTravelTime(link, time, person, vehicle);
53  }
54 
55  @Override
56  public double getLinkMinimumTravelDisutility(final Link link) {
57  return link.getLength() / link.getFreespeed();
58  }
59 }
double getLinkTravelDisutility(final Link link, final double time, final Person person, final Vehicle vehicle)
double getLinkTravelTime(Link link, double time, Person person, Vehicle vehicle)