Closed Giannis1993 closed 2 years ago
This PR includes a wrapper function for scipy. Related link can be found below: https://docs.scipy.org/doc/scipy/reference/tutorial/optimize.html#constrained-minimization-of-multivariate-scalar-functions-minimize One thing I am not 100% sure about is why defining the inequality constraints as a NonlinearConstraint object (instead of a dictionary that is currently implemented) gives a warning but still works. Note that, according to the above link, one can define it both ways.
scipy
NonlinearConstraint
ineq_cons = optimize.NonlinearConstraint(self.constraints, -np.inf, 0, jac=self.constraints_der) solution = optimize.minimize(self.objective, x0, bounds=bounds, method='trust-constr', jac=self.objective_der, constraints=ineq_cons, options={'gtol': 1e-6})
After this is approved, I can change the files in the examples/ directory as well.
examples/
This PR includes a wrapper function for
scipy
. Related link can be found below: https://docs.scipy.org/doc/scipy/reference/tutorial/optimize.html#constrained-minimization-of-multivariate-scalar-functions-minimize One thing I am not 100% sure about is why defining the inequality constraints as aNonlinearConstraint
object (instead of a dictionary that is currently implemented) gives a warning but still works. Note that, according to the above link, one can define it both ways.