@@ -37,12 +37,11 @@ As soon as the code block ends the sequence is optimised (if `optimise=true`) an
## Parameters
- `scanner`: Set to a [`Scanner`](@ref) to limit the gradient strength and slew rate. When this call to `build_sequence` is embedded in another, this parameter can be set to `nothing` to indicate that the same scanner should be used.
- `optimiser_constructor`: A `JuMP` solver optimiser as described in the [JuMP documentation](https://jump.dev/JuMP.jl/stable/tutorials/getting_started/getting_started_with_JuMP/#What-is-a-solver?). Defaults to using [Ipopt](https://github.com/jump-dev/Ipopt.jl).
## Variables
- `optimise`: Whether to optimise and fix the sequence as soon as it is returned. This defaults to `true` if a scanner is provided and `false` if no scanner is provided.
- `n_attempts`: How many times to restart the optimser (default: 100).
- `kwargs...`: Other keywords are passed on as attributes to the `optimiser_constructor` (e.g., set `print_level=3` to make the Ipopt optimiser quieter).
"""
function build_sequence(f::Function,scanner::Union{Nothing,Scanner},model::Model,optimise::Bool)
function build_sequence(f::Function,scanner::Union{Nothing,Scanner},model::Model,optimise::Bool,n_attempts::Int)
prev_model=GLOBAL_MODEL[]
GLOBAL_MODEL[]=model
prev_scanner=GLOBAL_SCANNER[]
...
...
@@ -55,12 +54,8 @@ function build_sequence(f::Function, scanner::Union{Nothing, Scanner}, model::Mo