Implement the Route Choice Model with Biogeme

34 views
Skip to first unread message

Zheren Liu

unread,
Sep 14, 2021, 12:26:06 PMSep 14
to Biogeme
Dear Professor Bierlaire, 

I'm using Biogeme to solve a Route Choice Model, but I cannot get the significant result. So I made a manual dataset to test my program: I defined a utility function: U = -2.78*prop1 + 0.69*prop2 + 6.55*prop3 + epsilon, and generated random numbers as values of properties. 

I generated 3000 choices (as all alternatives in the choice set), and regarded every 3 alternatives in the same OD pair ([choice 0,1,2], [choice 3,4,5], as such). For each OD pair, the choice with the highest utility was picked as an observed record. Thus I got 1000 records of 'observation data'. 

My purpose was to ensure that my code is right and Biogeme could estimate the True values of the parameters of the model (that is, [-2.78, 0.69, 6.55], or close values). Unluckily the result is still not significant. And the cause of termination is "Maximum number of iterations reached: 1000". (However, resetting the max number of iterations will not solve the problem, while making the estimation time-consuming. )
屏幕截图 2021-09-13 201605.png

I noticed that many papers use Biogeme to implement the Route Choice Model, which means Biogeme CAN implement RCM and get the right result if everything goes well. So I think there could be something wrong with my code but I don't know where. 

I am wondering whether there are any demos that use Biogeme for route choice model estimation? I didn't find relevant code on the internet. Thus I present the codes here and ask for help. Could you please point out the mistakes in my program? And it'd be appreciated if you can offer an example; so that I can refer to it and check where I am wrong. Thanks in advance. 

BTW, the Biogeme version is 3.2.6.  

DATA: 
The data mentioned in the following codes would be like:

df (observed data ): 
columns <choice, col0, col1, col2, ..., col2999> are usable
df.png

prop_ref (properties of all choices ): 
columns <choice, prop1, prop2, prop3> are usable
prop_ref.png

CODE: 
1.png
2.png


Best Wishes,
Zheren Liu
Sept. 14th, 2021

Bierlaire Michel

unread,
Sep 14, 2021, 12:52:50 PMSep 14
to zrli...@gmail.com, Bierlaire Michel, Biogeme
I don’t have an example ready. But there is not much difference between a route choice model and another choice model, except that the alternatives are unlabeled. 

Your example looks quite complicated. I’d start with an example with one OD first. 

Note that it is not straightforward to generate good synthetic data. It happens often that synthetic choice contexts contain highly dominant alternatives, that give little information about the trade-offs. I’d suggest to calculate the true choice probability for your synthetic data. If they are close to 1 or to 0, it means that your synthetic data is not appropriate.



On 14 Sep 2021, at 14:31, Zheren Liu <zrli...@gmail.com> wrote:

Dear Professor Bierlaire, 

I'm using Biogeme to solve a Route Choice Model, but I cannot get the significant result. So I made a manual dataset to test my program: I defined a utility function: U = -2.78*prop1 + 0.69*prop2 + 6.55*prop3 + epsilon, and generated random numbers as values of properties. 

I generated 3000 choices (as all alternatives in the choice set), and regarded every 3 alternatives in the same OD pair ([choice 0,1,2], [choice 3,4,5], as such). For each OD pair, the choice with the highest utility was picked as an observed record. Thus I got 1000 records of 'observation data'. 

My purpose was to ensure that my code is right and Biogeme could estimate the True values of the parameters of the model (that is, [-2.78, 0.69, 6.55], or close values). Unluckily the result is still not significant. And the cause of termination is "Maximum number of iterations reached: 1000". (However, resetting the max number of iterations will not solve the problem, while making the estimation time-consuming. )
<屏幕截图 2021-09-13 201605.png>

I noticed that many papers use Biogeme to implement the Route Choice Model, which means Biogeme CAN implement RCM and get the right result if everything goes well. So I think there could be something wrong with my code but I don't know where. 

I am wondering whether there are any demos that use Biogeme for route choice model estimation? I didn't find relevant code on the internet. Thus I present the codes here and ask for help. Could you please point out the mistakes in my program? And it'd be appreciated if you can offer an example; so that I can refer to it and check where I am wrong. Thanks in advance. 

BTW, the Biogeme version is 3.2.6.  

DATA: 
The data mentioned in the following codes would be like:

df (observed data ): 
columns <choice, col0, col1, col2, ..., col2999> are usable
<df.png>

prop_ref (properties of all choices ): 
columns <choice, prop1, prop2, prop3> are usable
<prop_ref.png>

CODE: 
<1.png>
<2.png>


Best Wishes,
Zheren Liu
Sept. 14th, 2021

--
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 on the web visit https://groups.google.com/d/msgid/biogeme/e2319809-bdbc-4f19-9b55-4b7e1fc3071dn%40googlegroups.com.
<屏幕截图 2021-09-13 201605.png><2.png><prop_ref.png><1.png><df.png>

Zheren Liu

unread,
Sep 16, 2021, 4:24:02 AMSep 16
to Biogeme
Thanks for your reply, Professer! 

I think I finally understand what 'unlabeled alternative' means, I'll try it again. 

Sincerely, 
Zheren Liu
Sept. 15th, 2021
Reply all
Reply to author
Forward
0 new messages