Modified Utilities Function

14 views
Skip to first unread message

Natchaphon Leungbootnak

unread,
Feb 19, 2025, 4:07:13 AMFeb 19
to Biogeme
Dear all,

I want to run logit model by using random regret minimization (RRM) instead of random utility maximization (RUM). I followed the python example of binary logit model (https://biogeme.epfl.ch/sphinx/auto_examples/tutorials/plot_b01_first_model.html). I modified RUM equations from:

car: asc_car + b_time * auto_time
transit: b_time * transit_time

to be RRM equations instead:

car: - math.log(1 + math.exp(0 - asc_car)) - math.log(1 + math.exp(b_time * (transit_time - auto_time)))
transit: - math.log(1 + math.exp(asc_car - 0)) - math.log(1 + math.exp(b_time * (auto_time - transit_time)))

However, it showed "TypeError: must be real number, not Minus". I tried to use sympy and numpy instead of math library to fix it, but it did not work.

Best regards,
Natchaphon



Michel Bierlaire

unread,
Feb 20, 2025, 4:11:24 AMFeb 20
to natcha...@gmail.com, Michel Bierlaire, Biogeme
You should not use the mathematical expressions from the `math` package, but from the biogeme.expressions package.
> --
> You received this message because you are subscribed to the Google Groups "Biogeme" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to biogeme+u...@googlegroups.com.
> To view this discussion visit https://groups.google.com/d/msgid/biogeme/f9bea298-71eb-4a55-937f-fe3299dea2d3n%40googlegroups.com.

Michel Bierlaire
Transport and Mobility Laboratory
School of Architecture, Civil and Environmental Engineering
EPFL - Ecole Polytechnique Fédérale de Lausanne
http://transp-or.epfl.ch
http://people.epfl.ch/michel.bierlaire

Reply all
Reply to author
Forward
0 new messages