model: Capacity cannot decrease over time

This commit is contained in:
2025-11-14 10:23:26 -06:00
parent b7d16fee3e
commit 7dbc3cf90b
3 changed files with 22 additions and 0 deletions

View File

@@ -249,6 +249,15 @@ The goal is to minimize a linear objective function with the following terms:
\end{align*}
```
- Plant capacity cannot decrease over time (`eq_capacity_nondecreasing[p.name, t]`):
```math
\begin{align*}
& z^\text{exp}_{pt} \geq z^\text{exp}_{p,t-1}
& \forall p \in P, t \in T
\end{align*}
```
- Plant is initially open if initial capacity is positive:
```math

View File

@@ -370,6 +370,13 @@ function build_model(instance::Instance; optimizer, variable_names::Bool = false
eq_keep_open[p.name, t] = @constraint(model, x[p.name, t] >= x[p.name, t-1])
end
# Plants: Capacity cannot decrease over time
eq_capacity_nondecreasing = _init(model, :eq_capacity_nondecreasing)
for p in plants, t in T
eq_capacity_nondecreasing[p.name, t] =
@constraint(model, z_exp[p.name, t] >= z_exp[p.name, t-1])
end
# Plants: Building period
eq_building_period = _init(model, :eq_building_period)
for p in plants, t in T

View File

@@ -128,6 +128,12 @@ function model_build_test()
"eq_keep_open[L1,4] : -x[L1,3] + x[L1,4] ≥ 0"
@test repr(model[:eq_keep_open]["L1", 1]) == "eq_keep_open[L1,1] : x[L1,1] ≥ 1"
# Plants: Capacity cannot decrease over time
@test repr(model[:eq_capacity_nondecreasing]["L1", 4]) ==
"eq_capacity_nondecreasing[L1,4] : -z_exp[L1,3] + z_exp[L1,4] ≥ 0"
@test repr(model[:eq_capacity_nondecreasing]["L1", 1]) ==
"eq_capacity_nondecreasing[L1,1] : z_exp[L1,1] ≥ 150"
# Plants: Building period
@test ("L1", 1) keys(model[:eq_building_period])
@test repr(model[:eq_building_period]["L1", 2]) ==