Decision Optimization

Decision Optimization

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

 View Only
  • 1.  iterative solving OPL CPLEX

    Posted Fri January 11, 2019 03:40 PM

    Originally posted by: 88Simon88


    Hello everybody,

    I have a model as below. I want to read "Yield" parameter from "Y" matrix row by row and then solve it. How can I do it? Could you please provide me the code?

    Thanks a lot

     

     int N = 3;
     
     range crop = 1..N;
     
     float Yield[crop] = [2, 2.4, 16]; // Low
     
      float Y[1..3][crop] = [[3, 3.6, 24],
      [2.5, 3, 20],
      [2, 2.4, 16]];
     
     dvar float+ x[crop];   // land
     dvar float+ w[1..N+1]; // sold
     dvar float+ y[1..N-1]; // purchase
     
     minimize 150*x[1] + 230*x[2] + 260*x[3]
             + 238*y[1] - 170*w[1]
             + 210*y[2] - 150*w[2]
             - 36*w[3]  - 10*w[4]; 
             
     subject to
     {
      x[1] == 120;
      x[2] == 80;
      x[3] == 300;
     
      const1:
      sum(n in crop) x[n] <= 500;
     
      cost2:
      Yield[1]*x[1] + y[1] - w[1] >= 200;
     
      const3:
      Yield[2]*x[2] + y[2] - w[2] >= 240;
     
      const4:
      w[3] + w[4] <= Yield[3]*x[3]; 
     
      const5:
      w[3] <= 6000;
     }

    #CPLEXOptimizers
    #DecisionOptimization


  • 2.  Re: iterative solving OPL CPLEX

    Posted Mon January 14, 2019 06:17 AM

    This can be done using OPLScript. In each iteration you change the parameters and then regenerate the model. There should be examples for this in the opl/examples folder in your CPLEX distribution. If you have further questions/problems I suggest you ask this question in the OPL forum here.


    #CPLEXOptimizers
    #DecisionOptimization


  • 3.  Re: iterative solving OPL CPLEX

    Posted Mon January 14, 2019 09:40 AM

    Originally posted by: 88Simon88


    Thank you so much. I will ask it in another forum.


    #CPLEXOptimizers
    #DecisionOptimization