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

Ensure sub-model is independent

parent 32454dde
No related branches found
No related tags found
No related merge requests found
......@@ -71,16 +71,16 @@ function build_sequence(f::Function, scanner::Union{Nothing, Scanner}, model::Mo
end
end
function build_sequence(f::Function, ::Nothing; optimise=false)
build_sequence(f, nothing, global_model(), optimise)
end
function build_sequence(f::Function, scanner::Scanner, optimiser_constructor; optimise=true, kwargs...)
model = Model(optimizer_with_attributes(optimiser_constructor, [string(k) => v for (k, v) in kwargs]...))
function build_sequence(f::Function, scanner::Union{Nothing, Scanner}, optimiser_constructor; optimise=true, kwargs...)
if optimise || GLOBAL_MODEL[] == IGNORE_MODEL
model = Model(optimizer_with_attributes(optimiser_constructor, [string(k) => v for (k, v) in kwargs]...))
else
model = global_model()
end
build_sequence(f, scanner, model, optimise)
end
function build_sequence(f::Function, scanner::Scanner; print_level=2, kwargs...)
function build_sequence(f::Function, scanner::Union{Nothing, Scanner}; print_level=2, kwargs...)
build_sequence(f, scanner, Ipopt.Optimizer; print_level=print_level, kwargs...)
end
......
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