文档库 最新最全的文档下载
当前位置:文档库 › fgoalattain

fgoalattain

标规划优问题多目化

fgoalattain

工程应用中fgoalattain 函数调用格式如下:

[x,fval]=fgoalattain (fun,x0,goal,weight,A,b,Aeq,beq,lb,ub,nonlcon)

help fgoalattain

FGOALATTAIN Solves the multi-objective goal attainment optimization problem.

Solve minimize value problem.

X=FGOALATTAIN(FUN,X0,GOAL,WEIGHT,A,B) solves the goal attainment problem subject to the linear inequalities A*X <= B .

X=FGOALATTAIN(FUN,X0,GOAL,WEIGHT,A,B,Aeq,Beq) solves the goal attainment problem

subject to the linear equalities Aeq*X = Beq as well.

X=FGOALATTAIN(FUN,X0,GOAL,WEIGHT,A,B,Aeq,Beq,LB,UB) defines a set of lower and upper bounds on the design variables, X, so that the solution is in

the range LB <= X <= UB. Use empty matrices for LB and U if no bounds

exist. Set LB(i) = -Inf if X(i) is unbounded below; set UB(i) = Inf if X(i) is

unbounded above.

X=FGOALATTAIN(FUN,X0,GOAL,WEIGHT,A,B,Aeq,Beq,LB,UB,NONLCON) subjects the

goal attainment problem to the constraints defined in NONLCON (usually an

M-file: NONLCON.m). The function NONLCON should return the vectors

C and Ceq, representing the nonlinear inequalities and equalities respectively,

when called with feval: [C, Ceq] = feval(NONLCON,X). FGOALATTAIN

optimizes such that C(X)<=0 and Ceq(X)=0.

For more details, type the M-file FGOALATTAIN.M.

See also OPTIMSET, OPTIMGET.

例1. 程序(利用fgoalattain 函数求解)

23222

12

3222132min )3()2()1(min x x x x x x ++?+?+?

0,,6

..321321≥=++x x x x x x t s

①建立M 文件.

function y = fun(sol, options)

%([sol, eval]提示未定义)

x1 = sol(1);

x2 = sol(2);

x3 = sol(3);

%y1=y(1);

%y2=y(2);

y(1) = (x1-1)^2+(x2-2)^2+(x3-3)^2;

y(2) = x1^2+2*x2^2+3*x3^2;

②在命令窗口中输入.

[x, feval] = fgoalattain('fun', [1 1 1], [1 1], [1 1], [], [], [1 1 1], [6], [0 0 0], [])

③得到结果.

lower upper ineqlin ineqnonlin

2

x =

3.2727 1.6364 1.0909

feval =

8.9422 19.6364

例2.某钢铁公司因生产需要欲采购一批钢材,市面上的钢材有两种规格,第1种规格的单价为3500元/t ,第2种规格的单价为4000元/t.要求购买钢材的总费用不超过1000万元,够得钢材总量不少于2000t.问如何确定最好的采购方案,使购买钢材的总费用最小且购买的总量最多.

解:设采购第1、2种规格的钢材数量分别为和.根据题意建立如下多目标优化问题的数学模型.

1x 2x 0,2000

100000

40003500max 40003500)(min

212121211≥≥+≤++=x x x x x x x x x f ①建立M 文件. 在Matlab 编辑窗口中输入:

function y = fun(sol)

x1 = sol(1);

x2 = sol(2);

y = 3500*x1 + 4000*x2;

②在命令窗口中输入.

[x, feval] = fgoalattain('fun', [1 1],[1], [10000000], [3500 4000; -1 -1], [10000000; -2000], [], [], [0 0], []) %初始值的要求可以不严,但目标值关键,设置要贴近

Optimization terminated successfully:

Magnitude of directional derivative in search direction

less than 2*options.TolFun and maximum constraint violation

is less than options.TolCon

Active inequalities (to within options.TolCon = 1e-006):

lower upper ineqlin ineqnonlin

2 1

x =

1.0e+003 *

1.0000 1.0000

feval =

7.5000e+006

相关文档