Advertisement
Guest User

Untitled

a guest
Jun 17th, 2019
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.32 KB | None | 0 0
  1. import numpy as np
  2. from scipy.optimize import minimize
  3. from scipy.optimize import Bounds
  4.  
  5.  
  6. bounds = Bounds([2,10],[5,20])
  7.  
  8. x0 = np.array([2.5,15])
  9.  
  10. def objective(x):
  11. x0 = x[0]
  12. x1 = x[1]
  13. return a*x0 + b*x0*x1 - c*x1*x1
  14.  
  15. res = minimize(objective, x0, method='trust-constr',options={'verbose': 1}, bounds=bounds)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement