Constraint Progrraming No solution

33 views Asked by At

Hello everyone ı have an mathematical which is related with unrelated parallel machines with considering setup time between jobs and machine eligilibity. I wrote my mathematical model in GAMS. It worked.However, when ı code it in the IBM CPLEX ILOG as CP, cant find a solution. My model runs in a time but dont provide any solution. Here my mathematical model and .mod file and .dat file. Can you help me ?

  ={: 1,2,...,,...}
Set of orders
={: 1,2,...,,...}
Set of machines
={: 1,2,...,,...}
Set of positions (P=J)
alias(i,j)
SCALARS
M
A big number
PARAMETERS

={1;        ℎ  0; ℎ

Set-up time for job  after job  on machine 

Processing time of job  on machine 
DECISION VARIABLES

={1;       ℎ     0; ℎ

Start time of job 

Completion time of job 

={1;        ℎ     0; ℎ
∀∋≠ j den sonra i,
Objective Function
 Σ=1
(1)
Subject to
ΣΣ=1=1=1
∀ 
(2)
≤
∀,∀,∀
(3)
Σ=1≤1
∀,∀
(4)
Σ=1>Σ,+1=1
∀,∀∋≠ (∀=1,...,−1 )
(5)
+,+1−1≤
∀,∀∋≠ (∀=1,...,−1 )
(6)
+≤+∙[1−(ΣΣ=1=1)]
∀,∀,∀
(7)
≥+ΣΣ∙=1=1
∀
(8)

. This is my mathematical model.

 My .MOD file:
    
    using CP;
    // Parameters
    int numJobs = ...; // Total number of jobs
    int numMachines = ...; // Total number of machines
    int P = ...; // Number of positions, assuming P = number of jobs
    
    range Jobs = 1..numJobs;
    range Machines = 1..numMachines;
    range Positions = 1..P;
    
    tuple SetupTime {
        int job1;
        int job2;
        int machine;
        float time;  // Setup time for job1 after job2 on machine
    };
    
    tuple ProcessingTime {
        int job;
        int machine;
        float time;  // Processing time of job on machine
    };
    
    tuple MachineAvailability {
        int job;
        int machine;
        int available;  // 1 if job can be processed on machine, 0 otherwise
    };
    
    // Set of tuples
    {SetupTime} setupTimes = ...;
    {ProcessingTime} processingTimes = ...;
    {MachineAvailability} machineAvailabilities = ...;
    
    // Decision Variables
    dvar interval itvs[Jobs][Machines][Positions] optional;
    dvar int+ startTimes[Jobs];
    dvar int+ completionTimes[Jobs];
    
    // Objective: Minimize the completion time of the last job
    dexpr float maxCompletionTime = max(j in Jobs) completionTimes[j];
    minimize maxCompletionTime;
    
    // Constraints
    subject to {
        // Constraint (2): Each job must be assigned exactly once
        forall(j in Jobs)
            sum(m in Machines, p in Positions) presenceOf(itvs[j][m][p]) == 1;
    
        // Constraint (3): Job assignment must respect machine availability
        forall(a in machineAvailabilities)
            forall(p in Positions)
                presenceOf(itvs[a.job][a.machine][p]) <= a.available;
    
        // Constraint (4): At most one job per machine per position
        forall(m in Machines, p in Positions)
            sum(j in Jobs) presenceOf(itvs[j][m][p]) <= 1;
    
        // Constraint (5): Ensuring proper job sequencing on machines
        forall(m in Machines, p in 1..P-1)
            forall(j1 in Jobs, j2 in Jobs: j1 != j2)
                endBeforeStart(itvs[j1][m][p], itvs[j2][m][p+1]);
    
        // Constraint (6): Job sequence dependency
        forall(i in Jobs, j in Jobs: i != j, m in Machines, p in Positions)
            startTimes[i] >= completionTimes[j] + 
                sum(st in setupTimes: st.job1 == i && st.job2 == j && st.machine == m) st.time;
    
        // Constraint (7): Setup times and completion times
    // Constraint (7): Setup times and completion times
    // Constraint (7): Setup times and completion times
    forall(j in Jobs)
            completionTimes[j] == max(m in Machines, p in Positions) 
                (startTimes[j] + (presenceOf(itvs[j][m][p]) * 
                sum(pt in processingTimes: pt.job == j && pt.machine == m) pt.time));
    
    
    
        // Constraint (8): Completion times and processing times
        forall(j in Jobs, m in Machines, p in Positions)
            completionTimes[j] >= endOf(itvs[j][m][p]);
    }
    
    // Solve the model




 My .dat file:
    /*********************************************
     * OPL 22.1.1.0 Data
     * Author: berka
     * Creation Date: 4 Oca 2024 at 21:32:44
     *********************************************/
    numJobs = 5; // Total number of jobs
    numMachines = 3; // Total number of machines
    P = 5; // Number of positions, assuming P = number of jobs
    
    setupTimes = {
        // Setup times for transitions from each job to each other job on Machine 1
        <1, 2, 1, 15>,
        <1, 3, 1, 15>,
        <1, 4, 1, 45>,
        <1, 5, 1, 45>,
        <1, 6, 1, 45>,
        <2, 1, 1, 15>,
        <2, 3, 1, 15>,
        <2, 4, 1, 45>,
        <2, 5, 1, 45>,
        <2, 6, 1, 45>,
        <3, 1, 1, 15>,
        <3, 2, 1, 15>,
        <3, 4, 1, 45>,
        <3, 5, 1, 45>,
        <3, 6, 1, 45>,
        <4, 1, 1, 45>,
        <4, 2, 1, 45>,
        <4, 3, 1, 45>,
        <4, 5, 1, 15>,
        <4, 6, 1, 15>,
        <5, 1, 1, 45>,
        <5, 2, 1, 15>,
        <5, 3, 1, 15>,
        <5, 4, 1, 15>,
        <5, 6, 1, 15>,
        <6, 1, 1, 15>,
        <6, 2, 1, 15>,
        <6, 3, 1, 15>,
        <6, 4, 1, 15>,
        <6, 5, 1, 15>
        // No need to include transitions from a job to itself, as the setup time is zero
    };
    
    processingTimes = {
        // Processing times for each job on each machine
        <1, 1, 20>, <1, 2, 22>, <1, 3, 18>, 
        <2, 1, 25>, <2, 2, 20>, <2, 3, 23>, 
        <3, 1, 19>, <3, 2, 21>, <3, 3, 24>,
        <4, 1, 16>, <4, 2, 20>, <4, 3, 22>,
        <5, 1, 18>, <5, 2, 19>, <5, 3, 20>
    };
    
    machineAvailabilities = {
        // Availability of each job on each machine
        <1, 1, 1>, <1, 2, 1>, <1, 3, 1>, 
        <2, 1, 1>, <2, 2, 0>, <2, 3, 1>, 
        <3, 1, 1>, <3, 2, 1>, <3, 3, 1>, 
        <4, 1, 0>, <4, 2, 1>, <4, 3, 1>,
        <5, 1, 1>, <5, 2, 1>, <5, 3, 0>
    };

   
1

There are 1 answers

0
Alex Fleischer On

In order to get a solution or no solution faster, you can write

range horizon=0..100000;

// Decision Variables
dvar interval itvs[Jobs][Machines][Positions] optional in horizon ;
dvar int+ startTimes[Jobs] in horizon;
dvar int+ completionTimes[Jobs] in horizon;

Second in order to get fonclicts you can name your constraints:

 forall(j in Jobs)
            ct7:completionTimes[j] == max(m in Machines, p in Positions) 
                (startTimes[j] + (presenceOf(itvs[j][m][p]) * 
                sum(pt in processingTimes: pt.job == j && pt.machine == m) pt.time));

And then you get some conflicts in the conclicts tab