Decision Optimization

Decision Optimization

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


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
  • 1.  Cplex Import Excel

    Posted 05/30/18 08:32 AM

    Originally posted by: Janisch


    Hello,

    I have a problem about to import my data from Excel to Cplex.

    There are 3 ("Verbrenner","Elektro","Gas") variants, each of which has different processing times at the stations. In addition, each station has 2 workplaces. My array should look like this: b[variant][station][workplace]

    How can I export this array from Excel? (attachement)

    The bold numbers/ letters indicate the desired format: variants=string, stations=int, workplaces=int

    I hope you can help me :)

    regards


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 2.  Re: Cplex Import Excel



  • 3.  Re: Cplex Import Excel

    Posted 05/30/18 11:25 AM

    Originally posted by: Janisch


    Unfortunately that did not help me. Respectively, I did not quite understand how I can apply this to my problem.


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 4.  Re: Cplex Import Excel

    Posted 05/30/18 05:33 PM

    Hi,

    you will use SheetRead with range B4:J5 for the values that will be in a 2D array

    and A4:A5 and B3:J3 for 2 indexes a little before  in order to then turn all this into a 3D array by splitting the 2D array

    regards


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 5.  Re: Cplex Import Excel

    Posted 05/31/18 08:13 AM

    Originally posted by: Janisch


    Unfortunately it still does not work for me. I do not know how to handle the string. Unfortunately, the order does not fit yet. Maybe you can help me. Enclosed you will find the code and the data.


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 6.  Re: Cplex Import Excel

    Posted 05/31/18 09:53 AM

    Hi

    You could try

    /*********************************************
     * OPL 12.8.0.0 Model
     * Author: Jan
     * Creation Date: 31.05.2018 at 13:17:44
     *********************************************/
    {string} Variante=...;
    int AnzahlStation=...;
    int Arbeitsplaetze=...;


     
    float nb2[1..Arbeitsplaetze,1..AnzahlStation*card(Variante)]=...;


    float b2[s in Variante][m in 1..Arbeitsplaetze][p in 1..AnzahlStation]=nb2[m,1+ord(Variante,s)*AnzahlStation+(p-1)];
     execute {
       writeln(b2);
    };

     

    regards


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 7.  Re: Cplex Import Excel

    Posted 06/03/18 08:18 AM

    Originally posted by: Janisch


    Perfect! Everything works now. Thank you


    #DecisionOptimization
    #OPLusingCPLEXOptimizer