求懂lingo的大佬​帮忙简洁一下程序,让​代码更少点。

SETS:
M/1..5/:;
N/1..4/:;
link1(N,M):x,y;
ENDSETS
DATA:
!价格;
y=10.8,10.95,11.1,11.25,0,100,11.1,11.25,11.4,0,100,100,11,11.15,0,100,100,100,11.3,0;
ENDDATA
MIN = @SUM(link1(i,j):x(i,j)*y(i,j));
!交货量;
x(1,1)+x(2,1)+x(3,1)+x(4,1)=10;
x(1,2)+x(2,2)+x(3,2)+x(4,2)=15;
x(1,3)+x(2,3)+x(3,3)+x(4,3)=25;
x(1,4)+x(2,4)+x(3,4)+x(4,4)=20;
!生产能力;
x(1,1)+x(1,2)+x(1,3)+x(1,4)+x(1,5)<=35;
x(2,1)+x(2,2)+x(2,3)+x(2,4)+x(2,5)<=35;
x(3,1)+x(3,2)+x(3,3)+x(3,4)+x(3,5)<=30;
x(4,1)+x(4,2)+x(4,3)+x(4,4)+x(4,5)<=10;
@GIN(x(1,1));
@GIN(x(1,2));
@GIN(x(1,3));
@GIN(x(1,4));
@GIN(x(1,5));
@GIN(x(2,1));
@GIN(x(2,2));
@GIN(x(2,3));
@GIN(x(2,4));
@GIN(x(2,5));
@GIN(x(3,1));
@GIN(x(3,2));
@GIN(x(3,3));
@GIN(x(3,4));
@GIN(x(3,5));
@GIN(x(4,1));
@GIN(x(4,2));
@GIN(x(4,3));
@GIN(x(4,4));
@GIN(x(4,5));

 Réponse acceptée

knwgkb
knwgkb le 21 Mai 2023

0 votes

参考下:
SETS:
M/1..5/:;
N/1..4/:;
link1(N,M):x,y;
link2(N):v,p;
ENDSETS
DATA:
!价格;
y=10.8,10.95,11.1,11.25,0,100,11.1,11.25,11.4,0,100,100,11,11.15,0,100,100,100,11.3,0;
v=10,15,25,20;
p=35,35,20,10;
ENDDATA
MIN = @SUM(link1(i,j):x(i,j)*y(i,j));
!交货量;
@for(link2(i):@sum(link2(j):x(j,i))=v(i));
!生产能力;
@for(link2(i):@sum(link1(i,j):x(i,j))<p(i));
@for(link1(i,j):@GIN(x(i,j)));

Plus de réponses (0)

Catégories

En savoir plus sur 傅里叶分析和滤波 dans Centre d'aide et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!