Help with setting up an optimization problem

1 view (last 30 days)
Hi,
I have a question about setting up an optimization problem. I have a function that looks like this:
[ correlation ] = my_function ( input1, input2, input3, optParm )
My_function calls a bunch of different image processing sub routines that I've written and inputs 1, 2 and 3 are arrays of photos that need to be loaded into the function. The function basically processes 100 images and then compares the automatically measured results to the manually measured results. Anyway, I don't know if the details of my program really matter. I'm having trouble setting up the optimization portion of this.
This is what I have so far; most of which is taken from the help files:
options = optimoptions(@fminunc,'Algorithm','quasi-newton');
optParm0 = 10;
[optParm,fval,exitflag,output] = fminunc(@CP_Process_All,optParm0,options);
I want the optimizer to try all different values of optParm, starting with 10 and maximize the correlation. The error that I'm getting is "not enough input parameters". In all the examples, the objective function just has a single input value. I don't know how to set it up this way because my function needs the input arrays to run properly.
Any help would be greatly appreciated!
Thank you!

Accepted Answer

Alan Weiss
Alan Weiss on 13 Oct 2014
If you need to pass the data, see Pass Extra Parameters.
However, I wonder if you have a discrete problem, where your optParm has to be an integer. If so, then you cannot use Optimization Toolbox functions, because they require that the decision variable (unknown parameter) is a continuous one.
Alan Weiss
MATLAB mathematical toolbox documentation

More Answers (0)

Categories

Find more on Problem-Based Optimization Setup 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!