简体   繁体   English

如何在 CPLEX 中编写索引关系?

[英]How can I write relationship for indices in CPLEX?

I am stucking at this stage.我坚持在这个阶段。

  • U[t][i][v] is the quantity picked up at node i by vehicle v at period t (decision variable) U[t][i][v] 是车辆 v 在节点 i 在时间段 t 拾取的数量(决策变量)
  • QT[t][p][m][w] is the quantity of product p produced in manufacturer m in time period t (decision variable) enter image description here QT[t][p][m][w] 是制造商 m 在时间段 t 生产的产品 p 的数量(决策变量) enter image description here

How can I write this constraint with a correspodence among i, p, and m?我怎样才能用 i、p 和 m 之间的对应关系来写这个约束? Note that we have 4 pick-up node, 2 manufacturers, and 2 products so <i,m,p> must be 1 of these <1,1,1>, <2,2,1>, <3,1,2>, <4,2,2> Thank you for your help请注意,我们有 4 个拾取节点、2 个制造商和 2 个产品,因此 <i,m,p> 必须是 <1,1,1>、<2,2,1>、<3,1、 2>, <4,2,2> 谢谢你的帮助

You could start with你可以从

range PN=1..4;

range P=1..2;
range M=1..2;

range T=1..3;
range V=1..4;
range W=1..2;

tuple pm
{
  int p;
  int m;
}

pm pms[PN]=[<1,1>,<1,2>,<2,1>,<2,2>];

dvar float U[T][PN][V];
dvar float+ QT[T][P][M][W]; 
subject to
{
  forall(i in PN,t in T)
    sum(v in V) U[t][i][v]==sum(w in W)QT[t][pms[i].p][pms[i].m][w];
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM