I´m a beginner in ibm ilog cplex optimization studio.
I´m getting an error when I try to run this code :
{int} job=...; //
{int} mch=...; //
{int} opes=...;
float M=...; //
tuple capableMchs{
int j; // jobs
int o; // operations
int m; //machines
};
{capableMchs} capableMch=...;
{int} Ope[j in job] = { o | <j,o,m> in capableMch};
tuple jointMchs {
int j; //jobs
int o; //operation of j
int h; // jobs
int g; // operation of h
int m; } //machine
{jointMchs} jointMch={};
execute IniciarTupleSet {
for (var j in job) {
for (var op in Ope[j]) {
for (var h in job , (j < h)) {
for (var g in Ope[h]) {
for (var m in mch, <j,op,m> in capableMch) {
if (<h,g,m> in capableMch)
jointMch.add(j,op,h,g,m)
}
}
}
}
}
}
The error I get is: "missing expression"
I think the problem resides in the "for (var m in mch, <j,op,m> in capableMch) " part, but I don´t know how to solve it. Without that preprocessing block I have to do much work by hand.
For context: jointMch is used to index a boolean variable Z that represents that the operation g of a job h precedes the operation o of job j in the machine m.
Here is an example of what I expect the code to generate:
job = { 1 2 3} ;
mch = {1 2 3} ;
opes = {1 2 3} ;
capableMch={ //tuple set of doable operation of jobs in a machine
<1,1,1>,
<1,1,2>,
<1,2,1>,
<1,2,2>
<1,3,3>,
<2,1,2>,
<2,2,2>,
<3,1,3>,
<3,2,3>,
<3,3,3>,
};
jointMch = {
<1,1,2,1,2>,
<1,2,2,1,2>,
<1,2,2,2,2>,
<1,1,1,2,2>,
<1,3,3,1,3>,
<1,3,3,2,3>,
<1,3,3,3,3>,
};
For example because job 1 operation 1 and job 2 operation 1 both are doable in machine 2 I need the element : <1,1,2,1,2> and so on.