Decision Optimization

Decision Optimization

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


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
  • 1.  Job shop scheduling using OPL

    Posted 04/06/18 10:34 PM

    Originally posted by: bobby76


    Hi, 

    I am relatively new to tuple. I want to develop a classical job shop scheduling using OPL, not CP optimizer. I have stuck to create operation precedence constraints for operation, i.e. operation o of job j precede operation o+1.

     

    Here is my script:

    int nJobs = ...;
    int nMachines = ...;
    int nPeriods = ...;
     
    range jobs = 0..nJobs - 1;
    range machines = 0..nMachines - 1;
    range periods = 1..nPeriods;
     
    tuple Operation{
    int mch; // Machine
    int pt;  // Processing time
    };
     
    Operation ops[j in jobs][i in machines] = ...;
     
    dvar boolean x[machines][jobs][periods];
    dvar int Cmax;
     
    minimize Cmax;
     
    subject to
    {
    forall(i in machines, j in jobs)
      sum(t in periods) x[i][j][t] == 1;
      
    forall(j in jobs, i in machines)
      sum(t in periods) (t + ops[j][i].pt) * x[i][j][t] <= Cmax;
      
    forall(i in machines, t in periods)
      sum(j in jobs, u in periods: u >= t - ops[j][i].pt) x[i][j][u] <= 1;
     

    //This is where I stuck

    forall(j in jobs, h in ops: h >= 2)
    sum(t in periods) x[h][j][t] == 1;
    }

     

    Here is with tuple declaration:

    nJobs = 6;
    nMachines = 6;
    nOperations = 6;
    nPeriods = 17;

    ops = [
     [ <5,4>, <1,3>, <4,3>, <3,2>, <0,1>, <2,2> ],
     [ <1,3>, <0,8>, <5,7>, <2,2>, <4,9>, <3,3> ],
     [ <3,1>, <4,9>, <1,9>, <0,7>, <5,5>, <2,5> ],
     [ <3,8>, <4,2>, <1,1>, <5,7>, <2,8>, <0,9> ],
     [ <1,6>, <3,2>, <4,5>, <5,5>, <0,3>, <2,1> ],
     [ <4,10>, <2,4>, <0,4>, <3,3>, <1,2>, <5,3> ]
    ];

     

    Has anybody experienced in building job shop model, please help me. Your help is appreciated.

     

    Best regards,

    Bobby

     

     

     

     

     

     

     


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 2.  Re: Job shop scheduling using OPL

    Posted 04/07/18 09:05 AM

    Hi,

    you have an example at https://www.ibm.com/developerworks/community/forums/html/topic?id=8ebacb94-8758-444b-a5c2-b9b137b69370&ps=25

    But CPO is quite good for jobshop. So I wonder why you do not use that.

    regards


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 3.  Re: Job shop scheduling using OPL

    Posted 04/07/18 09:25 PM

    Originally posted by: bobby76


    Hi Mr Fleischer,

    Thanks for your information. I will run your code with instances from Fisher and Thompson 6x6 instance (ft06) with known optimal Cmax = 55.

    Best regards,

     

    Bobby

     

     

     


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 4.  Re: Job shop scheduling using OPL

    Posted 04/08/18 04:29 PM

    Originally posted by: Ladas


    Hi,

    even though the topic is solved, I want to ask very similar question, so I put it here.

    I am also dealing with JSSP and I wanna use CPLEX (for comparison with CP). I also looked at the examples in ibm ilog cplex OS and modified it for my case (file attached). I use special case, when some machine can be utilized multiple times during one job and every job has different number of operations. But I guess it is poorly specificated because it doesn't give me any result even after almost 2 hours! When I put 0 instead of objective function, after 6 seconds I got poor result (there are downtimes of the machines). But I don't know any other way, despite the fact that there should be a way (since JSSP is among CP also MIP problem)...

    If you have any idea how to make it solvable, I will really appreciate that!

    Reagards!


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 5.  Re: Job shop scheduling using OPL

    Posted 04/08/18 09:53 PM

    Originally posted by: bobby76


    Hi Mr. Ladas,

     

    I have test the Mr. omidi model using ft06 benchmark and the result is not good. 

     

    // solution (feasible relaxed sum of infeasibilities) with objective 158

    whereas the optimal makespan indeed 55.

     

    I think you the problem lies on c04 in Mr. omidi model because it generates conflict.

     

    Best regards,

     

    Bobby

     


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 6.  Re: Job shop scheduling using OPL

    Posted 04/09/18 02:01 AM

    Originally posted by: Ladas


    Thanks for answer.

    But I meant, I don't even need that x[][][] and A[][][] because I am not dealing with the problem of multiple machines for a single operation. Furthermore I do not have the same number of operations for every job.

    I tried to fit my case to that of Mr. omidi, But it seems impossible (since number of operations within one job is greater than number of machines)...


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 7.  Re: Job shop scheduling using OPL

    Posted 04/09/18 03:16 AM

    Originally posted by: bobby76


    Hi Mr. Ladas,

     

    I think your problem is mix of a flexible job shop and flow shop. I still think you need x[jobs][operations][mhacines] and A[jobs][operations][machines] or tuple to do this. For example, you need to distinct between operation and machine. So, for example 2 jobs with different number of operations. The operations are performed by 2 machines (i.e. a machine can process more than one operation).

    Job 1 has 3 operation with precedence rule (i.e. operation 2 can not be performed until operation 1 is finished)

    Job 2 has 2 operation with precedence rule (i.e. operation 2 can not be performed until operation 1 is finished)

     

    Processing time data                           Routing data 

                 O1  O2   O3                              O1       O2       O3

    Job 1:   4     3      2                    Job 1:  2           1          2

    Job 2:  2      4      0                    Job 2:  1           2

     

    Let p[i][j] denotes the processing time of job i of operation j. 

    Let A[i][j][k] be a binary parameter, i.e. 1 if job i operation j is processed on machine k, 0 otherwise.

    Your data in OPL will be like this:

    p =

    [  [4 3 2]  //Job 1  

      [2 4  0]  //Job 2

    ];

    A = 

    [

    [  [ 0 1] [1 0] [0 1]  ] //for job 1

    [  [1 0] [0 1] [0 0]   ] //for job 2  

    ];

     

    Maybe use tuple for data structure. The rest constraint must be modified.

     

    best regards,

     

     

     

     

     


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 8.  Re: Job shop scheduling using OPL

    Posted 04/09/18 07:13 AM

    Originally posted by: Ladas


    Thanks a lot for the answer. Maybe I spent some time to absorb it :) but even though I have to ask about things I still do not understand in Mr Omidi example. e.g. 

    ord(jobs,k) != ord(jobs,j) && ord(jobs,j)>0
    

    it means that job k is always before job j but not equal? Or why can I use j != i and j > 0?

    And what was actually

    A[jobs][machines][machines]
    

    and

    x[jobs][jobs][machines]
    

    for?


    #DecisionOptimization
    #OPLusingCPLEXOptimizer