How to optimize a custom multi parameter function

19 vues (au cours des 30 derniers jours)
Luciano Deben
Luciano Deben le 25 Avr 2022
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?

Réponses (1)

Umang Pandey
Umang Pandey le 6 Oct 2023
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

Catégories

En savoir plus sur Get Started with Optimization Toolbox dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by