Closed kdesoto-astro closed 7 months ago
Hi,
This is a lifetime issue. You are creating the evaluator and optimizer instances inside the loop, so their lifetime is limited to the body of the loop. These objects will already be 'dead' at the time when the GP algorithm needs to use them.
One possible workaround is to extend their lifetime by putting them in a list:
instances_holder = []
for i in range(2): # works fine if changed to range(1)
evaluator_i = Operon.Evaluator(problem, dtable, error_metric, True) # initialize evaluator, use linear scaling = True
evaluator_i.Budget = 1000 * 10000 # computational budget
optimizer = Operon.LMOptimizer(dtable, problem, max_iter=3)
evaluator_i.Optimizer = optimizer
evaluator.Add(evaluator_i)
instances_holder.append((evaluator_i, optimizer))
if you're still having trouble (and assuming you're testing multiview SR), have a look at:
https://github.com/erusseil/MvSR-analysis/blob/main/mvsr.py#L115 https://github.com/erusseil/MvSR-analysis/issues/5#issuecomment-1961015836
Hi,
Thanks for the quick responses - the instances_holder solution worked! Previously I was just saving the evaluators to a list (following the mvsr.py script), but also saving the optimizers seems to have fixed the issue. Thank you so much!
Hi,
I've been able to isolate a segmentation fault to the use of Operon.MultiEvaluator, specifically when you add more than one evaluator to the MultiEvaluator object.
Simple reproducible example (replacing the Operon.Evaluator() definition in example/operon-bindings.py ):
Not sure if this bug appears on Linux machines as well. Segfault still occurs when not applying aggregateEvaluator and instead feeding evaluator directly into the last line, so the issue does not seem to be with AggregateEvaluator. Using Python 3.11, and working on a MacBook M1 Pro with Sonoma 14.5 Beta. Installed using git clone + pip instructions.