Skip to content

Commit

Permalink
Merge pull request #2125 from LBNL-UCB-STI/rjf/#2124-expose-min-searc…
Browse files Browse the repository at this point in the history
…h-radius-param

minSearchRadius config parameter added
  • Loading branch information
wrashid authored Aug 27, 2019
2 parents 9e45932 + 07f7c6f commit 55b05ad
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 6 deletions.
3 changes: 2 additions & 1 deletion src/main/resources/beam-template.conf
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,8 @@ beam.agentsim.agents.parking.mulitnomialLogit.params.distanceMultiplier = "doubl
beam.agentsim.agents.parking.mulitnomialLogit.params.parkingPriceMultiplier = "double | -0.005" // based on avg. parking prices up to $200!
beam.agentsim.agents.parking.mulitnomialLogit.params.homeActivityPrefersResidentialParkingMultiplier = "double | 1.0" // positive boost of 1.0 if true
beam.agentsim.agents.parking.rangeAnxietyBuffer = "double | 20000.0" // if our remaining range exceeds our remaining tour plus this many meters, then we feel no anxiety; default 20k
beam.agentsim.agents.parking.maxSearchRadius = "double | 8046.72"
beam.agentsim.agents.parking.minSearchRadius = "double | 250.00" // something small enough that, on average, we see 2 orders of magnitude of samples at most
beam.agentsim.agents.parking.maxSearchRadius = "double | 8046.72" // something large enough that we don't strand our drivers in an oasis

#TAZ params
beam.agentsim.taz.filePath = ${beam.inputDirectory}"/taz-centers.csv"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,16 @@ class ZonalParkingManager(
parkingZones: Array[ParkingZone],
zoneSearchTree: ParkingZoneSearch.ZoneSearchTree[TAZ],
rand: Random,
minSearchRadius: Double,
maxSearchRadius: Double,
boundingBox: Envelope,
mnlMultiplierParameters: ParkingMNL.ParkingMNLConfig
) extends Actor
with ActorLogging {

if (maxSearchRadius < ZonalParkingManager.MinSearchRadius) {
if (maxSearchRadius < minSearchRadius) {
log.warning(
s"maxSearchRadius of $maxSearchRadius meters provided from config is less than the fixed minimum search radius of ${ZonalParkingManager.MinSearchRadius}; no searches will occur with these settings."
s"maxSearchRadius of $maxSearchRadius meters provided from config is less than the fixed minimum search radius of ${minSearchRadius}; no searches will occur with these settings."
)
}

Expand All @@ -43,7 +44,7 @@ class ZonalParkingManager(

val parkingZoneSearchConfiguration: ParkingZoneSearchConfiguration =
ParkingZoneSearchConfiguration(
ZonalParkingManager.MinSearchRadius,
minSearchRadius,
maxSearchRadius,
boundingBox,
geo.distUTMInMeters
Expand Down Expand Up @@ -274,7 +275,6 @@ object ZonalParkingManager extends LazyLogging {

// this number should be less than the MaxSearchRadius config value, tuned to being
// slightly less than the average distance between TAZ centroids.
val MinSearchRadius: Double = 1000.0

val AveragePersonWalkingSpeed: Double = 1.4 // in m/s
val HourInSeconds: Int = 3600
Expand All @@ -296,6 +296,7 @@ object ZonalParkingManager extends LazyLogging {
val parkingFilePath: String = beamConfig.beam.agentsim.taz.parkingFilePath
val parkingStallCountScalingFactor = beamConfig.beam.agentsim.taz.parkingStallCountScalingFactor
val parkingCostScalingFactor = beamConfig.beam.agentsim.taz.parkingCostScalingFactor
val minSearchRadius = beamConfig.beam.agentsim.agents.parking.minSearchRadius
val maxSearchRadius = beamConfig.beam.agentsim.agents.parking.maxSearchRadius
val mnlParamsFromConfig = beamConfig.beam.agentsim.agents.parking.mulitnomialLogit.params
// distance to walk to the destination
Expand Down Expand Up @@ -339,6 +340,7 @@ object ZonalParkingManager extends LazyLogging {
stalls,
searchTree,
random,
minSearchRadius,
maxSearchRadius,
boundingBox,
mnlMultiplierParameters
Expand All @@ -358,6 +360,7 @@ object ZonalParkingManager extends LazyLogging {
tazTreeMap: TAZTreeMap,
geo: GeoUtils,
random: Random,
minSearchRadius: Double,
maxSearchRadius: Double,
boundingBox: Envelope,
includesHeader: Boolean = true
Expand All @@ -369,6 +372,7 @@ object ZonalParkingManager extends LazyLogging {
parking.zones,
parking.tree,
random,
minSearchRadius,
maxSearchRadius,
boundingBox,
ParkingMNL.DefaultMNLParameters
Expand Down
4 changes: 3 additions & 1 deletion src/main/scala/beam/sim/config/BeamConfig.scala
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// generated by tscfg 0.9.4 on Mon Aug 26 14:38:09 MDT 2019
// generated by tscfg 0.9.4 on Mon Aug 26 21:00:03 MDT 2019
// source: src/main/resources/beam-template.conf

package beam.sim.config
Expand Down Expand Up @@ -589,6 +589,7 @@ object BeamConfig {

case class Parking(
maxSearchRadius: scala.Double,
minSearchRadius: scala.Double,
mulitnomialLogit: BeamConfig.Beam.Agentsim.Agents.Parking.MulitnomialLogit,
rangeAnxietyBuffer: scala.Double
)
Expand Down Expand Up @@ -639,6 +640,7 @@ object BeamConfig {
def apply(c: com.typesafe.config.Config): BeamConfig.Beam.Agentsim.Agents.Parking = {
BeamConfig.Beam.Agentsim.Agents.Parking(
maxSearchRadius = if (c.hasPathOrNull("maxSearchRadius")) c.getDouble("maxSearchRadius") else 8046.72,
minSearchRadius = if (c.hasPathOrNull("minSearchRadius")) c.getDouble("minSearchRadius") else 250.00,
mulitnomialLogit = BeamConfig.Beam.Agentsim.Agents.Parking.MulitnomialLogit(
if (c.hasPathOrNull("mulitnomialLogit")) c.getConfig("mulitnomialLogit")
else com.typesafe.config.ConfigFactory.parseString("mulitnomialLogit{}")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -280,13 +280,15 @@ object ZonalParkingManagerSpec {
boundingBox: Envelope,
random: Random = Random
)(implicit system: ActorSystem): ActorRef = {
val minSearchRadius = 1000.0
val maxSearchRadius = 16093.4 // meters, aka 10 miles
val zonalParkingManagerProps = Props(
ZonalParkingManager(
parkingDescription,
tazTreeMap,
geo,
random,
minSearchRadius,
maxSearchRadius,
boundingBox
)
Expand Down

0 comments on commit 55b05ad

Please sign in to comment.