Abdo Salem
Abdo Salem

Reputation: 55

Define nested set in OPL

I need to define a set of tuples that are composed of a set of tuples

tuple link{
   string src;
   string dest;
};
tuple route{
   {link} links
};
{route} possible_routes;

Another way that can represent my problem is a set of set (a set of sets of links). The only trial that was a success is defining a set of tuples that have a set of strings each, but I need to extend that to a set of tuples. Is that possible in OPL?

Upvotes: 0

Views: 329

Answers (1)

Alex Fleischer
Alex Fleischer

Reputation: 10062

Within an OPL tuple you may only use arrays of int. But you could write

tuple link{
   string src;
   string dest;
};

{link} possible_routes[1..2]=[{<"A","B">,<"B","C">,<"C","D">},{<"A","E">}];

execute
{
writeln(possible_routes);
}

Upvotes: 1

Related Questions