Skip to content

Commit

Permalink
Fix write_status with UCommit=1 and ShadowPrices
Browse files Browse the repository at this point in the history
  • Loading branch information
lbonaldo committed Mar 11, 2024
1 parent 4c5e6d2 commit 5382120
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
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

0 comments on commit 5382120

Please sign in to comment.