7

I am having trouble formulating the following constraint:

I am looking to formulate a constraint that if a facility was opened at some point in time, then $Y[j,t]$ does always have to be $1$ from that point in time onwards (see values below). How do I do that?

O[j,t] Y[j,t]
0 0
0 0
1 1
0 1
0

Edit from comments:

It is also possible to close initially existing facilities using a closing variable $S[j,t]$. It is generally possible to close a facility, just not one that has been opened by the model using the $O[j,t]$ variable.

EhsanK
  • 5,864
  • 3
  • 17
  • 54
user7258
  • 73
  • 4

1 Answers1

9

You can activate variable $Y[j,t]$ when $O[j,t]$ is active ($O[j,t] \; \Longrightarrow \; Y[j,t]$) with: $$ O[j,t] \le Y[j,t] \tag{1} $$ And then make sure $Y[j,t]$ remains active ($Y[j,t] \; \Longrightarrow \; Y[j,t+1]$): $$ Y[j,t] \le Y[j,t+1] \tag{2a} $$

I suppose there is some cost on variables $Y[j,t]$ ? If so, this cost should preclude the solver from activating $Y[j,t]$ when $O[j,t]=Y[j,t-1]=0$.

Now, if you can close an exising facility, then $Y[j,t]$ should be active until the facility is closed, so you can adjust constraint $(2a)$ as follows: $$ Y[j,t] \le Y[j,t+1] + S[j,t+1] \tag{2b} $$ So if $Y[j,t]$ is active, in the following period you either maintain activity, or close the facility. And if you cannot reopen the facility, you need to impose: $$ S[j,t] \le 1 - O[j,k] \quad \forall k=t,t+1,t+2,... \tag{3} $$

Kuifje
  • 13,324
  • 1
  • 23
  • 56