Skip to content

Commit

Permalink
Bl/#848 remove unused config options 4ci (#924)
Browse files Browse the repository at this point in the history
* remove unused keys in config files
 - beam.basePackage
 - beam.agentsim.agents.drivingCost.defaultLitersPerMeter
 - beam.agentsim.agents.drivingCost.defaultPricePerGallon
 - beam.agentsim.agents.rideHail.vehicleRangeInMeters
 - beam.debug.skipOverBadActors = true
 - beam.debug.secondsToWaitForSkip = 30

* remove beam.debug.skipOverBadActors usage in RideHailTestHelper

* removed akka.conf from sfbay prod.conf

* remove production folder entirely

* regenerated beam config

* fixed compilation issues with removed config options
  • Loading branch information
bhavyalatha26 authored and colinsheppard committed Nov 27, 2018
1 parent 43c4666 commit f779e53
Show file tree
Hide file tree
Showing 16 changed files with 599 additions and 1,763 deletions.
411 changes: 0 additions & 411 deletions production/application-sfbay/prod.conf

This file was deleted.

181 changes: 0 additions & 181 deletions production/common/akka.conf

This file was deleted.

27 changes: 0 additions & 27 deletions production/common/metrics.conf

This file was deleted.

3 changes: 0 additions & 3 deletions src/main/resources/beam-template.conf
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,6 @@ beam.agentsim.agents.modalBehaviors.mulitnomialLogit.params.walk_intercept = "do
beam.agentsim.agents.modalBehaviors.mulitnomialLogit.params.bike_intercept = "double | 0.0"
beam.agentsim.agents.modalBehaviors.lccm.paramFile = ${beam.inputDirectory}"/lccm-long.csv"
beam.agentsim.agents.modeSubsidy.file = ${beam.inputDirectory}"/subsidies.csv"
#DrivingCostDefaults Params
beam.agentsim.agents.drivingCost.defaultLitersPerMeter = "double | 0.0001069"
beam.agentsim.agents.drivingCost.defaultPricePerGallon = "double | 3.115"
#TAZ params
beam.agentsim.taz.file=${beam.inputDirectory}"/taz-centers.csv"
beam.agentsim.taz.parking=${beam.inputDirectory}"/taz-parking.csv"
Expand Down
60 changes: 29 additions & 31 deletions src/main/scala/beam/replanning/utilitybased/ChangeModeForTour.scala
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import java.util
import java.util.Collections

import beam.agentsim.agents.Population
import beam.agentsim.agents.choice.mode.DrivingCostDefaults.LITERS_PER_GALLON
import beam.agentsim.agents.choice.mode.TransitFareDefaults
import beam.agentsim.agents.modalbehaviors.ModeChoiceCalculator
import beam.agentsim.agents.vehicles.BeamVehicleType
import beam.router.Modes.BeamMode
import beam.router.Modes.BeamMode.{BUS, CAR, DRIVE_TRANSIT, FERRY, RAIL, RIDE_HAIL, SUBWAY, WALK, WALK_TRANSIT}
import beam.sim.BeamServices
Expand All @@ -23,13 +23,13 @@ import org.matsim.core.router.TripStructureUtils.Subtour
import org.matsim.core.router.{CompositeStageActivityTypes, TripRouter, TripStructureUtils}

import scala.collection.JavaConverters._
import scala.collection.{mutable, JavaConverters}
import scala.collection.{JavaConverters, mutable}
import scala.util.Random

class ChangeModeForTour(
beamServices: BeamServices,
chainBasedTourVehicleAllocator: ChainBasedTourVehicleAllocator
) extends PlanAlgorithm {
beamServices: BeamServices,
chainBasedTourVehicleAllocator: ChainBasedTourVehicleAllocator
) extends PlanAlgorithm {

val rng = new MersenneTwister(3004568) // Random.org
val random = new Random(3004568)
Expand All @@ -45,10 +45,8 @@ class ChangeModeForTour(
)
)
)
private val drivingCostConfig =
beamServices.beamConfig.beam.agentsim.agents.drivingCost
private val rideHailConfig =
beamServices.beamConfig.beam.agentsim.agents.rideHail
beamServices.beamConfig.beam.agentsim.agents.rideHail

