Passing extra outputs from cost function

1 view (last 30 days)
Dear Matlab Community,
I am using a GA to optimise a certain function, but I want to keep saving some additional data.
f=@(x)requestFitting(extractionInit,x); problemMultiga.fitnessfcn=f;
with
[f,extractionFit] = requestFitting(extractionInit,x)
The problem is, that through the function handle, information on the output of the cost function:extractionFit is lost.
Please help me, how can I save additional outputs of the cost function?
Thanks a lot!
[cost,]

Accepted Answer

Alan Weiss
Alan Weiss on 6 Dec 2016
There are several ways. Proper use of nested functions is one way. Using an output function is another.
Good luck,
Alan Weiss
MATLAB mathematical toolbox documentation
  6 Comments
Kurt Stewart
Kurt Stewart on 11 Oct 2019
I tried parallel and it didnt seem to be a problem, I would have to know more about resource sharing that Matlabs pools do

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!