我在使用lingo 9.0的时候,出现错误代码1017.还有Unexpected Jacobian overflow原程序如下model:sets:city/1..5/:u; link(city,city):distance,x;endsetsdata:distance=0 14 12 7 1014 0 9 13 5 12 9 0 6 8 7 13 6 0 1110 5 8 11 0;enddatan=@size(c
来源:学生作业帮助网 编辑:六六作业网 时间:2024/12/19 10:16:57
我在使用lingo 9.0的时候,出现错误代码1017.还有Unexpected Jacobian overflow原程序如下model:sets:city/1..5/:u; link(city,city):distance,x;endsetsdata:distance=0 14 12 7 1014 0 9 13 5 12 9 0 6 8 7 13 6 0 1110 5 8 11 0;enddatan=@size(c
我在使用lingo 9.0的时候,出现错误代码1017.还有Unexpected Jacobian overflow
原程序如下
model:
sets:
city/1..5/:u;
link(city,city):distance,x;
endsets
data:
distance=
0 14 12 7 10
14 0 9 13 5
12 9 0 6 8
7 13 6 0 11
10 5 8 11 0;
enddata
n=@size(city);
min=@sum(link:distance*x);
@for(city(k):
@sum(city(i)|i#ne#k:x(i,k))=1;
@sum(city(j)|j#ne#i:x(k,j))=1;
@for(city(j)|j#gt#1#and#j#ne#k:
u(j)>=u(k)+x(k,j)-(n-2)*(1-x(k,j))+(n-3)*x(j,k)););
@for(link:@bin(x));
@for(city(k)|k#gt#1:
u(k)=1+(n-2)*x(k,1););
end
我在使用lingo 9.0的时候,出现错误代码1017.还有Unexpected Jacobian overflow原程序如下model:sets:city/1..5/:u; link(city,city):distance,x;endsetsdata:distance=0 14 12 7 1014 0 9 13 5 12 9 0 6 8 7 13 6 0 1110 5 8 11 0;enddatan=@size(c
这样就对了 有一个指标的约束你把k写成i了
model:
sets:
city/1..5/:u;
link(city,city):distance,x;
endsets
data:
distance=
0 14 12 7 10
14 0 9 13 5
12 9 0 6 8
7 13 6 0 11
10 5 8 11 0;
enddata
n=@size(city);
min=@sum(link:distance*x);
@for(city(k):
@sum(city(i)|i#ne#k:x(i,k))=1;
@sum(city(j)|j#ne#k:x(k,j))=1;
@for(city(j)|j#gt#1#and#j#ne#k:
u(j)>=u(k)+x(k,j)-(n-2)*(1-x(k,j))+(n-3)*x(j,k)););
@for(link:@bin(x));
@for(city(k)|k#gt#1:
u(k)=1+(n-2)*x(k,1););
end