Modelling piecewise function constraints
AnsweredI have defined the piecewise function and was wondering how to define such constraints where a variable is an element of the piecewise function
Any help would be much appreciated! Thank you
-
Could you share the details of the piecewise-linear function \(PF(\cdot)\)? It is hard to say anything without knowing much about it.
0 -
Hi Jaromil, thank you for the response. The piecewise-linear function is defined as shown, hope this helps to clarify my question, thank you!
0 -
Hi Jia,
You can try implementing function \(PF\) as part of your model. This means, that you shouldn't try to see \(PF\) as a separate function but see it as constraints defining \(\delta_j\). This would mean to model
\[\begin{align}
\max_{x,\delta,FI} &\,\, - \sum_{j=1}^N w_jx_j - \sum_{j=1}^N \delta_j + \delta_0\\
\text{s.t.} &\,\, \delta_j = \sum_{t=1}^T \lambda_{t^j} f_{t^j} &\quad \forall \, j=1,\dots,N\\
&\,\, \lambda_{1^j} \leq z_{1^j} &\quad \forall \, j=1,\dots,N \\
&\,\, \lambda_{t^j} \leq z_{t^j-1}+ z_{t^j} &\quad \forall \, t^j=2,\dots,T^j-1 \,, \forall\, j=1,\dots,N\\
&\,\, \lambda_{M^j} \leq z_{T^j-1}+ z_{t^j} &\quad \forall \, j=1,\dots,N\\
&\,\, \sum_{t=1}^{T^j} \lambda_{t^j} = 1&\quad \forall \, j=1,\dots,N\\
&\,\, \sum_{t=1}^{T^j-1} z_{t^j} = 1&\quad \forall \, j=1,\dots,N\\
&\,\, \sum_{t=1}^{T^j} \lambda_{t^j} s_{t^j} = x_j&\quad \forall \, j=1,\dots,N\\
&z_{t^j} \in \{0,1\}, \lambda_{t^j}\geq 0 &\quad \forall \, t^j=2,\dots,T^j-1 \,, \forall\, j=1,\dots,N
\end{align}\]In the above you would have to adjust \(f_{t^j},s_{t^j}\) to the inputs \(\hat{x},\hat{y}\).
I don't think that all indices and constraints are 100% correct in the above but I think it is enough to get the idea of what is meant.Best regards,
Jaromił0
Please sign in to leave a comment.
Comments
3 comments