Skip to content

Commit 4bfada0

Browse files
committed
output profile constraint changed to equality
1 parent 947918d commit 4bfada0

File tree

2 files changed

+4
-10
lines changed

2 files changed

+4
-10
lines changed

docs/src/reference/model.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -546,11 +546,9 @@ In all constraints, if a parameter is not defined, the default value is used. If
546546

547547
- The output profile is used to model demands
548548

549-
In theory, these constraints must be equalities, but in practice, when combined with the total\_energy\_out constraint, one of these constraints becomes redundant, which causes numerical issues for the solver.
550-
One solution is to remove one of these constraints; another is to keep them all and change them to '≥' or '≤' (this works the same).
551549
```math
552550
\text{var\_energy\_out\_time}[p,y,t] \geq \text{var\_total\_energy\_out}[p,y]
553-
* \text{output\_profile}[p,t] \quad \forall p \in P, \forall y \in Y, \forall t \in T
551+
* \text{output\_profile}[p,t] = \forall p \in P, \forall y \in Y, \forall t \in T
554552
```
555553

556554
### Storage

src/core/model.jl

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,11 @@ function build_model(input::Input, model::Union{JuMP.Model,Nothing}=nothing)
2121
if model === nothing
2222
# Gurobi
2323
model = JuMP.Model(Gurobi.Optimizer)
24-
# set_attribute(model, "Crossover", 0)
25-
# set_attribute(model, "Method", 2)
24+
set_attribute(model, "Crossover", 0)
25+
set_attribute(model, "Method", 2)
2626

2727
# HiGHS
2828
# model = JuMP.Model(HiGHS.Optimizer)
29-
model = JuMP.Model(Gurobi.Optimizer)
3029
end
3130
vars = add_vars!(model, input)
3231
constraints = add_constraints!(model, vars, input)
@@ -515,24 +514,21 @@ function add_constraints!(model, vars, input::Input)::Dict
515514
end
516515
end
517516

518-
# In theory, these constraints should be equalities, but in practice, when combined with the energy_out constraints, one of these constraints becomes redundant, which causes numerical issues for the solver.
519-
# One solution is to remove one of these constraints; another is to keep them all and change them to '≥' or '≤' (this works the same).
520517
constrs["load_shape"] = Dict()
521518
for p in processes
522519
!has_param("output_profile",p) && continue
523520
for y in years
524521
for t in timesteps
525522
constrs["load_shape"][p,y,t] = @constraint(
526523
model,
527-
vars["energy_out_time"][p,y,t] >= get_param("output_profile",(p,t)) * vars["total_energy_out"][p,y],
524+
vars["energy_out_time"][p,y,t] == get_param("output_profile",(p,t)) * vars["total_energy_out"][p,y],
528525
base_name = "load_shape_$(p)_$(y)_$(t)"
529526
)
530527
end
531528
end
532529
end
533530

534531
# Storage
535-
536532
constrs["c_rate_relation"] = Dict()
537533
for p in processes
538534
!(get_param("is_storage", p)) && continue

0 commit comments

Comments
 (0)