10优化方法程序实现概要.ppt

10优化方法程序实现概要

Conjugate Gradient Method Start with steepest descent direction n0 = g0 = -?f(x0), find new minimum at x1 Build next search direction n1 from g0 and g1 = -?f(x1), such that n0?A?n1 = 0 Repeat step 2 iteratively to find nj (a Gram-Schmidt orthogonalization process). The result is a set of N vectors (in N dimensions) ni?A?nj = 0 Conjugate Gradient Algorithm Initialize n0 = g0 = -?f(x0), i = 0, Find ? that minimizes f(xi+?ni), let xi+1 =xi+?ni Compute new negative gradient gi+1 = -?f(xi+1) Compute Update new search direction as ni+1 = gi+1 + ?ini; ++i, go to 2 The Conjugate Gradient Program 解: f = [-5; -4; -6]; A = [1 -1 1;3 2 4;3 2 0]; b = [20; 42; 30]; lb = zeros(3,1); [x,fval,exitflag,output,lambda] = linprog(f,A,b,[],[],lb) 结果为: x = %最优解 0.0000 15.0000 3.0000 fval = %最优值 -78.0000 exitflag = %收敛 1 output = iterations: 6 %迭代次数 cgiterations: 0 algorithm: lipsol %所使用规则 结构拓扑优化设计程序实现 top(60,20,0.5,3.0,1.5) FMIN Minimize function of one variable. X = FMIN(F,x1,x2) attempts to return a value of x which is a local minimizer of F(x) in the interval x1 x x2. F is a string containing the name of the objective function to be minimized. X = FMIN(F,x1,x2,OPTIONS) uses a vector of control parameters. If OPTIONS(1) is positive, intermediate steps in the solution are displayed; the default is OPTIONS(1) = 0. OPTIONS(2) is the termination tolerance for x; the default is 1.e-4. OPTIONS(14) is the maximum number of function evaluations; the default is OPTIONS(14) = 500. The other components of OPTIONS are not used as input control parameters by FMIN. For more information, see FOPTIONS. X = FMIN(F,x1,x2,OPTIONS,P1,P2,...) provides for additional arguments which are passed to the objective function, F(X,P1,P2,...) [X,OPTIONS] = FMIN(...) returns a count of the number of steps taken in OPTIONS(10). [x,options]=fmin(‘f’,x, options,gradfun,paramt1,par

文档评论(0)

1亿VIP精品文档

相关文档