Decision Optimization

 View Only
Expand all | Collapse all

query about Data Item unexpected error

  • 1.  query about Data Item unexpected error

    Posted Thu April 01, 2021 04:16 PM
    Dear Altruist,
    I'm using  IBM CPLEX for the cost optimization modeling of a multi echelon supply chain design network . 
    My modeling code is like as below -

    //indices

    {string} Components = ...; //u


    {string}Suppliers = ...; //j


    {string} Assemblers =...; //k


    {string} Periods =...;//t


    //Parameters

    float FixCost[Components]=...;
    int Distance[Suppliers][Assemblers]=...;
    float HoldCost[Components][Assemblers]=...;
    float Capacity [Components][Suppliers]=...;
    int MaxHold [Components][Assemblers][Periods]=...;
    int SetCost[Suppliers]=...;
    float SellingPrice[Components][Suppliers]=...;
    int InvComp [Components][Assemblers][Periods];
    int OrderComp[Components][Suppliers][Assemblers];

    // decision variables
    //dvar float InvComp [Components][Assemblers][Periods];
    //dvar float OrderComp[Components][Suppliers][Assemblers][Periods];

    dvar boolean y [Suppliers][Assemblers][Periods];

    // Objective Function

    dexpr float TotalCost = sum(t in Periods, j in Suppliers , k in Assemblers, u in Components)FixCost[u]*Distance[j][k]*OrderComp[u][j][k]
    + sum(t in Periods,k in Assemblers,u in Components)HoldCost[u][k]*InvComp[u][k][t]
    + sum(t in Periods,k in Assemblers,j in Suppliers)SetCost[j]*y[j][k][t]
    + sum(t in Periods,k in Assemblers, j in Suppliers, u in Components)SellingPrice[u][j]*OrderComp[u][j][k];

    minimize TotalCost;
    subject to{

    forall(u in Components,k in Assemblers,t in Periods)
    InvComp[u][k][t] <= MaxHold[u][k][t];

    forall (u in Components,j in Suppliers,t in Periods)
    sum(k in Assemblers)OrderComp[u][j][k] <= Capacity[u][j] ;
    }

    My dat file is like -



    Components = {First Second Third}; //u
    Suppliers = {First Second Third}; //j
    Assemblers ={First Second Third}; //k
    Periods = {First Second Third}; //t

    FixCost = [0.06 ,0.08, 0.09]; //DelU
    Distance = [[40, 35, 25],
    [50, 60, 40],
    [45, 45, 30]]; //CC_jk

    //OrderComp= [[300, 200, 100, 115, 150, 160, 150, 145, 140],
    //[120, 130, 140, 110 ,125, 135, 130, 145, 160],
    // [160, 150, 110, 140, 135, 160, 115, 120, 135]]; //Z_ujkt

    HoldCost = [ [1, 1.5, 2],[ 2, 2, 2.5], [1, 1, 2]]; // hu_uk

    //InvComp= [[300, 200, 100, 115, 150, 160, 150, 145, 140],
    //[120, 130, 140, 110, 125, 135, 130, 145, 160],
    //[160, 150, 110, 140, 135, 160, 115, 120, 135]]; // IU_ukt

    SetCost = [ 100, 200, 150]; //O_j

    SellingPrice = [[10, 30, 18]
    [15, 35, 20],
    [20, 25, 15]]; // S_uj

    Capacity = [[1000,1500,4000],
    [2000,3000,2000],
    [3000, 3500, 3000]];// CS-uj

    MaxHold = [[110 ,200, 100], [115, 150, 160], [150, 145, 140], [120, 130, 140], [110, 125, 135],[130, 145, 160],
    [160, 150, 110],[140, 135, 160],[115, 120, 135]]; //MI_UKT

    While running the model I'm getting output that says "unexpected data item error. Would anyone suggest me how to get rid off that . Thanks in advance

    ------------------------------
    Md Ashikur Rahman
    ------------------------------

    #DecisionOptimization


  • 2.  RE: query about Data Item unexpected error

    Posted Fri April 02, 2021 02:14 AM
    MaxHold seems to be a 3 dimensional array in the .mod while only 2D in the .dat, isn't it?
    With 
    <code>
    MaxHold = [[[110 ,200, 100], [115, 150, 160], [150, 145, 140]], [[120, 130, 140], [110, 125, 135],[130, 145, 160]],
    [[160, 150, 110],[140, 135, 160],[115, 120, 135]]]; 
    </code>
    it is ok.

    ------------------------------
    Vincent Beraudier
    ------------------------------