Modeling output changes with upgraded Python

92 views
Skip to first unread message

drewbs...@gmail.com

unread,
Sep 28, 2022, 5:04:10 PM9/28/22
to or-tools-discuss
Hello,

I am seeing differences in the output of a model for different versions of Python. I am seeing these differences when I upgrade from Python 3.9.14 to Python 3.10.6. I have tested this upgrade with both ORTools 9.1.949 and ORTools 9.4.1874 and both versions are showing differences when Python is upgraded.

For reference, I am using pywrapcp to solve a routing problem.

Any ideas if there are expected changes between versions of Python?

Thanks,
Drew

blind.line

unread,
Sep 28, 2022, 8:40:31 PM9/28/22
to or-tools...@googlegroups.com
Wild guess because there isn’t much to go on here, but perhaps your python needs checking versus changes in the language. Are you sure the inputs to the library calls are equivalent?

James

On Sep 28, 2022, at 14:04, drewbs...@gmail.com <drewbs...@gmail.com> wrote:


--
You received this message because you are subscribed to the Google Groups "or-tools-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to or-tools-discu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/or-tools-discuss/54132d48-fb91-442f-b746-e26560c9653en%40googlegroups.com.

drewbs...@gmail.com

unread,
Sep 29, 2022, 1:18:26 PM9/29/22
to or-tools-discuss
Hi James,

It is the same code and same inputs being run, just changing the version of Python the code is running on. 

"perhaps your python needs checking versus changes in the language" : what exactly do you mean by this? Happy to check on anything with the Python setup.

"Wild guess because there isn’t much to go on here" : is there more information I can provide that would help provide clarity?

Thanks!
Drew

blind.line

unread,
Sep 29, 2022, 7:27:02 PM9/29/22
to or-tools...@googlegroups.com
First, read through the python release notes on the new features and deprecations in 3.9 vs 3.10, and check your code to see if any apply to you. 

Ditto for libraries you’re using. 

But what I would do first is to print out the state of the world in python 3.9 and python 3.10 and verify that everything is identical. 

Then dig through the API to see how to dump the solver state in 3.9 and 3.10. 

Most likely there is a bug in your python somewhere that changed behavior in 3.10. 

The “more info” would be to create a minimal reproducible example that others can run to verify. 

It might be the case that this is a bug in the python bindings, so if others can reproduce this then that would be great and would get this fixed. 

James

On Sep 29, 2022, at 10:18, drewbs...@gmail.com <drewbs...@gmail.com> wrote:



drewbs...@gmail.com

unread,
Dec 13, 2022, 6:25:12 PM12/13/22
to or-tools-discuss
Okay I have figured this out. I was sending some floats to the solver and the solver was returning 0 as the optimal solution. Once I forced all inputs to be ints, the problem was fixed and the solver returns a normal solution.
Reply all
Reply to author
Forward
0 new messages