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

Add JuMP error message when non-optimal (typ infeasible) #417

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
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
12 changes: 9 additions & 3 deletions src/core/reopt.jl
Original file line number Diff line number Diff line change
Expand Up @@ -145,15 +145,21 @@ function run_reopt(ms::AbstractArray{T, 1}, p::REoptInputs) where T <: JuMP.Abst
rs[i] = run_reopt(inputs[i])
end
if typeof(rs[1]) <: Dict && typeof(rs[2]) <: Dict && rs[1]["status"] != "error" && rs[2]["status"] != "error"
# TODO when a model is infeasible the JuMP.Model is returned from run_reopt (and not the results Dict)
results_dict = combine_results(p, rs[1], rs[2], bau_inputs.s)
# TODO when a model is infeasible the JuMP.Model is returned from run_reopt (and not the results Dict)
results_dict = combine_results(p, rs[1], rs[2], bau_inputs.s)
results_dict["Financial"] = merge(results_dict["Financial"], proforma_results(p, results_dict))
if !isempty(p.techs.pv)
organize_multiple_pv_results(p, results_dict)
end
return results_dict
else
throw(@error("REopt scenarios solved either with errors or non-optimal solutions."))
extra_details = []
if rs[1]["status"] == "error" # First check if BAU has error
extra_details = rs[1]["Messages"]["errors"][1][1]
elseif rs[2]["status"] == "error" # If no BAU error, check Optimal error
extra_details = rs[2]["Messages"]["errors"][1][1]
end
throw(@error("REopt scenarios solved either with errors or non-optimal solutions. Additional details: "*extra_details*"."))
end
catch e
if isnothing(e) # Error thrown by REopt
Expand Down
Loading