pymoo icon indicating copy to clipboard operation
pymoo copied to clipboard

Relaunch a simulation if it didn't run

Open AndreaPi opened this issue 1 year ago • 1 comments

I am using pymoo to find the optimal parameters for a datamatchin problem. In other words, I have a black box simulator getting parameters X as input, and returning values Y_pred as output, which need to match some ground truth experimental values Y. I cast this as an optimization problem, where

results['F'] = [np.mean(Y-Y_pred**2)]

The black box simulator is resource-intensive, so I use parallel computing. For various reasons, sometimes a simulation, ran with subprocess may time out even if it wasn't actually run, or if the run wasn't completed. In case of timeout, I'm able to catch the sp.TimeoutExpired exception.

  1. Is it possible to tell pymoo to skip an individual?
  2. If not, is it possible to retry the same individual once?

I don't want to assign the run a large penalty, e.g., results['F'] = 99999, because I'm not sure if the candidate was bad or not. In some cases, it may be possible that the simulation didn't run at all.

AndreaPi avatar Apr 17 '24 09:04 AndreaPi

What about simply using a try...catch.. in the problem evaluation?

you can in the catch part set your objective value to a large value or also implementy a retry strategy.

blankjul avatar Apr 22 '24 02:04 blankjul