第四章非线性规划
本章, 我们介绍两种解决非线性规划问题的软件:
第一种: MATLAB中的optimization toolbox 中的若干程序;
第二种: LINGO软件.
无约束问题
程序名: unpfun1函数, unpfun2函数
unpfun1 实例:
Minimize the function
在命令窗口输入以下信息:
>> x0=[1,1]; % Then call fminunc to find a minimum of unpfun1 near [1,1]
>> [x,fval]=fminunc(***@unpfun1,x0)
输出以下信息:
Optimization terminated essfully:
Search direction less than 2*
x =
-008 *
-
fval =
-016
unpfun2实例:将上述的实例用梯度法做
在命令窗口输入以下信息:
>> options = optimset('GradObj','on'); % To minimize this function with the gradient provided
>> x0 = [1,1];
>> [x,fval] = fminunc(***@unpfun2,x0,options)
输出以下信息:
Optimization terminated essfully:
First-order optimality less than , and no negative/zero curvature detected
x =
-015 *
-
fval =
-031
程序的相关知识:
第一种: fminsearch
Find a minimum of an unconstrained multivariable function
where x is a vector and f(x) is a function that returns a scalar.
语法如下:
x = fminsearch(fun,x0)
x = fminsearch(fun,x0,options)
[x,fval] = fminsearch(...)
[x,fval,exitflag] = fminsearch(...)
[x,fval,exitflag,output] = fminsearch(...)
解释:
fminsearch attempts to find a minimum of a scalar function of several variables, starting at an initial estimate. This is generally referred to as unconstrained nonlinear optimization.
x = fminsearch(fun,x0) starts at the point x0 and attempts to find a local minimum x of the function described in fun. fun is a function handle for either an M-file function or an anonymous function. x0 can be a scalar, vector, or matrix.
x = fminsearch(fun,x0,options) minimizes with the optimization options specified in the structure options. Use optimset to set these options.
[x,fval] = fminsearch(...) returns in fval the value of the objective function fun at the solution x.
[x,fval,exitflag] = fminsearch(...) returns a value exitflag that describes the exit condition of fminsearch.
[x,fval,exitflag,output] = fminsearch(...) returns a s
第四章非线性规划 来自淘豆网www.taodocs.com转载请标明出处.