Hi @Dhormir,
A couple of points:
- I don’t think your
set_initial_guess!function is correct.xis a matrix as input, but you are indexing onlyx[i]. Andu_docpis a vector, but you are indexingu_docp[i, :]. - Your objective is
@objective(docp_II, Max, x[end, 6]), but you haven’t set a start value forx[end, 6]. Ipopt uses the lower bound, which is0.0, perturbed slightly into the interior of the domain, to give1.0000000e-02as the first iteration.
If I write your function as
function set_initial_guess!(model::GenericModel, u::Vector, x::Matrix)
for i in 1:size(x, 1), j in 1:size(x, 2)
set_start_value(model[:x][i, j], x[i, j])
end
for i in 1:length(u)
set_start_value(model[:u][i], u[i])
end
return
end
Then Ipopt takes 201 iterations to solve the first problem, and 117 to solve the second.