How to optimize a custom multi parameter function

6 次查看(过去 30 天)
For an image processing project I am trying to optimize input parameters to minimize the Root Mean Squared Error (RMSE) of a custom particle localization function. Where the function has multiple input parameters, a few constant inputs and the RMSE as the only output
I am trying to use the Optimization Toolbox with fcn2optimexpr to solve for this:
prob = optimproblem("Description","Particle localization RMSE", "ObjectiveSense","minimize")
x = optimvar('x','Type','integer','LowerBound',5,'UpperBound',25);
y= optimvar('y','Type','integer','LowerBound',-2,'UpperBound',2);
RMSE = fcn2optimexpr(@ImageProcessor,x, y, a, b, c);
prob.Objective = sum_RMSE
show(prob)
initialGuess.x = 11;
initialGuess.y = 0;
min_RMSE = solve(sum_RMSE, initialGuess)
% Check for incorrect argument data type or missing argument in call to function 'solve'.
I have followed this guide for the function to objective expression but the solve function returns the error commented out. Do I have to set initial guesses for the variables a,b and c as well?

回答(1 个)

Umang Pandey
Umang Pandey 2023-10-6
Hi Luciano,
I understand that you are facing issue using the "solve" function.
You need to define the variables used as parameters within the "solve" function as symbolic variables (syms).
Refer the documentation for "solve" for more information:
Best,
Umang

类别

Help CenterFile Exchange 中查找有关 Problem-Based Optimization Setup 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by