Delivers prescriptive analytics capabilities and decision intelligence to improve decision-making.
Originally posted by: özgür_ak
int n=5; {int} s= {2,1,5}; int x[1..n]=[maxl(1,i): i | i in s];
execute {writeln(x);}
gives out [1 2 0 0 5]
Can anyone explain to me how it does this?
Hi,
in order to explain, I wrote a loop that does exactly the same:
int n=5; {int} s= {2,1,5}; int x[1..n]=[maxl(1,i): i | i in s]; int x2[1..n]; execute in_order_to_explain { for(var i in s) x2[Opl.maxl(1,i)]=i; } execute {writeln(x);} assert forall(i in 1..n) x[i]==x2[i];
int n=5; {int} s= {2,1,5}; int x[1..n]=[maxl(1,i): i | i in s]; int x2[1..n];
execute in_order_to_explain { for(var i in s) x2[Opl.maxl(1,i)]=i; }
assert forall(i in 1..n) x[i]==x2[i];
regards
https://www.linkedin.com/pulse/optimizasyon-nedir-ve-daha-az%C4%B1yla-fazla-%C5%9Fey-yapman%C4%B1za-alex-fleischer/
Thanks for your help. Now it is clear :)