流程图如下 目标函数和条件函数都给出来了 怎么使用matlab编程 求大神帮忙

如果缺少什么条件或者参数,可以提问啊


f = @(x) sum(x); % 目标函数
A=[-6,-4,-4,-2,-1,-1,0;0,-1,0,-2,-1,0,-1;0,0,-1,0,-1,-2,0]; % 线性约束
B = [-100,-100,-100];
lb=zeros(1,7); % 下限为0
ub=inf*ones(1,7); % 上限为无穷大
op = optimset('Algorithm','interior-point'); % 约束算法
x0 = 10*ones(1,7); % 假设初始值为每个变量都是10
[x,fval] = fmincon(f,x0,A,B,[],[],lb,ub,[],op) % 约束极值

Local minimum found that satisfies the constraints.

Optimization completed because the objective function is non-decreasing in 
feasible directions, to within the default value of the function tolerance,
and constraints were satisfied to within the default value of the constraint tolerance.

<stopping criteria details>


x =

    0.0000    0.0000    0.0000   33.3211   33.3579   33.3211    0.0000


fval =

  100.0000
温馨提示:答案为网友推荐,仅供参考
相似回答