1
$\begingroup$

I am solving a job scheduling problem with three shifts,
the duration of all shifts are assumed to be known (and might be equal):

enter image description here

  • The tasks can start from any shift
  • We know the duration of each task in minutes

Some examples: enter image description here

  • if it starts from minute $1\leq start \leq 480$ then it is in shift1
  • if it starts from minute $481\leq start \leq 960$ then it is in shift2
  • if it starts from minute $961\leq start \leq 1440$ then it is in shift3

Now the question is how to calculate the duration that falls into each shift depending on the starting minute (variable) and duration (parameter) ?

Input:

  • Duration of each shift
  • Duration of task

Output:

I am looking for the values of $h_1,h_2,h_3$ in each case

$\endgroup$

1 Answer 1

2
$\begingroup$

$h_1, h_2, h_3$ mean the duration time in each period, respectively? Output also including the start time variables?

Ans:

$h_1 = (480 - start) * b_1$

$h_2 = duration - h_1 - h_3$

$h_3 = (finish - 960) * b_3$

,where $b_1 = 1$ if $start < 480$, otherwise $0$. $b_3 = 1$ if $finish > 960$, otherwise $0$.

PS in your case $b_1$ and $b_3$ can be parameter if start time is given, otherwise should be variables. Furthermore, if you would like to apply to more general setting such as: more than 3 periods that would be very complicated to define.

$\endgroup$
9
  • $\begingroup$ Since I don't have reputation enough yet, I put the questions in the answer block. Hop you don't mind it. $\endgroup$
    – ytsao
    Sep 14 at 13:52
  • $\begingroup$ Thank you . I corrected the h2 in blue clock. The start time is determined by other constraints so let's assume for a given start time how to calculate the h1,h2,h3 but we have to treat it as a variable $\endgroup$ Sep 14 at 13:54
  • 1
    $\begingroup$ Another question is the red block, h1 is equal to 400 or 380? if h1 = 380 then h2 would be 120, right? $\endgroup$
    – ytsao
    Sep 14 at 14:04
  • $\begingroup$ Difficult to make too many mistakes but I did it :) $\endgroup$ Sep 14 at 14:08
  • $\begingroup$ I put the answer in above. You can check the logic is valid or not. Thanks! $\endgroup$
    – ytsao
    Sep 14 at 14:16

Your Answer

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