Decision Optimization

Decision Optimization

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


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
  • 1.  Convert negatives values to 0

    Posted 12/09/12 05:52 PM

    Originally posted by: SystemAdmin


    Hey

    I don't have a lot of experience using OPC CPLEX. I've just started to use it in the university few months ago. I'm duing an exercise and I need some help.

    I have this vector: int RetrasosBultos with negative and positives values. And I want to convert the negatives values to 0.

    How can I do that? I supose it must be easy, but I don`t know...

    Thanks
    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 2.  Re: Convert negatives values to 0

    Posted 12/11/12 08:47 AM

    Originally posted by: SystemAdmin


    Say that you have:

    int a[i in I] = ...
    


    then you could convert the negative values to 0 using the one line if syntax:

    int b[i in I] = a[i] > 0 ? a[i] : 0;
    


    The meaning of the instruction is simply: "if a[i] is greater than 0 then b[i] = a[i] else b[i] = 0".

    Regards,
    Stefano
    #DecisionOptimization
    #OPLusingCPLEXOptimizer