weixin_53318879
风起FQ
2021-06-05 05:57
采纳率: 73.3%
浏览 19

请教大佬,我这段代码哪里错了,为什么lingo会报错(invalid set name)?

model:
Title Location problem;
sets:
    supply/1..2/:x,y,e;
    demend/1..13/:a,b,d;
    link(supply,demand):c;
endsets
data:
a=0,30.43,52.64,82.61,134.79,68.15,103.03,89.90,60.8,9.00,41.66,15.21,25.09;
b=51.47,39.86,31.37,19.91,0,25.45,12.13,17.16,28.25,48.00,35.59,45.69,23.51;
d=171.9,720.1,594,722,744,648,466,633,1098,716,447,608,358;
e=200,200;
enddata
init:
x,y=30.43,-71.14,104.6,121.71;
endinit
min=@sum(link(i,j):c(i,j)*((x(i)-a(j))^2+(y(i)-b(j))^2)^(1/2));
@for(supply(i):@sum(demand(i):c(i,j))=e(j););
@for(demand(j):@sum(supply(i):c(i,j))=d(j););
@for(supply:@bnd(0,x,134.79);
@bnd(0,Y,51.47););
END

lingo上显示是link()函数报错

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

2条回答 默认 最新

  • SoftwareTeacher
    SoftwareTeacher 2021-06-06 13:05
    已采纳

    拼写错误? 你用了 

    demend 第五行; 

    demand 第六行.  

    点赞 评论
  • QA_Assistant
    有问必答小助手 2021-06-07 16:08

    您好,我是有问必答小助手,您的问题已经有小伙伴解答了,您看下是否解决,可以追评进行沟通哦~

    如果有您比较满意的答案 / 帮您提供解决思路的答案,可以点击【采纳】按钮,给回答的小伙伴一些鼓励哦~~

    ps:问答VIP仅需29元,即可享受5次/月 有问必答服务,了解详情>>>https://vip.csdn.net/askvip?utm_source=1146287632

    点赞 评论

相关推荐