OPTIMOPTIONS does not support code generation for function 'ga'.

8 次查看(过去 30 天)
I get this error OPTIMOPTIONS does not support code generation for function 'ga' when I try to run a matlab function in simulink using genetic algorithm optimization methode;
options = optimoptions('ga', 'Display', 'iter', ...
'PopulationSize', 50, ... % You can adjust this
'MaxGenerations', 100, ... % You can adjust this
'UseParallel', true); % Use parallel computing if available
could someone help me please ?

采纳的回答

Ayush Aniket
Ayush Aniket 2024-8-29
Hi Ghada,
The error is related to the fact that optimoptions and the Genetic Algorithm (ga) function are not directly supported for code generation in Simulink. You can wrap the call to optimoptions function in a wrapper function and use coder.extrinsic command to declare that wrapper function as extrinsic and call it from your MATLAB Function block. Refer to the following MATLAB answer:

更多回答(1 个)

Walter Roberson
Walter Roberson 2024-8-29
None of the functions in the Global Optimization Toolbox are supported for code generation.
Your only hope would be turning off Rapid Acceleration, and using coder.extrinsic from a MATLAB Function Block. This should result in Simulink calling MATLAB in an interpreted way

类别

Help CenterFile Exchange 中查找有关 Genetic Algorithm 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by