Vectorized Multiobjective GA sends single individuals rather than entire population

4 vues (au cours des 30 derniers jours)
I have tried implementing the multiobjective GA (gamultiobj) using a vectorized fitness function, as explained at the bottom of: https://www.mathworks.com/help/gads/examples/performing-a-multiobjective-optimization-using-the-genetic-algorithm.html. However, after setting the options to use vectorization and ensuring that parallel computing is off, the gamultiobj still only passes the population to the function one individual at a time. I have tried updating my version of Matlab to 2017b thinking that the older version that I was using might not have supported vectorization for gamultiobj, but it still does not work with R2017b. I have successfully vectorized the regular ga, so it was unexpected that it would not work for multi objective ga. Can anyone confirm that gamultiobj does support vectorized evaluation of the fitness function?

Réponse acceptée

Matthew Whelan
Matthew Whelan le 26 Sep 2017
Niraj, thank you for your reply. I believe that I have identified the issue: 1) I inadvertently set the numberOfVariables to 2 instead of 1. This caused the issue with the dimensions. 2) However, when I set a breakpoint in the vectorized_multiobjective.m function, I discovered that the first call to this function only issues an individual, not a population of 50 as expected. Then, there is a second call to the function with a vectorized population of 49 individuals. After this call to the function, all subsequent calls are vectorized for 50 individuals. In my prior usage of vectorized single objective ga, the vectorized populations start from the first call to the function, so this difference in the gamultiobj was unexpected for me and the function that I developed to evaluate the vectorized population was not written to account for this difference.
Now that I understand how the population of the first generation is vectorized differently that the remaining populations, I should be able to modify my vectorized function appropriately. Thank you for your assistance.

Plus de réponses (3)

Alan Weiss
Alan Weiss le 25 Sep 2017
As the example you quote shows, gamultiobj works in a vectorized fashion when the 'UseVectorized' option is true. If it isn't working for you, then something else is going on. Perhaps you have a custom function for mutation or crossover that doesn't work in a vectorized fashion? I really have no idea at this point why it isn't working for you. I can assure you that in some cases, the feature works as advertised.
Alan Weiss
MATLAB mathematical toolbox documentation

Matthew Whelan
Matthew Whelan le 25 Sep 2017
Alan, Thank you for your response. I am finding that even the example (openExample('globaloptim/gamultiobjfitness')), loaded directly without any modification does not work for me. I receive an:
Assignment has more non-singleton rhs dimensions than non-singleton subscripts
Error in vectorized_multiobjective (line 32) scores(:,1) = (pop + 2).^2 - 10;
If I set a breakpoint within the vectorized_multiobjective function, it is clear that the reason for this error is that the gamultiobj (even with the 'UseVectorized' set to 'true' in the gamultiobjfitness.m script) is sending individuals to the vectorized_multiobjective function instead of the entire population.
Given that even the example script and function do not work correctly, I think that this issue is larger than my application-specific functions. I am using the 64-bit Linux version of R2017b (although I have also tried R2013b with no luck as well as R2017a on a Windows install). Any idea why the MATLAB example does not work correctly?

Niraj Gadakari
Niraj Gadakari le 26 Sep 2017
I tried to reproduce the error that you were receiving while executing the shipped example, but I could not get any errors. The examples work fine in both R2017a, and R2017b in both Windows, and Linux Machines.
The error however indicates that in the assignment:
scores(:,1) = (pop + 2).^2 - 10;
There is mismatch in the dimension of "pop" and "scores(:,1)".
Ensure that "pop" has not been modified before executing this line. Also, ensure that there are no other shadowed files names "vectorized_multiobjective.m" in the path. To find if there are any shadowed files, you can execute the following command in the Command Window:
which -all vectorized_multiobjective.m

Catégories

En savoir plus sur Startup and Shutdown 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