Decision Optimization

Decision Optimization

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


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
Expand all | Collapse all

2 dimensions piece wise linear function

  • 1.  2 dimensions piece wise linear function

    Posted 01/17/20 10:55 AM

    Originally posted by: 88Simon88


    Hello everyone, 

     

    I want to write an OPL code to do the piecewise-linear function but I have two parameters. Please, take a look at the following example. I have N different curves and each curve is divided into 30 breakpoints. I appreciate it if could help me in this regard.

     

    int nbp = 30; // Number of Breakpoints
    int N = 20;
    range cell = 1..N;

     

    float mortality_slope[cell][1..nbp+1] = ...;
    dvar int x;

    pwlFunction Mortality = piecewise(j in cell,i in 1..nbp) 
    {mortality_slope[j][i] -> i; mortality_slope[j][nbp+1]}(0,0); 

     

    maximize Mortality(1,x);
    subject to
    {
        x == 35;
        true; 
    }

     

     

    Best regards.


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 2.  Re: 2 dimensions piece wise linear function

    Posted 01/17/20 01:10 PM

    Hi

    int nbp = 30; // Number of Breakpoints
    int N = 20;
    range cell = 1..N;

    float mortality_slope[i in cell][j in 1..nbp+1] = i+j;
    dvar int x;

    pwlFunction Mortality[i in cell] = piecewise (j in 1..nbp)
    {mortality_slope[i][j] -> j; mortality_slope[i][nbp+1]}(0,0);

     

    maximize Mortality[1](x);
    subject to
    {
        x == 35;
        true;
    }

    could help ?

     

    regards

     

    PS:

    https://www.linkedin.com/pulse/making-decision-optimization-simple-alex-fleischer/


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 3.  Re: 2 dimensions piece wise linear function

    Posted 01/17/20 04:22 PM

    Originally posted by: 88Simon88


    Thank you very much. You are perfect. 

     


    #DecisionOptimization
    #OPLusingCPLEXOptimizer