I have these two quite nasty constraints I have tried to linearize. I am trying to dynamically control if you are allowed to plan producing product p. You are allowed to do it if the product arrived (if $y_{t,p}\geq 0$ at time t, p has arrived at time t) before your last QC. In the constraints below $QC_t$ is a binary variable, $\text{last}\_{QC}_t$ would be an integer variable, $X_{t,p}^{\text{plan}}$ is a non-negative real variable and $y_{t,p}$ is a parameter.
\begin{align} \text{last}\_{QC}_t &= \max(\{k \leq t \mid QC_k = 1\}) \\ \sum_{k \leq \text{last}\_{QC}_t} y_{k,p} &\geq X_{t,p}^{\text{plan}} \end{align}
Linearization:
These should be the linearization of the conditional max constraint:
\begin{align} \sum_{k \leq t} \delta_{k,t} &= 1 &&\forall t \in T \\ \delta_{k,t} &\leq QC_k &&\forall t, k\leq t \in T \\ \delta_{k,t} &\leq \sum_{i=k}^t QC_i &&\forall t, k\leq t \in T \end{align}
This should be the linearization of the sum with a variable as index:
$$\sum_{k \leq t} \sum_{j \leq k} \delta_{k,t} \cdot y_{j,p} \geq X_{t,p}^{\text{plan}}$$
I hope my problem is clear and someone can answer if the linearization is okay.