When we use optimization command such as e.g. FindMinimum, we minimize a function subject to the given constraints and seek to find the optimal solution where these constraints are satisfied. Now I would like to know the exact values of the constraint functions. How do we extract this information from the FindMinimum command? For example,
sol=FindMinimum[{x^2+y^2, 0.00211 <= x+1 <= 0.00274, 0.703 <= x-y <= 0.963},{,x,y}]
I would like to extract the exact values of x+1
and x-y
directly from the sol
but not by again writing another few of lines to find those values from defining sol[[2,1]]
etc.. The above given code is arbitrary and need not have a solution.
Thank you in advance.
x
andy
are returned in the solution, is the issue then how to check that FindMinimum was successful or not before extracting these? If not, what exactly is the problem? As Daniel showed above, you can just read these from the result returned. All what you have to do, is check that it did find a minimum. Right? Is there any other issue? $\endgroup${x + 1, x - y} /. sol[[2]]
$\endgroup$