Decision Optimization

Decision Optimization

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


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
  • 1.  how to connect tuple data from a spreadsheet from excel

    Posted 01/11/16 07:58 AM

    Originally posted by: NguyenHuuTRi


    Hello,

    Can you help to show me the way to connect tuple data from a spreadsheet from excel.

    Thank you very much.

     

    Nguyen Huu Tri.

     

     


    #CPLEXOptimizers
    #DecisionOptimization


  • 2.  Re: how to connect tuple data from a spreadsheet from excel

    Posted 01/13/16 07:24 AM


  • 3.  Re: how to connect tuple data from a spreadsheet from excel

    Posted 01/13/16 06:26 PM

    Originally posted by: NguyenHuuTRi


    Hi,

    Thank you very much for your advice.

    I have already typed in the data as you guided. However, I encountered an error when running my sample model. I have attached here the sample, can you pls help double check for me?

     

    Thanks very much.

    best regards,

     

     

     


    #CPLEXOptimizers
    #DecisionOptimization


  • 4.  Re: how to connect tuple data from a spreadsheet from excel

    Posted 01/13/16 08:56 PM

    Originally posted by: NguyenHuuTRi


    Hi,

    Thanks so much for your sharing.

     

    Could you please share with me the syntax for tuple sets (for both model and data input)?

     

    Thanks very much.

     

    Best regards


    #CPLEXOptimizers
    #DecisionOptimization


  • 5.  Re: how to connect tuple data from a spreadsheet from excel

    Posted 01/14/16 08:02 AM

    Hi,

    with the xls you gave you could trythe following

    in the .mod

    range course=1..8;
    range room=1..10;

    int courseroom[course][room]=...;

     

    tuple pairs {
    int course;
    int room;
    };
    setof (pairs) schedule={<c,r> | c in course,r in room:courseroom[c][r]==1};


    dvar boolean x[schedule];

    maximize
    sum (cr in schedule) x[cr];

    subject to{
    forall (c in course)
      sum (<c,r> in schedule) x[<c,r>]==1;
    };

    in the .dat

    SheetConnection mysheet("sample.xlsx");
     

     courseroom from SheetRead(mysheet,"B3:K10");

    regards


    #CPLEXOptimizers
    #DecisionOptimization


  • 6.  Re: how to connect tuple data from a spreadsheet from excel

    Posted 01/14/16 11:17 AM

    Originally posted by: NguyenHuuTRi


    Hi,

     

    Thanks for your solution.

    I am putting two more varaibles for timeslot and lecturer. I wonder if we have any other ways to reduce the number of variables as it generates 60.000 if we use 4 parameters. This is my model:

     

    range course=1..20; 
    range room=1..25;
    range lecture=1..10;
    range timeslot=1..12;

     
    tuple pairs { 
    int course; 
    int room; 
    }; 
    setof (pairs) course_room={<c,r> | c in course,r in room};

    dvar boolean x[course][room][lecture][timeslot];
    maximize 
    sum (c in course, r in room, l in lecture, t in timeslot) x[c][r][l][t];
    subject to{ 
    forall (l in lecture, t in timeslot) 
      sum (<c,r> in course_room) x[c][r][l][t]==1; 
    };

     

    Thanks so much.

     

    Best regards,


    #CPLEXOptimizers
    #DecisionOptimization


  • 7.  Re: how to connect tuple data from a spreadsheet from excel

    Posted 01/14/16 11:33 AM

    Hi,

    in documentation

    You should have a look at

    Exploiting sparsity

    in order to write something better than

    dvar boolean x[course][room][lecture][timeslot];

    regards


    #CPLEXOptimizers
    #DecisionOptimization


  • 8.  Re: how to connect tuple data from a spreadsheet from excel

    Posted 01/15/16 11:01 AM

    Originally posted by: NguyenHuuTRi


    Hi,

    Thanks for your sharing.

    As I am running my model. However, I encounter the error which requires me to restart the run configuration. Could you please help check that for me. I am attaching my model in the zip file.

     

    Thanks very much.

     

    Best regards,


    #CPLEXOptimizers
    #DecisionOptimization