QQ登录

只需要一步,快速开始

 注册地址  找回密码
查看: 2140|回复: 2
打印 上一主题 下一主题

求高人相助LINGO 编程

[复制链接]
字体大小: 正常 放大

3

主题

4

听众

18

积分

升级  13.68%

  • TA的每日心情
    开心
    2012-2-8 20:27
  • 签到天数: 3 天

    [LV.2]偶尔看看I

    新人进步奖

    跳转到指定楼层
    1#
    发表于 2012-8-2 14:49 |只看该作者 |倒序浏览
    |招呼Ta 关注Ta
    5体力
    1. model:
    2. sets:
    3. product /1..7/:value,capacity;
    4. need /1..14/:demand;
    5. link(product,need):cost,number;
    6. endsets
    7. data:
    8. value=160 155 155 160 155 150 160;
    9. cost=  85.3        85.2        140        38        20.5        3.1        21.2   64.2        92        96        96        116.2        123        132
    10.         135.3        135.2        185        111        95.5        86        71.2   114.2        142        146        146        166.2        173        182
    11.         145.3        145.2        200        121        105.5        96        86.2   48.2        82        86        86        106.2        108        122
    12.         180.3        180.2        230        156        140.5        131        116.2   84.2        62        51        51        71.2        73        87
    13.         175.3        120.2        225        141        125.5        116        106.2   74.2        51        33        78        61.2        63        77
    14.         175.3        170.2        225        146        130.5        121        111.2   79.2        57        45        45        26.2        11        28
    15.         190.3        185.2        240        151        135.5        136        126.5   94.2        67        61        45        38.2        26        2;
    16. capacity=800 800 1000 2000 2000 2000 3000;
    17. demand=500 920 1130 1350 1650 2130 2810 3011 3216 3410 4016 4766 5067 5171;
    18. enddata
    19. !目标函数;
    20. min=@sum(link(i,j):cost(i,j)*number(i,j))+@sum(product(i):value(i)*@sum(need(j):number(i,j)));
    21. !number各行和要求

    22. @for(product(i)|i#eq#1:@sum(need(j):number(i,j))>=500;@sum(need(j):number(i,j))<=capacity(i));
    23. @for(product(i)|i#eq#2:@sum(need(j):number(i,j))>=500;@sum(need(j):number(i,j))<=capacity(i));
    24. @for(product(i)|i#eq#3:@sum(need(j):number(i,j))>=500;@sum(need(j):number(i,j))<=capacity(i));
    25. @for(product(i)|i#eq#4:@sum(need(j):number(i,j))>=500;@sum(need(j):number(i,j))<=capacity(i));
    26. @for(product(i)|i#eq#5:@sum(need(j):number(i,j))>=500;@sum(need(j):number(i,j))<=capacity(i));
    27. @for(product(i)|i#eq#6:@sum(need(j):number(i,j))>=500;@sum(need(j):number(i,j))<=capacity(i));
    28. @for(product(i)|i#eq#7:@sum(need(j):number(i,j))>=500;@sum(need(j):number(i,j))<=capacity(i));
    29. !number各列和要求
    30. @for(need(j)|j#eq#14:@sum(product(i):number(i,j))>=0; @sum(product(i):number(i,j))<=500);
    31. @for(need(j)|j#ge#13 #and# j#le#14:@sum(product(i):number(i,j))>=500; @sum(product(i):number(i,j))<=920);
    32. @for(need(j)|j#ge#12 #and# j#le#14:@sum(product(i):number(i,j))>=920; @sum(product(i):number(i,j))<=1130);
    33. @for(need(j)|j#ge#11 #and# j#le#14:@sum(product(i):number(i,j))>=1130; @sum(product(i):number(i,j))<=1350);
    34. @for(need(j)|j#ge#10 #and# j#le#14:@sum(product(i):number(i,j))>=1350; @sum(product(i):number(i,j))<=1650);
    35. @for(need(j)|j#ge#9  #and# j#le#14:@sum(product(i):number(i,j))>=1650; @sum(product(i):number(i,j))<=2130);
    36. @for(need(j)|j#ge#8  #and# j#le#14:@sum(product(i):number(i,j))>=2130; @sum(product(i):number(i,j))<=2810);
    37. @for(need(j)|j#ge#7  #and# j#le#14:@sum(product(i):number(i,j))>=2810; @sum(product(i):number(i,j))<=3011);
    38. @for(need(j)|j#ge#6  #and# j#le#14:@sum(product(i):number(i,j))>=3011; @sum(product(i):number(i,j))<=3216);
    39. @for(need(j)|j#ge#5  #and# j#le#14:@sum(product(i):number(i,j))>=3216; @sum(product(i):number(i,j))<=3410);
    40. @for(need(j)|j#ge#4  #and# j#le#14:@sum(product(i):number(i,j))>=3410; @sum(product(i):number(i,j))<=4016);
    41. @for(need(j)|j#ge#3  #and# j#le#14:@sum(product(i):number(i,j))>=4016; @sum(product(i):number(i,j))<=4766);
    42. @for(need(j)|j#ge#2  #and# j#le#14:@sum(product(i):number(i,j))>=4766; @sum(product(i):number(i,j))<=5067);
    43. @for(need(j)|j#ge#1  #and# j#le#14:@sum(product(i):number(i,j))>=5067; @sum(product(i):number(i,j))<=5171);
    44. !number中所有元素和要求
    45. @for(link(i,j):@sum(link(i,j):number(i,j))=5171);
    46. !number中的整数线性规划
    47. @for(link (i,j): @gin(number (i,j)));

    48. end
    复制代码


    程序结果是找不到可行解,是编程出错了吧~~~求高人指教,高人啊高人
    是不是这里三句有错:(1)@for(link(i,j):@sum(link(i,j):number(i,j))=5171);本意是求所有元素和
    (2)@sum(product(i):value(i)*@sum(need(j):number(i,j));本意是求(value(i)*((i)行的和))的(i)从1到7的和
    (3)写各列和的意思是(第3列列和+第4列列和+……第14列列和)的总和大于小于某值

    zan
    转播转播0 分享淘帖0 分享分享0 收藏收藏0 支持支持0 反对反对0 微信微信

    3

    主题

    4

    听众

    18

    积分

    升级  13.68%

  • TA的每日心情
    开心
    2012-2-8 20:27
  • 签到天数: 3 天

    [LV.2]偶尔看看I

    新人进步奖

    回复

    使用道具 举报

    32

    主题

    50

    听众

    2949

    积分

  • TA的每日心情
    慵懒
    2024-7-11 11:07
  • 签到天数: 543 天

    [LV.9]以坛为家II

    社区QQ达人 邮箱绑定达人 发帖功臣 新人进步奖 风雨历程奖 最具活力勋章

    群组小草的客厅

    群组数学建模认证项目实训

    群组我们一定会赢

    群组哈尔滨工业大学建模团

    群组聊天

    lutianzhou001 发表于 2012-8-2 16:37
    问题得到解决了,谢谢大家~

    怎么解决的啊?跟大家分享一下吧
    回复

    使用道具 举报

    您需要登录后才可以回帖 登录 | 注册地址

    qq
    收缩
    • 电话咨询

    • 04714969085
    fastpost

    关于我们| 联系我们| 诚征英才| 对外合作| 产品服务| QQ

    手机版|Archiver| |繁體中文 手机客户端  

    蒙公网安备 15010502000194号

    Powered by Discuz! X2.5   © 2001-2013 数学建模网-数学中国 ( 蒙ICP备14002410号-3 蒙BBS备-0002号 )     论坛法律顾问:王兆丰

    GMT+8, 2025-7-27 12:12 , Processed in 1.471689 second(s), 65 queries .

    回顶部