Hello, I am optimizing a function utilizing Lagrange constraints, and I would like NLopt to optimize an expression with Lagrange constraints, but return the value of that expression without constraints. I added a flag to the code which calls different versions of the expression, however I want to make sure that NLopt is still optimizing the expression when it includes constraints. My flag if loop is placed at the bottom of my function being optimized and looks like this:
if flag == 0
return f
elseif flag == 1
return H
elseif flag == 2
return f_with_constraints
else
return f_with_constraints # This is the output that I hope will be used in the optimization
end
end # This is the end for the overall function
I am having a lot of bugs with this code and I just want to make sure this is not one of them.
Thank you!