Когда я пытаюсь запустить свой код с помощью OpenMDAO, я обнаруживаю следующую распечатку из IPOPT:
Код: Выделить всё
Exit Status
Inform Description
-12 Invalid Option
--------------------------------------------------------------------------------
Код: Выделить всё
p.driver.opt_settings['linear_solver'] = 'ma86'
Стоит отметить, что каждый раз, когда я пытаюсь запустить make install (после запуска make и make check ) для HSL MA86, я обнаружил следующий фрагмент распечатки ошибки (фактические пути к файлам были отредактированы в целях конфиденциальности):
Код: Выделить всё
/usr/bin/install: 'include/hsl_ma86s.h' and '/path/to/hsl_ma86-1.7.4/include/hsl_ma86s.h' are the same file
/usr/bin/install: 'include/hsl_ma86d.h' and '/path/to/hsl_ma86-1.7.4/include/hsl_ma86d.h' are the same file
/usr/bin/install: 'include/hsl_ma86c.h' and '/path/to/hsl_ma86-1.7.4/include/hsl_ma86c.h' are the same file
/usr/bin/install: 'include/hsl_ma86z.h' and '/path/to/hsl_ma86-1.7.4/include/hsl_ma86z.h' are the same file
/usr/bin/install: 'include/hsl_mc68i.h' and '/path/to/hsl_ma86-1.7.4/include/hsl_mc68i.h' are the same file
/usr/bin/install: 'include/hsl_mc69s.h' and '/path/to/hsl_ma86-1.7.4/include/hsl_mc69s.h' are the same file
/usr/bin/install: 'include/hsl_mc69d.h' and '/path/to/hsl_ma86-1.7.4/include/hsl_mc69d.h' are the same file
/usr/bin/install: 'include/hsl_mc69c.h' and '/path/to/hsl_ma86-1.7.4/include/hsl_mc69c.h' are the same file
/usr/bin/install: 'include/hsl_mc69z.h' and '/path/to/hsl_ma86-1.7.4/include/hsl_mc69z.h' are the same file
make[2]: *** [Makefile:418: install-includeHEADERS] Error 1
make[2]: Leaving directory '/path/to/hsl_ma86-1.7.4'
make[1]: *** [Makefile:749: install-am] Error 2
make[1]: Leaving directory '/path/to/hsl_ma86-1.7.4'
make: *** [Makefile:445: install-recursive] Error 1
Код: Выделить всё
import os
import subprocess
def my_function():
# Path to HSL MA86 libraries -- needed to temporarily change for OpenMDAO code
ma86_path = "/path/to/hsl_ma86-1.7.4/lib"
# Obtains the original library path necessary for other code
original_libPath = os.environ.get('LD_LIBRARY_PATH', '')
try:
# Temporarily sets the library path to HSL MA86 so that IPOPT can find it
# os.environ['LD_LIBRARY_PATH'] = f"{ma86_path}:{original_libPath}"
os.environ['LD_LIBRARY_PATH'] = ma86_path
print('LD_LIBRARY_PATH: {}'.format(os.environ['LD_LIBRARY_PATH']))
print('Subprocess executed')
# Execute trajectory code using HSL MA86
subprocess.run(["python", "my_openmdao_code.py"])
finally:
# Resets initial library path for use in optimization
os.environ['LD_LIBRARY_PATH'] = original_libPath
print('Restoration Occured')
print('LD_LIBRARY_PATH: {}'.format(os.environ['LD_LIBRARY_PATH']))
if __name__ == '__main__':
my_function()
Подробнее здесь: https://stackoverflow.com/questions/786 ... n-openmdao
Мобильная версия