Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix write_status with UCommit=1 and Shadow Prices #645

Merged
merged 2 commits into from
Mar 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Fix cost assignment to virtual storage charge/discharge - issue #604 (#608)
- Fix modeling of hydro reservoir with long duration storage (#572).
- Fix update of starting transmission capacity in multistage GenX
- Fix write_status with UCommit = WriteShadowPrices = 1 (#645)

### Changed
- Use add_to_expression! instead of the += and -= operators for memory performance improvements (#498).
Expand Down
8 changes: 0 additions & 8 deletions src/model/solve_model.jl
Original file line number Diff line number Diff line change
Expand Up @@ -70,14 +70,6 @@ function solve_model(EP::Model, setup::Dict)
println("MILP solved for primal")
end

if !has_duals(EP) && setup["WriteShadowPrices"] == 1
# function to fix integers and linearize problem
fix_integers(EP)
# re-solve statement for LP solution
println("Solving LP solution for duals")
optimize!(EP)
end

## Record solver time
solver_time = time() - solver_start_time
elseif setup["ComputeConflicts"]==0
Expand Down
10 changes: 10 additions & 0 deletions src/write_outputs/write_outputs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,16 @@ function write_outputs(EP::Model, path::AbstractString, setup::Dict, inputs::Dic

output_settings_d["WriteStatus"] && write_status(path, inputs, setup, EP)

# linearize and re-solve model if duals are not available but ShadowPrices are requested
if !has_duals(EP) && setup["WriteShadowPrices"] == 1
# function to fix integers and linearize problem
fix_integers(EP)
# re-solve statement for LP solution
println("Solving LP solution for duals")
set_silent(EP)
optimize!(EP)
end

if output_settings_d["WriteCosts"]
elapsed_time_costs = @elapsed write_costs(path, inputs, setup, EP)
println("Time elapsed for writing costs is")
Expand Down
Loading