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

Allow scanner to be unset

parent 8a9bd7ff
No related branches found
No related tags found
No related merge requests found
Pipeline #23462 passed
...@@ -2,7 +2,7 @@ module BuildSequences ...@@ -2,7 +2,7 @@ module BuildSequences
import JuMP: Model, optimizer_with_attributes, optimize!, AbstractJuMPScalar, value, solution_summary, termination_status, LOCALLY_SOLVED, OPTIMAL, num_variables, all_variables, set_start_value, ALMOST_LOCALLY_SOLVED import JuMP: Model, optimizer_with_attributes, optimize!, AbstractJuMPScalar, value, solution_summary, termination_status, LOCALLY_SOLVED, OPTIMAL, num_variables, all_variables, set_start_value, ALMOST_LOCALLY_SOLVED
import Ipopt import Ipopt
import Juniper import Juniper
import ..Scanners: Scanner, gradient_strength import ..Scanners: Scanner, gradient_strength, Default_Scanner
const GLOBAL_MODEL = Ref(Model()) const GLOBAL_MODEL = Ref(Model())
const IGNORE_MODEL = GLOBAL_MODEL[] const IGNORE_MODEL = GLOBAL_MODEL[]
...@@ -93,10 +93,12 @@ function build_sequence(f::Function, scanner::Union{Nothing, Scanner}, optimiser ...@@ -93,10 +93,12 @@ function build_sequence(f::Function, scanner::Union{Nothing, Scanner}, optimiser
build_sequence(f, scanner, model, optimise, n_attempts) build_sequence(f, scanner, model, optimise, n_attempts)
end end
function build_sequence(f::Function, scanner::Union{Nothing, Scanner}; print_level=2, kwargs...) function build_sequence(f::Function, scanner::Union{Nothing, Scanner}=Default_Scanner; print_level=2, kwargs...)
build_sequence(f, scanner, Ipopt.Optimizer; print_level=print_level, kwargs...) build_sequence(f, scanner, Ipopt.Optimizer; print_level=print_level, kwargs...)
end end
build_sequence(f::Function, optimiser_constructor; kwargs...) = build_sequence(f, Default_Scanner, optimiser_constructor; kwargs...)
function global_model() function global_model()
if GLOBAL_MODEL[] == IGNORE_MODEL if GLOBAL_MODEL[] == IGNORE_MODEL
......
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