Decision Optimization

Decision Optimization

Delivers prescriptive analytics capabilities and decision intelligence to improve decision-making.


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
  • 1.  How to Filter Tuples Conditionally?

    Posted 11/13/13 06:08 AM

    Originally posted by: ikucukkoc


    Hello. I have a question about conditional filtering in tuples. 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 timeI am sure that there should be an easier way.

     

    Appreciate for your help in advance.

     

    Kind Regards.

     


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 2.  Re: How to Filter Tuples Conditionally?

    Posted 11/13/13 10:08 AM

    {task} TaskTimes2 = {<e.h,e.j,e.i,e.x,((e.h==2)?(5*e.pt):(3*e.pt))> | e in TaskTimes};


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 3.  Re: How to Filter Tuples Conditionally?

    Posted 11/13/13 10:15 AM

    Originally posted by: ikucukkoc


    Very helpful. Many thanks!


    #DecisionOptimization
    #OPLusingCPLEXOptimizer