微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

关于不使用某些决策变量的 CPLEX 警告

如何解决关于不使用某些决策变量的 CPLEX 警告

我想用 MIP 解决一个灵活的作业车间调度问题。在我的例子中,有两个作业,三台机器,每个作业有三个操作,以及它们的处理时间。当我运行配置时,出现此警告:决策变量 z、v 和 c 未用于某些值。目标函数的值应该是17,但是这个模型的结果显示为2。

这是我写的代码和数据;有一些问题我不知道如何解决。你能帮我找出我做错了什么吗?谢谢!

int nbJobs=...;
int nbMchs=...;
int ops2=...;  // index of operations,each job has three operations

range Jobs = 1..nbJobs;
range Mchs = 1..nbMchs; 
range opss = 1..ops2;

tuple operationInfo{
    int jobID;
    int pos; // j-th operation of job i
    {int} mch; // candidate machine ID for this job
    {int} pt_set;
};

{operationInfo} OpsInfo =...;

tuple jointMchs{
  int jobID;
  int pos;
  int jobID2;
  int pos2;
  {int} mch;
} 
 {jointMchs} jm =...;  // operation j of job i and operation operation g of job h performed on machine k
int M=...;
int pTime[Jobs][opss][Mchs]=...;

dvar int+ cmax; //makespan
dvar float+ s[Jobs][opss][Mchs]; //starting time of operation j of job i on machine k
dvar float+ c[Jobs][opss][Mchs]; //completion time of operation j of job i on machine k
dvar float+ c2[Jobs];            //completion time of job i
dvar boolean z[Jobs][opss][Jobs][opss][Mchs]; //1; if (op j of job i) precedes operation  (op g of job h) on machine k otherwise 0
dvar boolean v[Jobs][opss][Mchs];  // 1 ; if operation j of job i performed on machine k otherwise 0


minimize cmax;
subject to{
 constraint1: forall(i in OpsInfo,o in Jobs: i.jobID==o) 
    cmax>=c2[o]; 
constraint2:  forall(o in OpsInfo,j in opss,i in Jobs: o.pos==j && j==3 && o.jobID==i)
    c2[i]>=sum(k in o.mch) c[i][j][k];
constraint3: forall(o in OpsInfo,k in Mchs,i in Jobs: k in o.mch && o.pos==j && o.jobID==i)
       s[i][j][k]+c[i][j][k]<=v[i][j][k]*M; 
constraint4:     forall(o in OpsInfo,i in Jobs: k in o.mch && o.pos==j && o.jobID==i)
       c[i][j][k] >= s[i][j][k]+pTime[i][j][k]-(1-v[i][j][k])*M;
constraint5:forall(o in jm,i in Jobs,h in Jobs,g in opss,k in Mchs: o.jobID==i && o.jobID2==h && i <= h && k in o.mch && o.pos==j && o.pos2==g )
       s[i][j][k] <= (c[h][g][k]-(z[i][j][h][g][k])*M);
constraint6:forall(o in jm,k in Mchs: o.jobID==i && o.jobID2==h && i <= h && k in o.mch && o.pos==j && o.pos2==g )
   s[h][g][k] >= c[i][j][k]-(1-(z[i][j][h][g][k]))*M;
constraint7:     forall(i in OpsInfo) forall(o in OpsInfo,j in opss: o.pos==j && j >= 2)
    sum(k in o.mch) s[i.jobID][j][k] >= sum(k in o.mch) c[i.jobID][j-1][k];
constraint8:  forall(o in OpsInfo,i in Jobs: o.pos==j && o.jobID==i)
         sum(k in o.mch) v[i][j][k]==1;
}


description for constraints:

//constraint1 determines the makespan
//constraint2 determines the completion times of the final operation of jobs.
//constraint3 set the starting and completion times of it on machine k equal to zero if operation j  of job i is not assigned to machine k.
//constraint4 guarantee that the difference between the starting and the completion times is equal in the least to the processing time on machine k
//constraint5 and constraint6 ensure that operation j of job i and operation h of job g cannot be processed at the same time on machine k
// on any machine  in the set intersection of Mij and Mhg. We showed intersection of Mj and Mhg with jointMchs tuple.
//constraint7 ensures that the operation j of job i is not started before the operation operation (j-1) of job i has been completed.
//constraint8 ensures that an operation is performed on one and only one machine.

数据:

nbJobs = 2;
nbMchs = 3;
ops2 = 3;

pTime=[ [[2,5,8],[5,4,7],[2,999,999]],[[10,11,10],[6,999],6]]];
// joint machine
 jm ={
<1,1,2,{1,3}>,<1,3,{1}>,2}>,<2,{1}>
};    

OpsInfo ={
<1,3},{2,8}>,{5,7}>,{1},{2}>,{10,10}>,2},{6,5}>,6}>
};
M=9999;

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。