SDDP.jl
SDDP.jl copied to clipboard
Quit forward pass on ctrl+c
Pressing ctrl+c while training doesn't always terminate the forward pass, and instead gives a warning about numerical difficulties.
I think that the JuMP.termination_status needs to be checked that it's not JuMP.MOI.INTERRUPTED. Either within the function below, or before this function is called.
function attempt_numerical_recovery(node::Node)
@warn("Attempting to recover from serious numerical issues...")
if JuMP.mode(node.subproblem) == JuMP.DIRECT
@warn(
"Unable to recover in direct mode! Remove `direct = true` when " *
"creating the policy graph."
)
else
MOI.Utilities.reset_optimizer(node.subproblem)
optimize!(node.subproblem)
end
if JuMP.primal_status(node.subproblem) != JuMP.MOI.FEASIBLE_POINT
write_subproblem_to_file(
node,
"subproblem_$(node.index).mof.json",
throw_error = true,
)
end
return
end