Description
The SANDAG adjust_auto_operating_cost model produces process-count-dependent results when run as part of a sliced multiprocessing phase.
The model calculates an adjustment factor using:
target_auto_operating_cost / vehicles["auto_operating_cost"].mean()
When this step runs inside a household multiprocess worker, vehicles contains only that worker’s slice. Each worker therefore calculates a different factor instead of using the mean across all simulated vehicles.
Observed behavior
Using the same model inputs:
- A one-process run calculated a regional adjustment factor of
1.4262046773.
- A two-process run calculated worker-specific factors of:
- Worker 0:
1.4267902615
- Worker 1:
1.4256206636
Each worker’s subset has the requested mean afterward, which can mask the problem in aggregate summaries. However, individual vehicle operating costs differ depending on the number and composition of multiprocessing slices.
Impact
This makes results dependent on the configured process count:
- Vehicle operating costs are not reproducible across process counts.
- Auto costs used in downstream utilities and logsums vary by MP process number, typically only a tiny bit, but still some.
- Mode-choice costs and potentially discrete choices can change.
- Trip matrices and scenario comparisons can reflect multiprocessing configuration rather than model inputs.
- The regional mean can still appear correct, making the issue difficult to detect from aggregate validation alone.
This is independent of Sharrow caching or random-number generation; it results from computing a regional statistic on partitioned data.
Expected behavior
The adjustment factor should be calculated once using the complete regional vehicle table. The resulting adjusted vehicle costs should be invariant to the number of multiprocessing workers, apart from negligible floating-point reduction differences.
Proposed fix if desired
Place adjust_auto_operating_cost in an unsliced multiprocessing phase:
- Run vehicle type choice in the sliced household phase.
- Coalesce worker vehicle tables.
- Run
adjust_auto_operating_cost once against the complete vehicle table.
- Repartition households and persons for the remaining household models.
For example:
- name: mp_households
begin: av_ownership
slice:
tables:
- households
- persons
- name: mp_adjust_auto_operating_cost
begin: adjust_auto_operating_cost
- name: mp_households_post_auto_cost
begin: transponder_ownership
slice:
tables:
- households
- persons
Fixing this may be undesirable
- Adding a coalesce and split incurs performance costs
- Results are reproducible if process count is held constant
- At scale, the variation in average auto operating cost across MP processes is typically negligible, leading to changes that are nearly undetectable.
Description
The SANDAG
adjust_auto_operating_costmodel produces process-count-dependent results when run as part of a sliced multiprocessing phase.The model calculates an adjustment factor using:
When this step runs inside a household multiprocess worker,
vehiclescontains only that worker’s slice. Each worker therefore calculates a different factor instead of using the mean across all simulated vehicles.Observed behavior
Using the same model inputs:
1.4262046773.1.42679026151.4256206636Each worker’s subset has the requested mean afterward, which can mask the problem in aggregate summaries. However, individual vehicle operating costs differ depending on the number and composition of multiprocessing slices.
Impact
This makes results dependent on the configured process count:
This is independent of Sharrow caching or random-number generation; it results from computing a regional statistic on partitioned data.
Expected behavior
The adjustment factor should be calculated once using the complete regional vehicle table. The resulting adjusted vehicle costs should be invariant to the number of multiprocessing workers, apart from negligible floating-point reduction differences.
Proposed fix if desired
Place
adjust_auto_operating_costin an unsliced multiprocessing phase:adjust_auto_operating_costonce against the complete vehicle table.For example:
Fixing this may be undesirable