麻烦帮忙看下程序:运行程序lingo程序,出现unexpected jacobian overflow
问题描述:
麻烦帮忙看下程序:运行程序lingo程序,出现unexpected jacobian overflow
model:
sets:
i/1,2,3,4/:a,b,s;
j/1,2/;
ij(j,i):x;
endsets
data:
a=0.65,0.5,0.56,0.68;
b=0.76,0.7,0.72,0.66;
s=640,850,530,720;
enddata
min=@sum(i(i):(1-a(i))^(x(1,i))+(1-b(i))^(x(2,i)));
0.75*@sum(i(i):s(i)*x(1,i))+(7/12)*@sum(i(i):s(i)*x(2,i))+100*@sum(ij(j,i):x(j,i))
答
你既然用i,j去定义集了,后面就不能用i,j去做下标,重复了导致出错.
下面是修改后的代码,有一些帮你简化了.
注:lingo默认变量时非负的.
model:
sets:
i/1,2,3,4/:a,b,s;
j/1,2/;
ij(j,i):x;
endsets
data:
a=0.65,0.5,0.56,0.68;
b=0.76,0.7,0.72,0.66;
s=640,850,530,720;
enddata
min=@sum(i(m):(1-a(m))^(x(1,m))+(1-b(m))^(x(2,m)));
0.75*@sum(i(m):s(m)*x(1,m))+(7/12)*@sum(i(m):s(m)*x(2,m))+100*@sum(ij(n,m):x(n,m))