Skip to main content

mnl_select

Function mnl_select 

Source
pub fn mnl_select<R: Rng>(costs: &[f64], theta: f64, rng: &mut R) -> usize
Expand description

Select one alternative from a set of costs using the multinomial logit model.

§Arguments

  • costs - generalized cost of each alternative (lower = better)
  • theta - scale parameter controlling dispersion. Larger θ means more deterministic (strongly favors lowest cost). Smaller θ means more random.
  • rng - random number generator

§Returns

Index of the selected alternative in the costs slice.

§Edge cases

  • If costs is empty, returns 0.
  • If costs has one element, returns 0.
  • If all utilities are degenerate (overflow/underflow), returns 0.