Decision Optimization

Decision Optimization

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

 View Only
  • 1.  Tuples read directly from Excel sheet

    Posted Thu June 30, 2016 05:16 AM

    Originally posted by: sandeepsinghchauhan


    I have a data

    MODEL

    tuple route {
      string p;
      string o;  
    }
    {route} Routes = ...;

    float Demand[Routes] = ...;

    DATA

    SheetConnection data("example.xlsx");
     Demand from SheetRead  (data, "'Sheet1'!A2:D4");

    ERROR

    Description    Resource    Path    Location    Type
    Exception from IBM ILOG Concert: excel: can only read a 1D array from a column or a row. 

    please help

     


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 2.  Re: Tuples read directly from Excel sheet

    Posted Thu June 30, 2016 06:01 AM

    Hi,

    as I said at https://www.ibm.com/developerworks/community/forums/html/topic?id=a3fd7e59-a423-40c5-a246-b30635f7c108&ps=25

    you seem to mix 1D and 2D

    In order to read your excel, the following will work

    .mod

    tuple route {
      string p;
      string o;  
    }
    {route} Routes = {<"A","B">,<"A","C">,<"A","D">,<"A","E">};

    float Demand[Routes][1..3] = ...;

    float d=Demand[<"A","C">][3];
    execute
    {
    writeln(Demand);
    writeln(d);
    }

    .dat

    SheetConnection data("example.xlsx");
     Demand from SheetRead  (data, "'Sheet1'!A2:D4");

    and will give

    [[2000 102 300]
             [218 1112 320]
             [194 97 2195]
             [221 121 324]]
    320

    regards

     


    #DecisionOptimization
    #OPLusingCPLEXOptimizer