一个关于线性规划linprog的问题。

L1=64;L2=85;L=1200;
n1=0:18;n2=zeros(size(n1));rem=n2;
for i=1:19
    n2(i)=fix((L-n1(i)*L1)/L2);
    rem(i)=L-n1(i)*L1-n2(i)*L2;
end
f1=ones(size(n1));
Aeq=[n1
    n2];
beq=[1000;1500];
lb=zeros(size(n1));
intcon=1:19;
[x1,fval1]=intlinprog(f1,intcon,[],[],Aeq,beq,lb,[],[]);
f2=rem;
[x2,fval2]=intlinprog(f2,intcon,[],[],Aeq,beq,lb,[],[]);
X=[x1,fval1,x2,fval2];
为什么运行之后会一直出结果,第一次用这个,表示不是很懂

 Respuesta aceptada

nuruma
nuruma el 28 de Oct. de 2022

0 votos

前面加一句:
options = optimoptions('intlinprog','MaxTime',1,'Display','final');
两个intlinprog语句修改:
[x1,fval1]=intlinprog(f1,intcon,[],[],Aeq,beq,lb,[],options)

Más respuestas (0)

Categorías

Etiquetas

Preguntada:

el 28 de Oct. de 2022

Respondida:

el 28 de Oct. de 2022

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!