Originally posted by: ikucukkoc
Hello again. I have another question about filtering.
Regarding the code in your answer:
{task} TaskTimes2 = {<e.h,e.j,e.i,e.x,5*e.pt> | e in TaskTimes};
What about if it is subject to a condition. For example I have a tuple like:
TaskTimes = {
<1 A 1 L 3>,
<1 A 2 R 3>,
<1 A 3 E 0>,
<2 A 4 L 2>,
<2 A 5 E 1>,
};
And I want to obtain following tuple:
TaskTimes = {
<1 A 1 L 15>,
<1 A 2 R 15>,
<1 A 3 E 0>,
<2 A 4 L 6>,
<2 A 5 E 3>,
};
I want to multiply the "pt" column with "5" if "h=1"; multiply with "3" if "h=2".
I can do that using for and if loops but it is not good for large sized tuples in terms of computation time. I am sure that there should be an easier way.
Appreciate for your help egain.
Kind Regards.
#DecisionOptimization#OPLusingCPLEXOptimizer