Hi @tmigot , I might be doing something wrong but I don’t see it. The following code:
println("x0 = ", x0)
nlp = MathOptNLPModel(model)
nlp.meta.x0 .= x0
println("nlp.meta.x0 = ", nlp.meta.x0)
println("nlp.meta.nvar, nlp.meta.ncon = ", nlp.meta.nvar, " ", nlp.meta.ncon)
max_radius = 0.001
subsolver_kwargs = Dict(:max_radius => max_radius)
function cb(nlp, solver, stats)
@assert solver.sub_solver.tr.radius ≤ max_radius
println("(cb) x0 = ", nlp.meta.x0)
println("(cb) x = ", solver.x)
end
output = percival(nlp, subsolver_kwargs = subsolver_kwargs, verbose = 1, callback = cb)
outputs for the first iteration:
x0 = [0.25, 0.25, 0.25, 0.25, 0.8535533905936621, 0.6038554030714633]
nlp.meta.x0 = [0.25, 0.25, 0.25, 0.25, 0.8535533905936621, 0.6038554030714633]
nlp.meta.nvar, nlp.meta.ncon = 6 7
[ Info: iter fx normgp normcx μ normy sumc inner_status iter_type
[ Info: 0 1.2e+34 1.7e+40 5.1e+00 1.0e+01 2.7e+51 3
(cb) x0 = [0.25, 0.25, 0.25, 0.25, 0.8535533905936621, 0.0, 0.0, 0.0]
(cb) x = [0.25, 0.25, 0.25, 0.25, 0.8535533905936621, 0.0, 0.0, 0.0]
What are those three zero components at the end of x? Why is the last component of the initial condition not present in the vector?
Moreover, when I try to specifically set the initial guess with the x=x0
keyword argument, the following errors occurs:
ERROR: DimensionMismatch: array could not be broadcast to match destination
Stacktrace:
[1] check_broadcast_shape
@ ./broadcast.jl:540 [inlined]
[2] check_broadcast_axes
@ ./broadcast.jl:543 [inlined]
[3] instantiate
@ ./broadcast.jl:284 [inlined]
[4] materialize!
@ ./broadcast.jl:871 [inlined]
[5] materialize!
@ ./broadcast.jl:868 [inlined]
[6] solve!(solver::Percival.PercivalSolver{Vector{Float64}}, nlp::NLPModelsModifiers.SlackModel{Float64, Vector{Float64}, NLPModelsJuMP.MathOptNLPModel}, stats::SolverCore.GenericExecutionStats{Float64, Vector{Float64}, Vector{Float64}, Any}; callback::IntegrationOptimizationBarycentricSymmetry.var"#cb#306", x::Vector{Float64}, μ::Float64, max_iter::Int64, max_time::Float64, max_eval::Int64, atol::Float64, rtol::Float64, ctol::Float64, subsolver_logger::Base.CoreLogging.NullLogger, inity::Nothing, subproblem_modifier::typeof(identity), subsolver_max_eval::Int64, subsolver_kwargs::Dict{Symbol, Int64}, verbose::Int64)
@ Percival ~/.julia/packages/Percival/u9dGX/src/method.jl:251
Am I doing anything wrong?
Edit: The same model with JuMP and Ipopt is solved successfully.
Thank you
shce