我正在尝试通过 OpenMDAO 的 pyoptsparse 驱动程序使用 NSGA2 优化器来修改 GA 人口大小。
我尝试使用字典进行访问PopSize
,如下所示:pyNSGA2.py
opt_settings
prob.driver = om.pyOptSparseDriver(optimizer='NSGA2')
prob.driver.opt_settings["PopSize"] = 150
但是,这会导致分段错误,消息如下:
[0]PETSC ERROR: ------------------------------------------------------------------------
[0]PETSC ERROR: Caught signal number 11 SEGV: Segmentation Violation, probably memory access out of range
[0]PETSC ERROR: Try option -start_in_debugger or -on_error_attach_debugger
[0]PETSC ERROR: or see https://www.mcs.anl.gov/petsc/documentation/faq.html#valgrind
[0]PETSC ERROR: or try http://valgrind.org on GNU/linux and Apple Mac OS X to find memory corruption errors
[0]PETSC ERROR: configure using --with-debugging=yes, recompile, link, and run
[0]PETSC ERROR: to get more information on the crash.
--------------------------------------------------------------------------
MPI_ABORT was invoked on rank 0 in communicator MPI_COMM_WORLD
with errorcode 50152059.
NOTE: invoking MPI_ABORT causes Open MPI to kill all MPI processes.
You may or may not see output from other processes, depending on
exactly when Open MPI kills them.
是否有不同的方法来访问应该使用而不是opt_settings
字典的 NSGA2 优化器的选项?我对 Python 比较陌生,所以我也怀疑我的语法也可能不正确。
更新:
对于更多的上下文,我尝试在没有 PETSC 的情况下运行。优化在没有尝试更改的情况下成功PopSize
,但是Segmentation fault
在尝试更改时它崩溃了PopSize
。跟踪错误,我相信分段错误的根源在pyoptsparse/pyNSGA2/source/crossover.c
,根据下面的消息
Program received signal SIGSEGV, Segmentation fault.
0x00007fffbc85747b in realcross (parent1=parent1@entry=0x1864bf0, parent2=parent2@entry=0x186d030,
child1=child1@entry=0x1868280, child2=child2@entry=0x18682c0, global=..., nrealcross=<optimized out>)
at pyoptsparse/pyNSGA2/source/crossover.c:104
104 child2->xreal[i] = parent2->xreal[i];
我还尝试在新机器上全新安装 PETSC,但这让我又回到了同样的错误。