Matlab fmincon函数
程序员文章站
2024-03-19 08:16:34
...
函数功能
获取约束的非线性多变量函数的最小值
样式:
其中,c(x), ceq(x) 分别表示非线性的约束条件,而A, Aeq表示的是线性约束。
函数表达及用法
x = fmincon(fun,x0,A,b,Aeq,beq,lb,ub,nonlcon,options)
- fun
minimizes fun - 初始值
starts at x0,x0 can be a scalar, vector, or matrix. - 线性约束
attempts to find a minimizer x of the function described in fun subject to the linear inequalities Ax ≤ b,Aeqx = beq,and the range lb ≤ x ≤ ub - 非线性约束
the nonlinear inequalities c(x) or equalities ceq(x) defined in nonlcon
For example,x = fmincon(@myfun,x0,A,b,Aeq,beq,lb,ub,@mycon) where mycon is a MATLAB function such as function [c,ceq] = mycon(x) c = ... % Compute nonlinear inequalities at x. ceq = ... % Compute nonlinear equalities at x.
- 选项
Optimization options, specified as the output of optimoptions or a structure such as optimset returns
- Algorithm
返回值
[x,fval,exitflag,output,lambda,grad,hessian] = fmincon(___) additionally returns:
x— variable
fval— the value of the objective function fun
exitflag— describes the exit condition of fmincon,
output— a structure output with information about the optimization process.
lambda — Structure with fields containing the Lagrange multipliers at the solution x.
grad — Gradient of fun at the solution x.
hessian — Hessian of fun at the solution x. See fmincon Hessian.
- exitflag
- output
- lambda
- Hessian
上一篇: SSL 2386 序列#线性动态规划#
下一篇: javascript实现小游戏贪吃蛇