Multi objective genetic algorithm: Loading variables in function handles
Show older comments
I am currently using the multi-objective genetic algorithm function 'gamultiobj' to solve a system with 2 variables and 3 objective functions.
I have created an objective function .m file called function_objective.m, which I'm giving a function handle to as
obj=@function_objective;
This objective function file has all three objective functions y(1), y(2) and y(3). One of the objective functions is to minimize a certain parameter that requires the input of 3 large arrays from the workspace (a vector of 525600 values each). I noticed that this function, being called as a handle by gamultiobj, is not able to recognize any variables in the workspace, and the vectors being so big, I cannot just copy it into the file. What I ended up doing is load the .mat files containing those vectors at the beginning of the 'function_objective.m' file. After running the profile viewer, I noticed that this step is taking by far the most time in the whole simulation. So my question is, is there a way for the function handles to be able to recognize the variables in the workspace? Otherwise, is there a way to just load the .mat files once instead of every time for each variable at each generation?
Thank you!
I can share the whole code if needed.
Ali
Accepted Answer
More Answers (0)
Categories
Find more on Genetic Algorithm in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!