Decision Optimization

Decision Optimization

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


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
  • 1.  About 0-1 parameter

    Posted 09/18/20 04:45 AM

    I have a model:

    int I=5;

    int J=5;

    int L=2;

    int omiga=100;

    int f[1..L]=[7,7];

    int M[1..L]=[5,2];

    int q11[1..I][1..J]=[[0,24000,15000,31000,11000],

    [0,0,18000,20500,13000],

    [0,0,0,25000,23500],

    [0,0,0,0,11000],

    [0,0,0,0,0]];

    float t[1..I][1..J][1..L]=[[[0,6.22,10.37,13.48,15.56],

    [0,0,4.15,7.26,9.33],

    [0,0,0,3.11,5.19],

    [0,0,0,0,2.08],

    [0,0,0,0,0]],

    [[0,5,13,19,22],

    [0,0,8,11,17],

    [0,0,0,7,9],

    [0,0,0,0,2],

    [0,0,0,0,0]]];

    float gt[1..I][1..J][1..L]=[[[0,1,1,1,1],

    [0,0,1,1,1],

    [0,0,0,1,1],

    [0,0,0,0,1],

    [0,0,0,0,0]],

    [[0,1,1,1,1],

    [0,0,1,1,1],

    [0,0,0,1,1],

    [0,0,0,0,1],

    [0,0,0,0,0]]];

    dvar float q[1..I][1..J][1..L];

    minimize sum(i in 1..I,j in 1..J,l in 1..L)(gt[i][j][l]*(omiga/(2*f[l])+omiga*t[i][j][l])*q[i][j][l]

    -gt[i][j][l]*M[l]*q[i][j][l]);

    subject to{

    forall(i in 1..I,j in 1..J)sum(l in 1..L)q[i][j][l]==q11[i][j];

    }

    In my original model,gt[1..I][1..J][1..L]=sgn(t[1..I][1..J][1..L]).

    The function sgn(x):

    if x>0,sgn(x)=1;if x=0,sgn(x)=0;if x<0,sgn(x)=-1.

    And I think this model is a linear model,because the gt[1..I][1..J][1..L]

    is a parameter,I can calculate it through sgn(t[1..I][1..J][1..L]) in advance.

    So gt[1..I][1..J][1..L] is a 0-1 matrix,not a decision variable.

    But when I run this model,it shows that the gt[1..I][1..J][1..L] is wrong.

    I don't konw why.Can someone help me.

    Thank you verymuch.






    #DecisionOptimization
    #Support
    #SupportMigration


  • 2.  RE: About 0-1 parameter

    Posted 09/21/20 11:07 AM

    Dear 201830610051,

    When running your model with oplrun using CPLEX Studio 12.9 I get:

    <<< setup

    *** ERROR[GENERATE_136] at 43:28-61:14 model.mod: Size mismatch between maps: "gt(1)(1)" with size 2 and "" with size 5.

    *** ERROR[GENERATE_209] at 43:28-61:14 model.mod: Invalid initialization expression for element "gt".

    *** ERROR[GENERATE_210] at 65:45-47 model.mod: Element "gt" is not available, see previous error(s).

    <<< generate

    Which indicates a problem with the way the 'gt' array is initialized. There clearly is a mismatch between index order and the initialization.

    Cheers,






    #DecisionOptimization
    #Support
    #SupportMigration