I have an optimization model to which I need to add the following piecewise function as a constraint:
C_{i,k} = { PR_{i} * HSE_{k} i∈Ω, k = 1,...,M,
1 i∈Ω, k = 1,...,M
I read PR and HSE from excel cells
¿Is there a nice way to do this in Julia? I have not found any documentation on this in Julia
A piecewise linear function is something like:
f(x) = a⋅x+b for x <= p
c⋅x+d for x > p
There may be more segments.
You describe just an OR (not a piecewise linear function):
C[i,k] = PR[i]⋅HSE[k] OR 1
What you describe can be modeled with an extra binary variable δ[i,k] ∈ {0,1}
as:
C[i,k] = (PR[i]⋅HSE[k])⋅δ[i,k] + (1-δ[i,k])
This is linear, as PR and HSE are constants. I assume that C
is a decision variable.