How do I make a counter variable for a linear program?

94 Views Asked by At

Context: I am using excel. The general idea is that I want to have variables J[i,t] be the age of product i in time t. I have discretized time.

My problem: I cannot figure out how to define $J[i,t]$. Note: I have binary variables $$x[i,t] = \mathbb{I} (\text{product i is changed at time t}),$$ so if $x[i,t]=1$ then $J[i,t+1]=0$.

Please let me know if something is unclear and I can provide more context.

Thanks!

1

There are 1 best solutions below

1
On

It sounds like you want to define $$ J_{i,t+1} = \left. \begin{cases} 0, & \text{if } x_{i,t} = 1\\ J_{i,t} + 1, & \text{otherwise} \end{cases} \right\| $$ This is a straight-forward Excel formula to program using the IF() function.