model:
sets:
week/1..5/;
stu/1..6/:pay;
link(stu,week):cap,T,X;
endsets
data:
cap=
6 0 6 0 7
0 6 0 6 0
4 8 3 0 5
5 5 6 0 4
3 0 4 8 0
0 6 0 6 3;
pay=10 10 9.9 9.8 10 11.3;
enddata
min=@sum(link(i,j):T(i,j)*X(i,j)*pay(i));
!工作约束条件;
@for(link:@bin(X));
!每天时间满足14小时;
@for(week(j):
@sum(link(i,j):T(i,j)*X(i,j))=14);
!本科生工作时间不少于8小时;
@for( stu(i)|i#lt#5:
@sum(link(i,j):T(i,j)*X(i,j))>=8);
!研究生工作时间不少于7小时;
@for( stu(i)|i#ge#5:
@sum(link(i,j):T(i,j)*X(i,j))>=7);
!每天安排的人不超过3人;
@for(week(j):
@sum(link(i,j):X(i,j))<=3);
!每周值班次数不超过3次;
@for(stu(i):
@sum(link(i,j):X(i,j))<=3);
!每次最大工作时间限制;
@for(link(i,j):T(i,j)<=cap(i,j));
@for(link(i,j):T(i,j)>=0);
!每天至少一名研究生;
@for(week(j):
@sum(link(i,j)|i#ge#5:X(i,j))>=1);
!每次工作最少2个小时;
!@for(link(i,j):T(i,j)*X(i,j)>=2);
Local optimal solution found.
Objective value: 705.6000
Objective bound: 705.6000
Infeasibilities: 0.6825536E-08
Extended solver steps: 34
Total solver iterations: 3635
Model Class: MINLP
Total variables: 60
Nonlinear variables: 60
Integer variables: 30
Total constraints: 88
Nonlinear constraints: 12
Total nonzeros: 310
Nonlinear nonzeros: 180
温馨提示:内容为网友见解,仅供参考