Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from scipy.optimize import minimize
- def objective(x):
- return x[1]
- def constraint(x):
- return x[1] - (x[0]**1.5 - 2*x[0] + 3.0) # placeholder for large calculation
- x0 = [4.0,2.2]
- b = (0.0,5.0)
- bnds = (b,b)
- cons = [{'type': 'ineq', 'fun':constraint}]
- sol = minimize(objective, x0, method='SLSQP',bounds=bnds,constraints=cons)
Add Comment
Please, Sign In to add comment