Hi, I am using Nlopt for optimization. my objective function depends on three variables like x1,x2,x3 also I have a constraint which depends on all three variable. I want to do the optimization just for x3 variable. should i include the gradients of the constraint wrt x1 and x2 in my constraint function or just wrt x3?
function wf_p(p0::Vector, gradw::Vector; r, β, η, fem_params)
if length(gradw) > 0
gradw[:] = #grad wrt x3
end
return wf
end
Both. Don’t think in terms of “can I optimize with a subset of variables.” Define a new objective and constraint functions that contain only x3 as a decision variable and hard-code your choices for x1 and x2.