Optmization with fmincon using an external software
5 次查看(过去 30 天)
显示 更早的评论
Hello,
I have a problem and I do not know how to solve it. I’ll try my best in explaining.
I am optimizing an objective function to fit my data to experimental values by using fmincon. I have boundaries and equality constraints. My objective function (sum of squares of the differences) calls a function that calculates the data to compare to the experimental points.
At first I wanted to learn how fmincon worked so I coded a function “pts_model” that calculates the data. I used fmincon with this function and it fits the data to the experimental points perfectly. But now I am using an external software that does the same thing that “pts_model” (which I will have to use for more complex problems that “pts_model” cannot solve).
Before trying the optimization using the external software I tested the results given by “pts_model” and the ones given by the external software when matlab calls it and the results are the same (difference less than 1E-01 for each point).
However, when I launch fmincon with the external software it does not give the same results than with “pts_model”. Fmincon + external software does an optimization but it is not near as good as the one from fmincon + “pts_model”. The more variables there are the less similar the results are.
To try to understand what the problem is I checked the gradient and search direction during the optimization of both cases but I do not know how to interpret them.
I have attached a file with the results from an optimization with 24 decision variables. I didn't put the results from all iterations but just the first and last.
I am lost at to what to do, I do not understand why I have different results. Both start at the same point and give the same results at that point but somehow the search direction is not the same for both cases on some variables.
I do not know if the information I've given here is enough to understand my problem or get an idea of where the problem might come from but I can provide further information.
If anyone would be kind enough to help I would really appreciate it.
Thank you
5 个评论
dpb
2018-11-30
Yes, that's an expected (albeit unfortunate) side effect.
You could try other permutations; the obvious one is to leave 'Honorbounds','false' but revert to default for the differences and see if it was, indeed, just the bounding limits causing the difficulties.
Alternatively, it's likely you would have to find another way to estimate the derivatives besides the numerical calculation and for many models that is very difficult to do in general, granted.
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Problem-Based Optimization Setup 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!