Decision Optimization

Decision Optimization

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


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
  • 1.  Many errors using 3-dimensional array from Excel

    Posted 03/25/17 03:40 AM

    Originally posted by: A6UM_Can_Nguyen


    Hi all,

    I have a reference transport problem in CPLEX, 

    but I want it to read data from Excel, and I looked at the link below to do but could not solve my problem.

    http://www-01.ibm.com/support/docview.wss?rs=0&context=SSCMS55&uid=swg21401340&loc=en_US&cs=utf-8&cc=us&lang=all

    There are many errors as shown below:

     

    Please attach the .mod, .dat and Excel files. If anyone can solve for me to run this model well then really thanks a lot.

    Nguyen IBM

     

     

     

     


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 2.  Re: Many errors using 3-dimensional array from Excel

    Posted 03/26/17 01:40 PM

    Originally posted by: A6UM_Can_Nguyen


    Hi Alex,

    Please help me run this example in advance.

     

    Thank you,

    IBM Nguyen


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 3.  Re: Many errors using 3-dimensional array from Excel

    Posted 03/27/17 06:45 AM

    Hi,

    since you want to read data from excel, you should rather use SheetRead rather than SheetWrite:

    Cities from SheetRead(sheet,"'Data'!A1:A11");
    Products from SheetRead(sheet,"'Data'!B13:D13");
    Routes from SheetRead(sheet,"'Data'!B15:D52");

    regards


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 4.  Re: Many errors using 3-dimensional array from Excel

    Posted 03/27/17 08:30 AM

    Originally posted by: A6UM_Can_Nguyen


    Dear Alex,

    it is error, please help.

     

     


    #DecisionOptimization


  • 5.  Re: Many errors using 3-dimensional array from Excel

    Posted 03/27/17 09:52 AM

    Hi,

    you get that error because you have too many items in your array:

    Cost = [30,10, 8,10,11,71, 6,22, 7,10, 7,21,82,13,19,11,12,10,25,  //83,15,
     //39,14,11,14,16,82, 8,27, 9,12, 9,26,95,17,24,14,17,13,28,99,20,
     //41,15,12,16,17,86, 8,29, 9,13, 9,28,99,18,26,14,17,13,31,104,20
     ];

    will work.

    You should check line by line that you read what you need from the excel file.

    Do not hesitate to have a look at https://www.ibm.com/support/knowledgecenter/SSSA5P_12.7.0/ilog.odms.ide.help/OPL_Studio/opllangref/topics/opl_langref_spreadsheet_oil.html

    regards

     


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 6.  Re: Many errors using 3-dimensional array from Excel

    Posted 03/27/17 10:18 AM

    Originally posted by: A6UM_Can_Nguyen


    Dear Alex,

    It still have not run.

     

    .


    #DecisionOptimization


  • 7.  Re: Many errors using 3-dimensional array from Excel

    Posted 03/27/17 10:22 AM

    Hi,

    the 2 files I attached work fine

    regards


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 8.  Re: Many errors using 3-dimensional array from Excel

    Posted 03/27/17 10:32 AM

    Originally posted by: A6UM_Can_Nguyen


    Hi Alex.

    It worked well, but why the constraints can not have?

    //  forall( p in Products , o in Orig[p] ) 
    //    ctSupply[p][o]: 
    //      sum( <o,d> in CPs[p] ) 
    //        Trans[< p,<o,d> >] == Supply[<p,o>];
    //  forall( p in Products , d in Dest[p] ) 
    //    ctDemand[p][d]:  
    //      sum( <o,d> in CPs[p] ) 
    //        Trans[< p,<o,d> >] == Demand[<p,d>];


    #DecisionOptimization
    #OPLusingCPLEXOptimizer