0
$\begingroup$

I have the following question. I have two variables $w_{nds}$ and $m_{nd}$. The first variable indicates whether a nurse $n$ works shift $s$ on day $d$. The second one indicates the motivation of nurse $n$ on day $d$. How can I link both and create a new variable $moti_{nds}$ that combines both information. So the new variable should capture the motivation for each nurse for each shift each day. The value of $moti$ for a given shift should be $\ge 0$ only if the nurse works this shift. For example, if she works all shifts in a day then $moti_{1ds}=1 ~\forall s\in S$ should hold. My suggestion would be:

$\begin{align} &moti_{nds}=w_{nds}\cdot m_{nd}~~~~\forall n\in N, d\in D, s\in S \end{align}$

Would this be a linear formulation? I would be because, yes, you multiply a variable with two indices by one over three. Is this possible?

$\endgroup$
1
  • $\begingroup$ What is really the difference between $w_{nds}$ and $moti_{nds}$? $\endgroup$
    – A.Omidi
    Commented Jun 3, 2023 at 11:45

1 Answer 1

1
$\begingroup$

To linearize product of two variables with $moti_{nds}$ & $ m_{nd}$ are binary
$ w_{nds}+ m_{nd} \le moti_{nds}+1$

$moti_{nds}\le m_{nd}$
$moti_{nds}\le w_{nds} $

You can sum $w$ and moti over shift $s$ for last 2 constraints for nurse $n$ works on a given day $d$.

$\sum_s moti_{nds}\le m_{nd}$
$\sum_s moti_{nds}\le \sum_s w_{nds} \le S\sum_s moti_{nds}$

In case $m_{n,d}$ is continuous variable in domain $[L,U]$ then

$L w_{nds} \le \sum_s moti_{nds} \le Uw_{nds}$

$m_{nd}+L(1-w_{nds}) \le \sum_s moti_{nds} \le m_{nd}+U(1-w_{nds})$

$\endgroup$
2
  • $\begingroup$ Thanks. Would a linearization be necessary if $m_{nd}\in \left[ 0,1\right]$? $\endgroup$ Commented Jun 3, 2023 at 18:41
  • $\begingroup$ @nflgreaternba most modern solvers can handle product of 2 variables (whether binary or continuous). Still updated my answer just in case $ m_{ds}$ is continuous to linearize. Linearization of product of 2 variables may make the model faster. $\endgroup$ Commented Jun 3, 2023 at 19:37

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.