IBMDecisionOptimization / docplex-examples

These samples demonstrate how to use the DOcplex library to model and solve optimization problems.
https://ibmdecisionoptimization.github.io/
Apache License 2.0
396 stars 228 forks source link

Obvious wrong solution for "nurses_scheduling.ipynb" #84

Closed Hugloss closed 1 year ago

Hugloss commented 1 year ago

You only need to look at the plot and you will see that it is an incorrect solution.

image

The code is also clear that it is incorrect. image For almost all rows you don't have enough nurses for the pass.

I haven't changed anything, just printed the solution.

I hope you can fix the example :)

vberaudi commented 1 year ago

The nurse problem is a demo of the relaxation mechanism of docplex, as such this problem is infeasible (see Bound infeasibility column 'NurseWorkTime_Betsy'. in the notebook) because some requirements are too strict. That's why we use the relaxation mechanism of CPLEX to compute a feasible solution. Among the relaxed requirements, you will find all the requirements you hightlighed, for example:

* number of relaxations: 35
 - relaxed: high_req_min_EMER_Mon_18_3, with relaxation: -3.0
 - relaxed: high_req_min_CONS_Mon_08_10, with relaxation: -7.0
 - ...

So the gantt is displaying a feasible solution, not the optimal solution.

Hugloss commented 1 year ago

I understand that it is an example, but it removes a whole shift!!! Finding a solution to this problem is not particularly difficult if you remove certain work shifts.

The problem is that people don't only get sick during the day, but people always get sick around the clock. This means that you actually have to have staff on site 24/7. Then it is wrong that the solution means that one should not work at night. That's not how it actually works in healthcare in real life.

This line remove the whole shift. ``

Is it possible to change that it is not allowed to draw down to zero staff?

Hugloss commented 1 year ago

notebook have been updated