Multistart run ID with UseParallel

2 views (last 30 days)
Alexander Andreychenko
Alexander Andreychenko on 4 Apr 2016
Commented: Walter Roberson on 13 Apr 2016
Hello! I have a pretty long execution of MultiStart. I am using it to run fmincon on my goal function. Since my goal function is not really 'stable' I have it it inside try/catch block and also trying to put the execution into log file (using log4m). The problem is that the log file becomes a mess because of parallel execution of MultiStart (I am using it with 'UseParallel').
Currently I can only see the ID of the task (from getCurrentTask). But the taskID and ProcessId (from getCurrentWorker) both do not change while execution. So, if I have parallel pool of 4 workers, the runs of MultiStart spread over workers and then executed (I assume).
What I want to do is to see the ID of MultiStart task. For instance, I have 10 initial points. Then I would like to create 10 log files for each of local runs. Is it possible somehow to get the ID of MultiStart task?
I see one possible solution in having the persistent variable in my goal function body but I would like not to mess with persistent variables in parallel execution. It seems like overkilling.
Any help is appreciated!
Thank you, Alex
  2 Comments
sam0037
sam0037 on 12 Apr 2016
Hi,
My understanding is that you would like to have different log files for each start point in the MultiStart algorithm. One of the ways to achieve this would be to generate random numbers inside the goal function and use them to create different log file names and finally use the same to create new log files.
Walter Roberson
Walter Roberson on 13 Apr 2016
You might as well use tempname() for creating unique file names.

Sign in to comment.

Answers (0)

Community Treasure Hunt

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

Start Hunting!