Optimization Question... Strange Results
3 views (last 30 days)
Show older comments
Hi,
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 Comment
Matt J
on 8 Oct 2014
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.
Answers (0)
See Also
Categories
Find more on Get Started with Optimization Toolbox in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!