通过Tuple Cplex迭代

时间:2018-06-19 09:52:47

标签: tuples cplex

我有一个元组:

`tuple Torder{
    string part;
    int period;
}
{Torder} order = {<i, h> | i in part, h in period};`

然后:

{string} operation = ...;

我试图创建一个新的元组:

string step[k in operation] = k;

tuple Twip
{
    Torder order;
    string operation;
}

{Twip} status = {<<i, h>, o> | <i, h> in order, k in operation, o in 1.. step[k]};

但代码o in 1.. step[k]输出

  

操作不是整数

1 个答案:

答案 0 :(得分:1)

让我帮助您解决语法问题。

tuple Torder{
    string part;
    int period;
}

range period=1..2;
{string} part={"A","B"};
{Torder} order = {<i, h> | i in part, h in period};

{string} operation = {"Y","Z"};

string step[k in operation] = k;

{string} steps=union (k in operation) {step[k]};

tuple Twip
{
    Torder order;
    string operation;
}

{Twip} status = {<<i, h>, o> | <i, h> in order, k in operation, o in steps: ord(steps,o) <= ord(operation,k)};

execute
{
status;
}

工作正常

问候