Expand description
Multinomial logit (MNL) route choice model.
Given a set of alternative paths with associated generalized costs, the MNL model selects one path probabilistically:
$$P(k) = \frac{\exp(-\theta \cdot C_k)}{\sum_j \exp(-\theta \cdot C_j)}$$
where:
- $C_k$ is the generalized cost of alternative $k$
- $\theta$ is the scale parameter (larger = more deterministic)
§Example
use rustsim_pathfinding::route_choice::mnl_select;
use rand::rngs::StdRng;
use rand::SeedableRng;
let costs = [10.0, 12.0, 15.0];
let mut rng = StdRng::seed_from_u64(42);
let selected = mnl_select(&costs, 1.0, &mut rng);
assert!(selected < costs.len());§References
Ben-Akiva, M. & Lerman, S. (1985). “Discrete Choice Analysis: Theory and Application to Travel Demand.” MIT Press.
Functions§
- mnl_
logsum - Log-sum (inclusive value) of a set of costs under MNL.
- mnl_
probabilities - Compute MNL choice probabilities for a set of costs.
- mnl_
select - Select one alternative from a set of costs using the multinomial logit model.