运动员指派问题

来源:互联网 发布:win10装mac os双系统 编辑:程序博客网 时间:2024/04/28 23:42

用lingo解决“运动员指派问题”,代码如下:

--------------------------------------------------------------------------------------------------------------

model:
!运动员指派问题;
!5 persons and 4 jobs Assignment Problem;
sets:
 Person /1..5/;
 Job /1..4/;
 Assign(Person,Job): c,x;
endsets

!Here are the parameters;
data:
    c= 66.8 75.6 87   58.6
       57.2 66   66.4 53
       78   67.8 84.6 59.4
       70   74.2 69.6 57.2
       67.4 71   83.8 63.4;
enddata
!The objective;
[OBJ] min=@sum(Assign: c*x);
!The supply constraints;
@for(Person(i): [SUP]
  @sum(Job(j): x(i,j))<=1);
!The demand constraints;
@for(Job(j): [DEM]
  @sum(Person(i): x(i,j))=1);
end

--------------------------------------------------------------------------------------------------------------

结果如下:

解释如下:

  即甲游自由泳、乙游蝶泳、丙游仰泳、丁游蛙泳,戊没有被选上,平均成绩为253秒=

4’13’’2(4分13秒)

 

 

0 0
原创粉丝点击