Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import numpy as np
- from scipy.optimize import minimize
- from scipy.optimize import Bounds
- bounds = Bounds([2,10],[5,20])
- x0 = np.array([2.5,15])
- def objective(x):
- x0 = x[0]
- x1 = x[1]
- return a*x0 + b*x0*x1 - c*x1*x1
- res = minimize(objective, x0, method='trust-constr',options={'verbose': 1}, bounds=bounds)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement