Decision Optimization

Decision Optimization

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


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

Array Data Element with two dimensions not supported for sheets

  • 1.  Array Data Element with two dimensions not supported for sheets

    Posted 04/01/18 11:00 AM

    Originally posted by: HemanthKG


    Hi , 

    I am getting the following error when i try to read data from Excel sheets.

    Array data element "Cost" of type <Cost:float> with 2 dimensions not supported for sheets.

    I have attached the Mod and the Dat file for refernce. Thanks for any help.

     

    Also outlined the code

     

    for MOD

    ------------------------------------------------------------------------------------

    {string} Products = ...;
    {string} Offers = ...;
     
    tuple Pr
    {
    float Profit;
      
     
    }
     
    tuple Co
    {
    float Cost;
    }
     
     
    Pr Profit[Products,Offers]=...;
    Co Cost[Products,Offers]=...;
     
     
    float MaxBudget;
     
    dvar boolean X[Products][Offers];
    dvar float+ p[Products][Offers];
    dvar float+ c[Products][Offers];
     
    //maximize
     // sum( g in Gasolines , o in Oils )
      //  (Gas[g].price - Oil[o].price - ProdCost) * Blend[o][g] 
        //- sum(g in Gasolines) a[g];
        
    maximize sum(i in Products,j in Offers) p[i][j]*X[i][j];
     
    subject to{
    forall(i in Products, j in Offers) (sum(i in Products,j in Offers)c[i][j]*X[i][j]<=300);
    forall(i in Products) sum(j in Offers) X[i][j]<=1;
     
    }
     
     
    tuple result{ 
    int products;
     int combo;
     
    }

    ------------------------------------------------------------------------------------

    For Dat

    SheetConnection sheet("Promo.xls");
    Products from SheetRead(sheet,"'PromoProduct'!C2:C13");
    Offers from SheetRead(sheet,"'PromoProduct'!B2:B13");
    Cost from SheetRead(sheet,"'PromoProduct'!G2:G13");
    Profit from SheetRead(sheet,"'PromoProduct'!F2:F13");


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 2.  Re: Array Data Element with two dimensions not supported for sheets

    Posted 04/03/18 03:35 AM

    Hi,

    I would use

    float xlsProfit[Products,Offers]=...;
    float xlsCost[Products,Offers]=...;

    and then turn those two in tuples array

    regards


    #DecisionOptimization
    #OPLusingCPLEXOptimizer