Does the square of the sum of variables decrease the performance? #4314
Replies: 5 comments 3 replies
-
you should simplify your equations. division + square is expensive and has poor propagation,relaxation. instead of -(1 - n/k)^2, start by changing to -(k - n)^2, then you can scale the term of the objective. |
Beta Was this translation helpful? Give feedback.
-
how many workers are you using ?
Should be visible in the log.
Laurent Perron | Operations Research | ***@***.*** | (33) 1 42 68 53
00
Le lun. 15 juil. 2024 à 16:25, Pavel Lymar ***@***.***> a
écrit :
… As you can see I've done scaling in the code, and there is no division
here, only multiplication. However, the square operation still seems to be
quite expensive.
Do you happen to know any other options to implement what I want?
—
Reply to this email directly, view it on GitHub
<#4314 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ACUPL3MMUE7VRB6VQTQ645LZMPLUNAVCNFSM6AAAAABK4QNMPGVHI2DSMVQWIX3LMV43URDJONRXK43TNFXW4Q3PNVWWK3TUHMYTAMBVGE4DINY>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
OK, reasonable.
Can you send me the model ?
Laurent Perron | Operations Research | ***@***.*** | (33) 1 42 68 53
00
Le lun. 15 juil. 2024 à 16:45, Pavel Lymar ***@***.***> a
écrit :
… Log says Starting search at 0.03s with 16 workers.
—
Reply to this email directly, view it on GitHub
<#4314 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ACUPL3L4QW4BX43YRA4CFMTZMPOCNAVCNFSM6AAAAABK4QNMPGVHI2DSMVQWIX3LMV43URDJONRXK43TNFXW4Q3PNVWWK3TUHMYTAMBVGIYTGNA>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
For the record, Google provides a workforce scheduling API. |
Beta Was this translation helpful? Give feedback.
-
yes, no. This is the code, not the model. model.exportToFile("issue4314.pb.txt"); I will generate it. |
Beta Was this translation helpful? Give feedback.
-
Hi,
I've created a model based on this example for scheduling nurses according to shift needs. However, the number of scheduled nurses varies dynamically based on the demand and scheduling costs.
To implement this, I use an objective function in which I have added the following term:
$-(1 - \frac{{\text{nurses in shift}}}{{\text{nurses needed}}})^2$
The parabolic shape helps avoid potential issues with an infinite number of nurses in a shift.
OR-Tools quickly finds a good solution and then attempts to prove its optimality.
Is the slowdown related to the square term in the objective function? Or is it due to an incorrect implementation?
Additionally, are there any other options for dynamically determining the number of scheduled nurses?
Here is my code:
Beta Was this translation helpful? Give feedback.
All reactions