0
$\begingroup$

Hey i have this constraint that i am trying to code in python: "scheduling next shift such its not within X hours of previous shift" Given that i have start, end time of each shift and the user and shift dataframes.

$\endgroup$

2 Answers 2

1
$\begingroup$

Suppose binary decision variable $x_i$ indicates whether shift $i$ is scheduled. If shifts $i$ and $j$ conflict, then impose a constraint $x_i+x_j\le 1$ to prevent scheduling both.

$\endgroup$
0
$\begingroup$

if you know if task 2 should be after the task 1 then it is easy

$Start_2 \geq X + End_1$

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.