Decision Optimization

 View Only
  • 1.  Making dummy data for 4 Dimensional Data

    Posted Sun March 31, 2024 01:26 PM

    Hello,

    I am working on a project which is basically a transportation problem, and I have to make a dummy dataset for testing the model. But I am not able to make 4 Dimensional Data. Below is the mod file code that I am using. Any type of help is appreciated.

    /* Sets */
    int I = ...;
    int J = ...;
    int T = ...;
    range Products = 1..I;/* Set of Blood Products */
    range Locations = 1..J;/* Set of Locations of the hospitals */
    range Time = 1..T;/* Set of Time Periods */
     
    /* Parameters */
    int demand[Products][Locations][Time] = ...;/* Demand of the Blood Product i in period t at location j */
    int cost[Products][Time] = ...;/* Cost of the Blood Product i in period t */
    int hold[Products][Locations][Time] = ...;/* Holding Cost of the Blood Product i at location j in period t */
    int Maxcap[Locations][Time] = ...;/*Max capacity of inventory in period t at location j.*/
    int MaxT[Time] = ...;/*Max transportation capacity in period t.*/
    int Transportcost[Products][Locations][Locations][Time] = ...;/*Per unit transporting cost of Blood Product i from location j to location k in period t.*/
     
    /* Decision Variables */
    dvar int+ x[Products][Locations][Time];
    dvar int+ t[Products][Locations][Locations][Time];
    dvar int+ i[Products][Locations][Time];


    ------------------------------
    Faraz Omar
    ------------------------------


  • 2.  RE: Making dummy data for 4 Dimensional Data

    Posted Mon April 01, 2024 01:32 PM

    Hi

    you can use random

    /* Sets */
    int I = 4;
    int J = 5;
    int T = 10;
    range Products = 1..I;/* Set of Blood Products */
    range Locations = 1..J;/* Set of Locations of the hospitals */
    range Time = 1..T;/* Set of Time Periods */
     
    /* Parameters */
    
    int Transportcost[p in Products][l in Locations][l2 in Locations][t in Time] = /*Per unit transporting cost of Blood Product i from location j to location k in period t.*/
     rand(10);
     
     
    
    
    execute
    {
      Transportcost;
    }

    works fine



    ------------------------------
    [Alex] [Fleischer]
    [Data and AI Technical Sales]
    [IBM]
    ------------------------------



  • 3.  RE: Making dummy data for 4 Dimensional Data

    Posted Mon April 01, 2024 10:26 PM

    Hi,

    Thanks a lot for sharing!



    ------------------------------
    Faraz Omar
    ------------------------------