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

Fix previous cost function before optimising again

parent 81d3e54e
No related branches found
No related tags found
1 merge request!4Resolve "Add secondary objective function"
...@@ -71,7 +71,11 @@ function build_sequence(f::Function, scanner::Union{Nothing, Scanner}, model::Tu ...@@ -71,7 +71,11 @@ function build_sequence(f::Function, scanner::Union{Nothing, Scanner}, model::Tu
if optimise if optimise
jump_model = GLOBAL_MODEL[][1] jump_model = GLOBAL_MODEL[][1]
if !iszero(num_variables(jump_model)) if !iszero(num_variables(jump_model))
prev_cost_func = nothing
for cost_func in iterate_cost() for cost_func in iterate_cost()
if !isnothing(prev_cost_func)
@constraint jump_model prev_cost_func == objective_value(jump_model)
end
@objective jump_model Min cost_func @objective jump_model Min cost_func
min_objective = Inf min_objective = Inf
for attempt in 1:n_attempts for attempt in 1:n_attempts
...@@ -100,7 +104,7 @@ function build_sequence(f::Function, scanner::Union{Nothing, Scanner}, model::Tu ...@@ -100,7 +104,7 @@ function build_sequence(f::Function, scanner::Union{Nothing, Scanner}, model::Tu
println(solution_summary(jump_model)) println(solution_summary(jump_model))
error("Optimisation failed to converge.") error("Optimisation failed to converge.")
end end
#@constraint jump_model cost_func == objective_value(jump_model) prev_cost_func = cost_func
end end
end end
return fixed(sequence) return fixed(sequence)
......
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