Skip to content
Advertisement

How to pass arguments to non-linear constraints in scipy.optimize?

I am trying to use scipy optimization to solve an optimization problem. I have defined the non-linear constraints and fitness functions as shown below in the code. I am able to pass arguments to the fitness function but not to the non-linear constraints. Is there clean way to do it? The arguments to be passed to fitness function and the non-linear constraints are the same.

JavaScript

Advertisement

Answer

You can use lambda functions:

JavaScript
User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement