Как заставить JModelica работать тихо?

Я запускаю следующий сценарий JModelica:

#!/usr/local/jmodelica/bin/jm_python.sh
import pyjmi
op = pyjmi.transfer_optimization_problem("BatchReactor", "model.mop")

opt_opts                                 = op.optimize_options()
opt_opts['n_e']                          = 40 # Number of elements
opt_opts['IPOPT_options']['tol']         = 1e-10
opt_opts['IPOPT_options']['print_level'] = 0

res = op.optimize(options=opt_opts)

Я ожидал, что установка print_level на 0 будет означать, что JModelica и IPOPT будут тихими. И это определенно помогает! Но я продолжаю получать такие выводы:

time spent in eval_f: 0.00135 s. (26 calls, 0.0519231 ms. average)
time spent in eval_grad_f: 0.001719 s. (27 calls, 0.0636667 ms. average)
time spent in eval_g: 0.001636 s. (26 calls, 0.0629231 ms. average)
time spent in eval_jac_g: 0.002491 s. (28 calls, 0.0889643 ms. average)
time spent in eval_h: 0.003868 s. (26 calls, 0.148769 ms. average)
time spent in main loop: 0.055749 s.
time spent in callback function: 0 s.
time spent in callback preparation: 0.000459 s.

Total time: 0.46 seconds
Pre-processing time: 0.38 seconds
Solution time: 0.06 seconds
Post-processing time: 0.02 seconds

Как я могу подавить такой вывод?


person Richard    schedule 15.08.2015    source источник


Ответы (1)


Вы можете подавить строки, начинающиеся с time spent, используя:

opt_opts['IPOPT_options']['print_time']   = False
person Richard    schedule 16.08.2015