Is there a way to pause gamultiobj, run other computations/scripts and resume gamultiobj (with and without restarting MATLAB)?

1 回表示 (過去 30 日間)
Operations with optimization tools consume days and weeks of time. My requirement is to pause such optimization, use MATLAB for other activities for some time, and then, resume the optimization. The other activities can include restarting MATLAB.
I have seen some answers, but those are just to pause and resume but not to do other computations in between.
At present, I am using gamultiobj and paretosearch and I can store the results after evaluation of every parameter set.
Thank you in advance.

回答 (1 件)

Walter Roberson
Walter Roberson 2024 年 12 月 3 日
First of all, create some globally accessible stop flag, such as in the base workspace.
Second of all, run gamultiobj with options that specify an output function, and requesting at least 5 outputs -- you need the 'population' output.
Have the output function check the global stop flag, and if the stop flag is set then change state.StopFlag to something non-empty.
Now run from the editor -- you need the Run / Pause feature.
At the appropriate time, click on the editor Pause button. Wait for it to pause. Now set the globally accessible stop flag to an appropriate value.
To resume, do the same thing again, except this time also specify the option InitialPopulationMatrix, specifying the 'population' output from before.
  2 件のコメント
Dhanesh R
Dhanesh R 2024 年 12 月 5 日
Thanks for the reply.
  1. Suppose I set gamultiobj to run with maximum of 10 generations and a population size of 50.
  2. I want to pause the operation at some 25th evaluation in 7th generation.
  3. If I am using option OutputFcn to pause/stop, I have to wait till the completeion of all 50 evaluations within 7th generation.
  4. And if want to resume the operation, run gamultiobj again but by specifying option InitialPopulationMatrix (and may be InitialScoresMatrix) from 7th generation of the previous operation.
So, it is basically two (or more) separate optimizations but with the results fed from the previous operations.
Did I understand you correctly?
Walter Roberson
Walter Roberson 2024 年 12 月 5 日
You are right that OutputFcn runs at the end of a generation.
Hmmm....
You could have the objective function check the stop flag, and just return Inf if it is set. In theory gamultiobj should then reject those moves, holding on to the previous population members instead.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeMultiobjective Optimization についてさらに検索

製品


リリース

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by