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>
};