Initialize tuple with set in IBM CPLEX Automation Studio

266 Views Asked by At

I have the following variables:

tuple subtour 
{
    int         size;
    {int}       customers;
};
  
{subtour} S;

Now I want to create a new subtour with OPL script and add it to S. I know that I can create a new subtour with S.add(), but what do I have to put in the braces to create a new set of customers when adding the subtour? I already tried something like S.add(5, new Array(1,5,6)) without success.

1

There are 1 best solutions below

0
On BEST ANSWER
tuple subtour 
{
    int         size;
    {int}       customers;
};
  
{subtour} S;
{int} emptysubset;

execute
{
  S.add(1,emptysubset);
  Opl.first(S).customers.add(1);
  Opl.first(S).customers.add(5);
  Opl.first(S).customers.add(6);
  writeln(S);
}

gives

{<1 {1 5 6}>}