Effacer les filtres
Effacer les filtres

Is parallel processing possible in optimization with App Designer

11 vues (au cours des 30 derniers jours)
Sherman Marcus
Sherman Marcus il y a environ 8 heures
I have an app that I developed in App Designer which performs optimization with the aid of the Matlab function lsqnonlin. A snippet:
methods (access = private)
function x=doOptimize(app,x0,lb,ub,options)
f=@(xx)Fun(app,xx);
x=lsqnonlin(f,x0,lb,ub,options);
end
function ff=Fun(app,x)
ff=someFunction(app,x);
end
end
The “someFunction” is a very complex function which utilizes many app properties and methods. The app works fine. However, I would like to take advantage of parallel processing by setting options.UseParallel = true. Doing this causes all kinds of warnings and errors, evidently in accordance with previous posts that stated that the save and load performed by the parallel workers are incompatible with app objects. My question is this: Is there any work-around for this problem? Of course, if app could be excluded altogether from the function Fun, then access=Static can be used. But in this case app is completely intertwined in the calculations. On the other hand, for the parallel processing, why should it be necessary to save the app variable? Since app-related variables only appear in someFunction, would it be possible to remove all references to app in the snippet, define access as Static, and pass app to someFunction as a global variable? Could this trick the parallel workers into thinking that there are no app objects around? (I’m willing to try anything.)

Réponses (0)

Produits


Version

R2024a

Community Treasure Hunt

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

Start Hunting!

Translated by