lingo 整数规划
问题描述:
lingo 整数规划
model:
sets:
P/1,2/;
Q/1..6/:a,b,d;
R(P,Q):c,z;
endsets
data:
a=1.25 8.75 0.5 5.75 3 7.25;
b=1.25 0.75 4.75 5 6.5 7.75;
d=3 5 4 7 6 11;
@text('D:\Program Files\out.txt')=R'数据'z;
enddata
min=@sum(R(i,j):c(i,j)*z(i,j));
@for(Q(j):z(1,j)=(@sum(Q(j):(5-a(j))^2+(1-b(j))^2))^(1/2));
@for(Q(j):z(2,j)=(@sum(Q(j):(2-a(j))^2+(7-b(j))^2))^(1/2));
@for(P(i):@sum(Q(j):c(i,j))
答
只需把@gin(R(i,j):z(i,j)));改为:@for(R:@gin(z));即可