How can I resolve DeprecationWarning.

454 views
Skip to first unread message

Robert

unread,
Dec 21, 2021, 4:31:50 AM12/21/21
to or-tools-discuss
Hello everyone.

Now I'm facing warning like below when I using SolveWithParameters(serch_parameters).
"DepecaionWarning an integer is required (got type float). Implicit conversion to integers using __init__ is deprecated, and may be removed in a future version of Python. "

Even if I use "DefaultRoutingSearchParameters" as serch_parameters, I' also facing the warning.
Am I right in thinking that this is a warning inside ortools?

Thank you in advance.

Kerem Aslan

unread,
Dec 21, 2021, 4:49:24 AM12/21/21
to or-tools-discuss
Sounds like you are passing a float where an integer is expected, so Python is converting it for you. The warning is that it may not convert it for you in future versoins. It is not something that is of much concern, but you can do int(number) if you want to make sure you are passing an integer.


Op dinsdag 21 december 2021 om 17:31:50 UTC+8 schreef Robert:

Robert

unread,
Dec 21, 2021, 4:46:42 PM12/21/21
to or-tools-discuss
Thank you for your reply.
I will try to convert values in serach_parameters from float to int.

2021年12月21日火曜日 18:49:24 UTC+9 Kerem Aslan:

Robert

unread,
Dec 21, 2021, 8:43:38 PM12/21/21
to or-tools-discuss
I have resolved this warning.
It was because I used cost matrix of float type.
So when I converted the cost matrix to int type, the warning disappeared.

Thank you.
2021年12月22日水曜日 6:46:42 UTC+9 Robert:
Reply all
Reply to author
Forward
0 new messages