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

Adjust number of variables outside of for loop

parent 0ef608ec
No related branches found
No related tags found
1 merge request!8Make optimisation more robust
Pipeline #25489 failed
......@@ -106,6 +106,9 @@ function optimise_with_cost_func!(jump_model::Model, cost_func, n_attempts)
nsuccess = 0
sample_error = Dict{TerminationStatusCode, Any}()
errors = TerminationStatusCode[]
for _ in num_variables(jump_model):number_equality_constraints(jump_model)
@variable(jump_model)
end
for attempt in 1:n_attempts
if attempt != 1
new_values = rand(length(all_variables(jump_model)))
......@@ -122,9 +125,6 @@ function optimise_with_cost_func!(jump_model::Model, cost_func, n_attempts)
set_start_value(var, v)
end
end
for _ in num_variables(jump_model):number_equality_constraints(jump_model)
@variable(jump_model)
end
optimize!(jump_model)
#println(solution_summary(jump_model))
if termination_status(jump_model) in (LOCALLY_SOLVED, OPTIMAL)
......
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