Hi,
To completely silence the solver you can set
opts = {'ipopt.print_level': 0, 'print_time': 0, '
ipopt.sb': 'yes'}
opti.solver('ipopt', opts)
However, I find having access to the solver output is useful when debugging and instead I re-direct the stdout to a file before calling opti.solve(). You can do this in the following way:
import sys
import traceback
import casadi as ca
opti = ca.Opti()
# Setup opti problem ...
with open('solver_output.txt', 'w') as output_file:
# Retrieve default stdout
stdout_old = sys.stdout
# Re-direct standard output
sys.stdout = output_file
try:
opti.solve()
except:
# If error thrown -> print exception to old stdout
traceback.print_exc(file=stdout_old)
finally:
# Re-direct stdout to default
sys.stdout = stdout_old
Hope this helps!
Best,
Chris