How do I speed up the optimization of a tomographic imaging system with genetic algorithm?

I have a tomographic imaging system with eight cameras. The cameras are controlled independently and each one can have a possible imaging configuration in the range {H1,H2,H3,H4,H5,H6,H7,H8,H9}, where H is a 2D system matrix. In my objective function I use a set of H matrix for example {H5,H7,H1,H1,H3,H8,H7,H9,H9} to image an object then I estimate a parameter and calculate mean squared error(MSE). I'd like to find a combination of H matrices that minimizes MSE and for that I'm using the GA function. The code runs but it is very slow. I have tried the 'UseParallel' and that hasn't helped much, and I'm not sure if I can use the vectorize options. I also a version of the objective function that runs on GPU but that gives error when used in the GA optimization. Is there a way to speed up the simulation? Thanks, Here's a sample of my code:
%%%%% Objective Function %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% function EMSE = SLE_MOBY_CPU_GA(x,fbk_gpu,ftest_gpu,fsig_gpu,nimages,imsize,param,nparam,sigVec,H1,H2,H3,H4,H5,H6,H7,H8,H9)
bk = [ eval(['H',num2str(x(1))])*fbk_gpu(:,1:nimages);... eval(['H',num2str(x(2))])*fbk_gpu(:,nimages+1:2*nimages);... eval(['H',num2str(x(3))])*fbk_gpu(:,2*nimages+1:3*nimages);... eval(['H',num2str(x(4))])*fbk_gpu(:,3*nimages+1:4*nimages);... eval(['H',num2str(x(5))])*fbk_gpu(:,4*nimages+1:5*nimages);... eval(['H',num2str(x(6))])*fbk_gpu(:,5*nimages+1:6*nimages);... eval(['H',num2str(x(7))])*fbk_gpu(:,6*nimages+1:7*nimages);... eval(['H',num2str(x(8))])*fbk_gpu(:,7*nimages+1:8*nimages)];
some code that estimates a parameter and calculates EMSE
end
%%%%%%%% Main %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
IntCon = 1:8;
options = gaoptimset('Generations',10,'UseParallel',true,'Display','iter');
[xopt,fval] = ga(@(x)SLE_MOBY_CPU_GA(x,fbk,ftest,fsig,nimages,imsize,...
param,nparam,sigVec,H1,H2,H3,H4,H5,H6,H7,H8,H9),8,[],[],[],[],ones(1,8),...
9*ones(1,8),[],IntCon,options);

1 Comment

Have you tried profiling your objective function?
Try evaluating it after calling the command profile on then looking at profile viewer. This should tell you which parts are slow. Right now, I don't think we can tell which part of that is slow, since it involves lots of functions we can't see.

Sign in to comment.

Answers (1)

I believe that the best way to speed any genetic algorithm optimization is to change the solver from ga to patternsearch. In most cases, patternsearch is faster, more robust, and easier to tune.
If patternsearch finds undesirable local minima, run it repeatedly with different start points, such as
x0 = lb + rand(size(lb)).*(ub - lb);
This assumes that you have finite upper and lower bounds ub and lb, and that you are not doing mixed integer optimization.
If you are doing pure integer optimization, you might still be able to use patternsearch. Just start with integer points, set bounds, set an initial mesh size of 2, and a stopping condition that stops when the mesh size is 1. Start at random integer points, such as
x0 = randi(9,1,8);
Good luck,
Alan Weiss
MATLAB mathematical toolbox documentation

Categories

Asked:

on 16 Dec 2015

Answered:

on 17 Dec 2015

Community Treasure Hunt

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

Start Hunting!