Advertisement
ImperfectionistCoder

Untitled

Jul 7th, 2021
261
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.31 KB | None | 0 0
  1. from scipy.optimize import fmin_cobyla
  2. from math import sqrt
  3. def f(x):
  4.     return x[0]*x[1]**2+1
  5. def contrainte1(x):
  6.     return 2 - (x[0] + x[1]**2)
  7. def contrainte2(x):
  8.     return x[0]
  9. def contrainte3(x):
  10.     return x[1]
  11.  
  12. fmin_cobyla(f, [0.0, 0.1], [contrainte1, contrainte2, contrainte3], rhoend=1e-7)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement