提交 82a585ac authored 作者: Pascal Lamblin's avatar Pascal Lamblin

Abort EquilibriumOptimizer loop just after max_use

It used to wait for the first attempt to apply an optimization after it has already crossed the threshold. Now, it signals that the optimizer should stop earlier, just after crossing that threshold.
上级 e5216440
......@@ -1150,17 +1150,16 @@ class EquilibriumOptimizer(NavigatorOptimizer):
current_node = node
for lopt in self.local_optimizers:
process_count.setdefault(lopt, 0)
if process_count[lopt] > max_use:
max_use_abort = True
opt_name = (getattr(lopt, "name", None)
or getattr(lopt, "__name__", None) or "")
else:
lopt_change = self.process_node(env, node, lopt)
if lopt_change:
process_count[lopt] += 1
changed = True
if node not in env.nodes:
break # go to next node
lopt_change = self.process_node(env, node, lopt)
if lopt_change:
process_count[lopt] += 1
changed = True
if process_count[lopt] > max_use:
max_use_abort = True
opt_name = (getattr(lopt, "name", None)
or getattr(lopt, "__name__", ""))
if node not in env.nodes:
break # go to next node
finally:
self.detach_updater(env, u)
self.detach_updater(env, u) #TODO: erase this line, it's redundant at best
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论