Decision Optimization

Decision Optimization

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


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
  • 1.  Is there an absolute value function for main blocks?

    Posted 04/04/12 03:15 PM

    Originally posted by: SystemAdmin


    Here is my problem:

    I want to pass the solution value of a dvar (x) in my sub-problem to a parameter (x_bound) in my master-problem.
    masterData.x_bound = subOpl.x.solutionValue;
    

    Although x is defined to be non-negative, often the sub-problem returns a few x<0.
    Is there a way to avoid this OR change negative values in x to zero OR use an absolute value function on subOpl.x.solutionValue.

    The function abs(.) as in:
    abs(subOpl.x.solutionValue)
    

    is only defined for OPL scripts and not for main blocks.
    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 2.  Re: Is there an absolute value function for main blocks?

    Posted 04/04/12 03:23 PM

    Originally posted by: SystemAdmin


    One work-around is to use abs(.) in my master-problem definition.
    // replace all mentions of x_bound with:
    abs(x_bound)
    

    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 3.  Re: Is there an absolute value function for main blocks?

    Posted 04/05/12 02:40 AM
    Hi,

    let me give you 2 ways:

    main
    {
     var a=-2;
     writeln(Opl.abs(a));
     writeln(Math.abs(a));
      
    }
    


    Regards
    #DecisionOptimization
    #OPLusingCPLEXOptimizer