我想调用一个参数属于另一个参数的Cplex变量:
{string} part = ...; // job indexed by n or p
tuple Tpart
{
int Demand;
int Lotsize;
int Maxsublots;
}
Tpart partCriteria[part] = ...;
然后我创建一个变量jobC
,它们分别属于part
和partCriteria[part].Maxsublots
但不正确
dvar float+ jobC[i in part, 1..partCriteria[part].Maxsublots];
答案 0 :(得分:0)
OPL数组的尺寸不能取决于先前的尺寸。
你可以写
{string} part = {"A","B"}; // job indexed by n or p
tuple Tpart
{
int Demand;
int Lotsize;
int Maxsublots;
}
Tpart partCriteria[part] = [<1,1,1>,<2,2,2>];
int maxsublots=max(i in part) partCriteria[i].Maxsublots;
dvar float+ jobC[i in part, j in 1..maxsublots];
subject to
{
}
致谢