val DefaultRideHailCostPerMile: Double = rideHailConfig.defaultCostPerMile
val DefaultRideHailCostPerMinute: Double = rideHailConfig.defaultCostPerMinute
Expand All @@ -59,15 +57,15 @@ class ChangeModeForTour(
val res = weightedRandom.sample(1, Array())
chainBasedTourVehicleAllocator.identifyChainBasedModesForAgent(person.getId) ++ Vector[
BeamMode
](res(0)) ++
Vector[BeamMode](WALK, RIDE_HAIL)
](res(0)) ++
Vector[BeamMode](WALK, RIDE_HAIL)
}

def scoreTour(
tour: Subtour,
person: Person,
modeChoiceCalculator: ModeChoiceCalculator
): Map[BeamMode, Double] = {
tour: Subtour,
person: Person,
modeChoiceCalculator: ModeChoiceCalculator
): Map[BeamMode, Double] = {
val alternativesForTour = findAlternativesForTour(tour, person)
(for { alt <- alternativesForTour } yield {
alt -> JavaConverters
Expand All @@ -92,10 +90,10 @@ class ChangeModeForTour(
}

def getCostAndTimeForMode(
beamMode: BeamMode,
origin: Activity,
dest: Activity
): (Double, Double) = {
beamMode: BeamMode,
origin: Activity,
dest: Activity
): (Double, Double) = {
val originCoord = origin.getCoord
val destCoord = dest.getCoord
val tripDistanceInMeters = beamServices.geo
Expand All @@ -108,7 +106,7 @@ class ChangeModeForTour(
def distanceScaling(beamMode: BeamMode, distance: Double): Double = {
beamMode match {
case BeamMode.CAR =>
distance * (drivingCostConfig.defaultLitersPerMeter / LITERS_PER_GALLON) * drivingCostConfig.defaultPricePerGallon
BeamVehicleType.defaultCarBeamVehicleType.getCost(distance)
case WALK => distance * 6 // MATSim Default
case RIDE_HAIL =>
distance * DefaultRideHailCostPerMile.toDouble * (1 / 1609.34) // 1 mile = 1609.34
Expand All @@ -134,9 +132,9 @@ class ChangeModeForTour(
}

def rankAlternatives(
plan: Plan,
attributesOfIndividual: AttributesOfIndividual
): Map[Int, Map[BeamMode, Double]] = {
plan: Plan,
attributesOfIndividual: AttributesOfIndividual
): Map[Int, Map[BeamMode, Double]] = {
val modeChoiceCalculator =
beamServices.modeChoiceCalculatorFactory(attributesOfIndividual)
val subTours = JavaConverters.collectionAsScalaIterable(
Expand Down Expand Up @@ -191,12 +189,12 @@ class ChangeModeForTour(
}

def insertEmptyTrip(
plan: Plan,
fromActivity: Activity,
toActivity: Activity,
mainMode: String,
pf: PopulationFactory
): Unit = {
plan: Plan,
fromActivity: Activity,
toActivity: Activity,
mainMode: String,
pf: PopulationFactory
): Unit = {
val list: util.List[Leg] = Collections.singletonList(pf.createLeg(mainMode))
TripRouter.insertTrip(plan, fromActivity, list, toActivity)
}
Expand All @@ -215,7 +213,7 @@ class ChangeModeForTour(
acts(1),
"car",
chainBasedTourVehicleAllocator.population.getFactory
)
)
)
}

Expand Down Expand Up @@ -296,8 +294,8 @@ class ChangeModeForTour(

private def maybeFixPlans(plan: Plan): Unit = {
if (JavaConverters
.collectionAsScalaIterable(TripStructureUtils.getLegs(plan))
.isEmpty) {
.collectionAsScalaIterable(TripStructureUtils.getLegs(plan))
.isEmpty) {
addTripsBetweenActivities(plan)
}
plan.getPlanElements.asScala.foreach {
Expand Down
Loading

0 comments on commit f779e53

Please sign in to comment.