problem using GA to optimize an image processing index in MATLAB?
7 views (last 30 days)
Hi everyone, I have a problem using GA to optimize an image processing index. the GA optimization works but does not respond to stop criteria and seems to be running forever no matter what i do.
So, I wanted to fit two graphs using SSIM index. The function that i wrote creates the model in another program, used for nonlinear structural engineering (OpenSEES), then plots and saves the model as a .png file. like the one below:
The general idea of the code is to give the function MIK a set of parameters P (in this case 14 parameters) and calculate and minimize the error value using SSIM index.
function error = MIK2(P)
. % this part opens opensees runs the model
. % plots the model and saves it as a .png file
A = imread('Model_Output.png');
B = imread('Experimet_Data.png');
error = 1-ssim(A,B);
After opening the GA toolbox and setting the stop criteria to only run for 10 populations i noticed that GA does not even count the steps and basically reports nothing and responds to nothing I literally have to close MATLAB to stop the optimization! :)
Any help would be appreciated... tnx :)
Alan Weiss on 13 Oct 2021
I suspect that the problem is your objective function takes too long, possibly it does not even finish.
I assume that you have defined the nvar and lb and ub argumentts for ga. (I assume that you have finite bounds.) If so, see how long it takes to run your objective function on a random point:
pt = lb + rand(size(lb)).*(ub - lb);
% Or, if you have no bounds, pt = randn(1,nvar);
error = MIK2(pt);
If this returns in a reasonable amount of time, then to help us understand what is going on, please show your ga call and any options that you are passing.
MATLAB mathematical toolbox documentation