Optimizing "nested" variables with a genetic algorithm

1 view (last 30 days)
Hi there,
I'm trying to optimize the camera positions for a 3D reconstruction. There are 2 cameras available which can be placed anywhere around the object. The camera position is determined by its 3 spherical coordinates.
I am currently running a ga() optimization where the objective function has an input of a 2x3 matrix, determining camera positions. The output is a scalar characterizing the exactness of the 3D reconstruction.
objfun = @(xarray)reconstruction_fun(xarray);
The problem with this approach is that all entries of the matrix are scored as individuals. I would like the algorithm to take 2 vectors as an entry, each describing one camera position. And then optimize the 2 camera positions. The objective function would have to take 2 inputs as variables.
cam1=(radius1, phi1, theta1)
cam2= (..)
objfun = @(cam1, cam2)reconstruction_fun(cam1, cam2);
Is there a better way to achieve the optimization than with all variables thrown into one array?
Thanks, Simon

Accepted Answer

Matt J
Matt J on 15 Oct 2020
Edited: Matt J on 15 Oct 2020
The problem with this approach is that all entries of the matrix are scored as individuals.
No, that shouldn't be. As long as you've specified nvars=6, ga() should know to treat a 1x6 input vector as single population member.

More Answers (0)

Products


Release

R2020b

Community Treasure Hunt

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

Start Hunting!