Optimization Question... Strange Results

1 ビュー (過去 30 日間)
Cole 2014 年 10 月 8 日
コメント済み: Matt J 2014 年 10 月 8 日
I asked a previous question which I've moved beyond because I figured out the first problem but I'm getting weird results. I'm working towards a complex optimization problem but I'm starting by breaking it down into simpler problems to begin with. To start, I'm just trying an unconstrained optimization problem on 1 single parameter.
I have a complex routine that measures fractures in drill core automatically and compares them to a manual set of measurements that I did myself. I'm optimizing the automatic routine based on 100 manually measured photos. Once I'm happy with the results, I'm going to use these parameters to automatically measure over 5,000 photos.
The output of my function is correlation between the two sets of measurements. In my current, simple example, I'm just changing one parameter and seeing how correlation changes.
I've input the different parameters manually and get the following results:
f = 2, 4, 6, 8, 10
f(x) = 0.4, 0.45, 0.5, 0.45, 0.4
There is clearly a peak at f = 6... that's the optimal result.
However, with the optimizer, no matter what starting point I try, it says that point is the optimal result.
I've formulated it as follows:
opt0 = 4;
options = optimoptions(@fminunc,'Algorithm','quasi-newton');
[opt,fval,exitflag,output] = fminunc(@objfun1,opt0,options);
If I use 4 as my starting location, I get 0.45 as my optimal result. If I try 6 as my starting point, I get 0.5 as my optimal result. It doesn't seem to iterate over any different values correctly.
I'm not sure what's going on.
I'm working towards a complex problem where I'm going to optimize 6 different parameters with a bunch of constraints and bounds but I would like to get this working first.
  1 件のコメント
Matt J
Matt J 2014 年 10 月 8 日
There is clearly a peak at f = 6... that's the optimal result.
You are using "f" to mean 2 different things, which is terribly confusing. Don't you mean that f(x) has a peak at x=6?
In any case, my guess is that objfun1() contains rounding or other quantization operations, which make all your points locally optimal. To say more, we really need to see the contents of objfun1.


回答 (0 件)


Find more on Get Started with Optimization Toolbox in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by