0

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?

Abdo Salem
  • 55
  • 1
  • 8

1 Answers1

1

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);
}
halfer
  • 19,824
  • 17
  • 99
  • 186
Alex Fleischer
  • 9,276
  • 2
  • 12
  • 15
  • I need to represent a set of routes that will contribute in an array of possible what I need is {route} possible_routes[0..n]; – Abdo Salem Jul 23 '18 at 12:16
  • int n=2; tuple link{ string src; string dest; }; {link} possible_routes[0..n]=[{<"A","B">,<"B","C">,<"C","D">},{<"A","E">},{<"A","G">}]; execute { writeln(possible_routes); } – Alex Fleischer Jul 23 '18 at 13:43