scipy最优化
学习scipy进行优化函数:
参考:Optimization and root finding (scipy.optimize) — SciPy v1.9.3 Manual
scipy最优化的功能:
1、SciPy优化提供了最小化(或最大化)目标函数的函数,可以是有约束的;
2、非线性问题的求解器(支持局部和全局优化算法);
3、线性规划;
4、约束最小二乘和非线性最小二乘;
5、寻根;
6、曲线拟合;
标量函数优化
minimize_scalar(fun[, bracket, bounds, …]) |
Minimization of scalar function of one variable.一元标量函数的最小化。 |
|---|
The minimize_scalar function supports the following methods:
局部多变量优化
minimize(fun, x0[, args, method, jac, hess, …]) |
Minimization of scalar function of one or more variables.一个或多个变量的标量函数的最小化 |
|---|
The minimize function supports the following methods:
- minimize(method=’Nelder-Mead’)
- minimize(method=’Powell’)
- minimize(method=’CG’)
- minimize(method=’BFGS’)
- minimize(method=’Newton-CG’)
- minimize(method=’L-BFGS-B’)
- minimize(method=’TNC’)
- minimize(method=’COBYLA’)
- minimize(method=’SLSQP’)
- minimize(method=’trust-constr’)
- minimize(method=’dogleg’)
- minimize(method=’trust-ncg’)
- minimize(method=’trust-krylov’)
- minimize(method=’trust-exact’)
Constraints are passed to minimize function as a single object or as a list of objects from the following classes:
NonlinearConstraint(fun, lb, ub[, jac, …]) |
Nonlinear constraint on the variables. |
|---|---|
LinearConstraint(A[, lb, ub, keep_feasible]) |
Linear constraint on the variables. |
Simple bound constraints are handled separately and there is a special class for them:(有一个特殊的类是单独处理简单约束的)
Bounds[lb, ub, keep_feasible] |
Bounds constraint on the variables.变量的边界约束。 |
|---|
Quasi-Newton strategies implementing HessianUpdateStrategy interface can be used to approximate the Hessian in minimize function (available only for the ‘trust-constr’ method). Available quasi-Newton methods implementing this interface are:(实现HessianUpdateStrategy接口的拟牛顿策略可以用来近似Hessian的最小化函数(仅适用于“信任-constr”方法)。实现此接口的可用拟牛顿方法包括:)
BFGS([exception_strategy, min_curvature, …]) |
Broyden-Fletcher-Goldfarb-Shanno (BFGS) Hessian update strategy. |
|---|---|

本文详细介绍Scipy中的优化功能,涵盖一元及多元函数优化、线性规划、约束最小二乘和非线性最小二乘、寻根、曲线拟合等内容,并提供多种优化算法及其适用场景。
最低0.47元/天 解锁文章
1066

被折叠的 条评论
为什么被折叠?



