Decision Optimization

 View Only
  • 1.  Constraint Progrraming for Unrelated Parallel Scheduling:

    This message was posted by a user wishing to remain anonymous
    Posted Thu January 04, 2024 12:42 PM
      |   view attached
    This post was removed

    Attachment(s)



  • 2.  RE: Constraint Progrraming for Unrelated Parallel Scheduling:

    Posted Thu January 04, 2024 12:43 PM

    Just wondering is there any Constraint Programming model made in IBM CPLEX ILOG similar to this mathematical modeç.



    ------------------------------
    Berkay Orkun Erkılınç
    ------------------------------



  • 3.  RE: Constraint Progrraming for Unrelated Parallel Scheduling:

    Posted Wed January 10, 2024 05:58 AM
    Edited by ALEX FLEISCHER Wed January 10, 2024 07:52 AM

    Let me fix the model you shared with me to make it give solutions

    .mod

    // CP Model for Job Scheduling
    
    // Include necessary libraries
    using CP;
    
    int nbJobs = ...;
    int nbMchns = ...;
    int nbPositions = ...;
    range Positions = 1..nbPositions;
    range Jobs = 1..nbJobs;
    range Mchns = 1..nbMchns;
    
    // Parameters
    int mEligible[Jobs][Mchns] = ...;  // Ajk
    int setup[Mchns][Jobs][Jobs] = ...; // sijk
    int processTime[Jobs][Mchns] = ...; // Ljk
    tuple triplet { int j1; int j2; int time; } 
    {triplet} transitionTime[m in Mchns] = 
      { <j1,j2,setup[m][j1][j2]> | j1 in Jobs, j2 in Jobs};
      
    
    dvar interval Z[j in Jobs];
    dvar interval X[j in Jobs][m in Mchns][p in Positions] optional size processTime[j][m];
    dvar sequence Mch[m in Mchns] in all(j in Jobs, p in Positions: mEligible[j][m] == 1) X[j][m][p];
    
    dvar int Y[Jobs]; // Start time of job j
    dvar int C[Jobs]; // Completion time of job j
    
    dexpr int totalCompletionTime = sum(j in Jobs, k in Mchns, p in Positions) endOf(X[j][k][p]);
    
    
    execute{
    		cp.param.timeLimit=3600;
    }
    
    minimize totalCompletionTime;
    subject to {
    forall (j in 1..nbJobs)
        alternative(Z[j], all(m in Mchns, p in Positions: mEligible[j][m] != 0) X[j][m][p]);
    	
    forall(j in Jobs, p in Positions,m in Mchns: mEligible[j][m]==0)
      presenceOf(X[j][m][p])==0;
      
     forall (m in Mchns)
        noOverlap(Mch[m], transitionTime[m],true);
    
    
     forall(k in Mchns) {
            noOverlap(Mch[k], transitionTime[k]);
        }
    
    
    forall(i in Jobs, j in Jobs : i < j) {
        forall(m in Mchns) {
            // Apply the constraint only if both jobs are scheduled on the same machine
            endBeforeStart(Z[j], Z[i], setup[m][j][i]);
        }
    
    }
    //
     forall(j in Jobs)
            C[j] >= Y[j] + sum(m in Mchns, p in Positions) (presenceOf(X[j][m][p]) * processTime[j][m]);
    
    	
    }

    and

    .dat

    nbJobs = 5; // Example number of jobs
    nbMchns = 3; // Example number of machines
    nbPositions = 10; // Example number of positions
    
    // Eligibility of jobs for machines (1 if eligible, 0 if not)
    mEligible = [
        [1, 0, 1], // Job 1 eligibility for each machine
        [1, 1, 1], // Job 2
        [0, 1, 0], // Job 3
        [1, 0, 1], // Job 4
        [1, 1, 1]  // Job 5
    ];
    
    // Setup time between jobs on each machine
    setup = [
        // Machine 1
        [
            [0, 10, 20, 30, 40], // Job 1 setup times to other jobs
            [10, 0, 15, 25, 35], // Job 2
            [20, 15, 0, 20, 30], // Job 3
            [30, 25, 20, 0, 25], // Job 4
            [40, 35, 30, 25, 0]  // Job 5
        ],
        // Machine 2
        [
            [0, 12, 18, 28, 38], // Job 1 setup times to other jobs
            [12, 0, 16, 26, 36], // Job 2
            [18, 16, 0, 21, 31], // Job 3
            [28, 26, 21, 0, 24], // Job 4
            [38, 36, 31, 24, 0]  // Job 5
        ],
        // Machine 3
        [
            [0, 11, 19, 29, 39], // Job 1 setup times to other jobs
            [11, 0, 14, 24, 34], // Job 2
            [19, 14, 0, 22, 32], // Job 3
            [29, 24, 22, 0, 23], // Job 4
            [39, 34, 32, 23, 0]  // Job 5
        ]
    ];
    
    
    // Processing time of each job on each machine
    processTime = [
        [10, 0, 20], // Job 1 processing time on each machine
        [15, 25, 15], // Job 2
        [0, 20, 0],  // Job 3
        [15, 0, 10], // Job 4
        [20, 10, 20] // Job 5
    ];



    ------------------------------
    [Alex] [Fleischer]
    [Data and AI Technical Sales]
    [IBM]
    ------------------------------



  • 4.  RE: Constraint Progrraming for Unrelated Parallel Scheduling:

    Posted Wed January 10, 2024 07:23 AM

    Can you detail your answer . I did not understand. Thanks your support. 



    ------------------------------
    Berkay Orkun Erkılınç
    ------------------------------



  • 5.  RE: Constraint Progrraming for Unrelated Parallel Scheduling:

    Posted Wed January 10, 2024 07:29 AM
    Edited by Berkay Orkun Erkılınç Wed January 10, 2024 07:31 AM
    SolutionThe answer may incomplete in terms of Decision variables  " C " and "Y" . What should I do. Can you help me?



    ------------------------------
    Berkay Orkun Erkılınç
    ------------------------------



  • 6.  RE: Constraint Progrraming for Unrelated Parallel Scheduling:

    Posted Wed January 10, 2024 08:15 AM

    Hi,

    C and Y may take very large values , if you want to avoid this, you can write

    range horizon=1..100;
    dvar int Y[Jobs] in horizon; // Start time of job j
    dvar int C[Jobs] in horizon; // Completion time of job j


    ------------------------------
    [Alex] [Fleischer]
    [Data and AI Technical Sales]
    [IBM]
    ------------------------------



  • 7.  RE: Constraint Progrraming for Unrelated Parallel Scheduling:

    Posted Wed January 10, 2024 08:18 AM
    Edited by Berkay Orkun Erkılınç Sun January 14, 2024 10:27 AM



    ------------------------------
    Berkay Orkun Erkılınç
    ------------------------------