Skip to content
Snippets Groups Projects
Verified Commit cffb6992 authored by Michiel Cottaar's avatar Michiel Cottaar
Browse files

Skip optimisation if there are no free variables

parent 30633a38
No related branches found
No related tags found
No related merge requests found
module BuildSequences
import JuMP: Model, optimizer_with_attributes, optimize!, AbstractJuMPScalar, value, solution_summary, termination_status, LOCALLY_SOLVED, OPTIMAL
import JuMP: Model, optimizer_with_attributes, optimize!, AbstractJuMPScalar, value, solution_summary, termination_status, LOCALLY_SOLVED, OPTIMAL, num_variables
import Ipopt
import Juniper
import ..Scanners: Scanner
......@@ -54,10 +54,12 @@ function build_sequence(f::Function, scanner::Union{Nothing, Scanner}, model::Mo
try
sequence = f()
if optimise
optimize!(model)
if !(termination_status(model) in (LOCALLY_SOLVED, OPTIMAL))
@warn "Optimisation did not report successful convergence. Please check the output sequence."
println(solution_summary(model))
if !iszero(num_variables(model))
optimize!(model)
if !(termination_status(model) in (LOCALLY_SOLVED, OPTIMAL))
@warn "Optimisation did not report successful convergence. Please check the output sequence."
println(solution_summary(model))
end
end
return fixed(sequence)
else
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment