Hi,
starting from https://www.ibm.com/developerworks/community/forums/html/topic?id=c6fc1845-6679-4bb0-839b-9e455c09badf&ps=25
you could write
{string} s={“A”,”B”,”C”,”D”,”E”};
range r=1.. ftoi(pow(2,card(s)));
range rwithoutthelastone=1..ftoi(pow(2,card(s)))-1;
{string} s2 [k in rwithoutthelastone] = {i | i in s: ((k div (ftoi(pow(2,(ord(s,i))))) mod 2) == 1)};execute
{
writeln(s2);
}
that will give
[{“A”} {“B”} {“A” “B”} {“C”} {“A” “C”} {“B” “C”} {“A” “B” “C”} {“D”} {“A” “D”}
{“B” “D”} {“A” “B” “D”} {“C” “D”} {“A” “C” “D”} {“B” “C” “D”} {“A”
“B” “C” “D”} {“E”} {“A” “E”} {“B” “E”} {“A” “B” “E”} {“C” “E”} {“A”
“C” “E”} {“B” “C” “E”} {“A” “B” “C” “E”} {“D” “E”} {“A” “D” “E”} {“B”
“D” “E”} {“A” “B” “D” “E”} {“C” “D” “E”} {“A” “C” “D” “E”} {“B” “C”
“D” “E”} {“A” “B” “C” “D” “E”}]
This is part of
https://www.linkedin.com/pulse/how-opl-alex-fleischer/
For TSP you could have a look at
regards
Source: Re: The simplest way to define a powerset of S without the empty set?