Community Tip - New to the community? Learn how to post a question and get help from PTC and industry experts! X
I've got a worksheet that minimises a function with two variables.
I'd like to get the minimised variables and re-input them into the function to find the final minimised value.
When I try to extract the variables from the Minimize vector it gives me different values to those found initially - see attached worksheet.
Worksheet overview:
The function (Fresmin) adds FLres and FHres absolutely.
Fresmin will be zero wherever a horizontal line crosses both curves in the graph.
I define a value for RLD and use Minimize to find the optimum value of RHD.
I extract the minimised values into a and b.
I've also created a simplified example at the bottom of the worksheet that does work correctly.
Can anybody explain why the former is not working? (It appears to be finding another solution as Fresmin is very small)
Solved! Go to Solution.
Dan Rose wrote:
I've got a worksheet that minimises a function with two variables.
I'd like to get the minimised variables and re-input them into the function to find the final minimised value.
When I try to extract the variables from the Minimize vector it gives me different values to those found initially - see attached worksheet.
Worksheet overview:
The function (Fresmin) adds FLres and FHres absolutely.
Fresmin will be zero wherever a horizontal line crosses both curves in the graph.
I define a value for RLD and use Minimize to find the optimum value of RHD.
I extract the minimised values into a and b.
I've also created a simplified example at the bottom of the worksheet that does work correctly.
Can anybody explain why the former is not working? (It appears to be finding another solution as Fresmin is very small)
Thats because the first time you use a solve block with two constraints which are respected. BTW, its does not seem to make much sense to use R.LD to minimze when you want it to be fixed to 800 mm anyway.
Minimize (contrary to minerr, find, etc.) can be used either with a solve block or standalone. The second time you used it was standalone and neither R.LD=800mm is respected nor is R.HD between 150mm and 1000mm.
In the last example you used it standalone without any constraints in both cases and so you got the same results.
Dan Rose wrote:
I've got a worksheet that minimises a function with two variables.
I'd like to get the minimised variables and re-input them into the function to find the final minimised value.
When I try to extract the variables from the Minimize vector it gives me different values to those found initially - see attached worksheet.
Worksheet overview:
The function (Fresmin) adds FLres and FHres absolutely.
Fresmin will be zero wherever a horizontal line crosses both curves in the graph.
I define a value for RLD and use Minimize to find the optimum value of RHD.
I extract the minimised values into a and b.
I've also created a simplified example at the bottom of the worksheet that does work correctly.
Can anybody explain why the former is not working? (It appears to be finding another solution as Fresmin is very small)
Thats because the first time you use a solve block with two constraints which are respected. BTW, its does not seem to make much sense to use R.LD to minimze when you want it to be fixed to 800 mm anyway.
Minimize (contrary to minerr, find, etc.) can be used either with a solve block or standalone. The second time you used it was standalone and neither R.LD=800mm is respected nor is R.HD between 150mm and 1000mm.
In the last example you used it standalone without any constraints in both cases and so you got the same results.