lingo问题,求把等式转化为lingo表达式
发布网友
发布时间:2022-04-25 12:59
我来回答
共1个回答
热心网友
时间:2024-10-29 17:43
这是指派问题,7个人5项任务,要求用最少的时间完成。
设xij=1为第i人完成第j项任务,否则xij=0.
建立数学模型为:
min 求和(i=1..7,j=1..5) t(i,j)*x(i,j)
s.t. 横向求和<=1
纵向求和=1
xij=0,1
程序为:
model:
sets:
rows/a b c d e f g/;
cols/1..5/;
time(rows,cols):t,x;
endsets
min=@sum(time:t*x);
@for(rows(i):@sum(cols(j):x(i,j))<=1);
@for(cols(j):@sum(rows(i):x(i,j))=1);
@for(time:@bin(x));
data:
t=2 15 13 1 8
10 4 14 15 7
9 14 16 13 8
7 8 11 9 4
8 4 15 8 6
12 4 6 8 13
5 16 8 5 10;
enddata
结果是:
Global optimal solution found.
Objective value: 20.00000
Objective bound: 20.00000
Infeasibilities: 0.000000
Extended solver steps: 0
Total solver iterations: 0
Variable Value Reduced Cost
X( A, 4) 1.000000 1.000000
X( B, 2) 1.000000 4.000000
X( D, 5) 1.000000 4.000000
X( F, 3) 1.000000 6.000000
X( G, 1) 1.000000 5.000000
热心网友
时间:2024-10-29 17:51
这是指派问题,7个人5项任务,要求用最少的时间完成。
设xij=1为第i人完成第j项任务,否则xij=0.
建立数学模型为:
min 求和(i=1..7,j=1..5) t(i,j)*x(i,j)
s.t. 横向求和<=1
纵向求和=1
xij=0,1
程序为:
model:
sets:
rows/a b c d e f g/;
cols/1..5/;
time(rows,cols):t,x;
endsets
min=@sum(time:t*x);
@for(rows(i):@sum(cols(j):x(i,j))<=1);
@for(cols(j):@sum(rows(i):x(i,j))=1);
@for(time:@bin(x));
data:
t=2 15 13 1 8
10 4 14 15 7
9 14 16 13 8
7 8 11 9 4
8 4 15 8 6
12 4 6 8 13
5 16 8 5 10;
enddata
结果是:
Global optimal solution found.
Objective value: 20.00000
Objective bound: 20.00000
Infeasibilities: 0.000000
Extended solver steps: 0
Total solver iterations: 0
Variable Value Reduced Cost
X( A, 4) 1.000000 1.000000
X( B, 2) 1.000000 4.000000
X( D, 5) 1.000000 4.000000
X( F, 3) 1.000000 6.000000
X( G, 1) 1.000000 5.000000