Originally posted by: SystemAdmin
[Simon said:]
Hello!
I'm trying to model a CLSD with Concert Technology and Java. The CLSD is a modified version of the CLSP (cf. [url=http://www.palgrave-journals.com/jors/journal/v54/n5/full/2601525a.html]http://www.palgrave-journals.com/jors/journal/v54/n5/full/2601525a.html[/url]).
I've modeled all constraints except one. The CSLD is based on a TSP and I've problems to model the constraint, which eliminates subtours. The constraint is given formely as follows:
[img]http://www.4ballerz.de/cplex11/constraint3_10.jpg[/img]
with: J is a set of products, T is a set of periods. F[sub]jt[/sub] is a integer variable, Y[sub]ijt[/sub] is a binary varible.
My first approach to model this would be as follows:
for(int j = 0; j < nPeriod; j++)<br />{
for(int t = 0; t < nProduct; t++)<br /> {
IloLinearNumExpr rhs1 = cplex.linearNumExpr();
for(int i = 0; i <nProduct; i++)<br /> {
rhs1.addTerm(1., F_jt[i][t]);
//How to model -J*(1-Y_ijt[i][j][t])
}
cplex.addGe(F_jt[j][t], null);
}
}
But I don't know how to model the expressions [tt]-J*(1-Y[sub]ijt[/sub])[/tt] and [tt]J{i}[/tt].
Can somebody help me?
A second extension, I try to model , is that a product has to start in a specific period. Therefor I initialize the Array [tt]int periodStart[nProduct][/tt] with nProduct = count of products. In every cell is the start period of a product saved.
Now I would extend my objective function and constraints (only one is given as an example) as follows:
[img]http://www.4ballerz.de/cplex11/obj_fun.jpg[/img]
//objective function
IloLinearNumExpr objf_a = cplex.linearNumExpr();
IloLinearNumExpr objf_b = cplex.linearNumExpr();
for(int j=0; j < nProduct;j++)<br />{
for(int t = 0; t < nPeriod; t++)<br /> {
objf_b.addTerm(pv.getO_h_jt()[j][t], I_jt[j][t]);
for(int i = 0; i < nProduct; i++)<br /> {
//The modification to start in a later period is here.
if(j!=i && t > periodStart[j] ) objf_b.addTerm(pv.getO_sc_ij()[i][j], Y_ijt[i][j][t]);
}
}
}
cplex.addMinimize(cplex.sum(objf_a, objf_b));
and
[img]http://www.4ballerz.de/cplex11/constraint3_9.jpg[/img]
for(int t = 0; t < nPeriod; t++)<br />{
for(int k = 0; k < nProduct; k++)<br /> {
IloLinearNumExpr res_3_8a = cplex.linearNumExpr();
IloLinearNumExpr res_3_8b = cplex.linearNumExpr();
for(int i = 0; i < nProduct; i++)<br /> {
if(i!=k && t > periodStart[j] )
res_3_8a.addTerm(1., Y_ijt[i][k][t]);
for(int j = 0; j < nProduct; j++)<br /> {
if(j!=k && t > periodStart[j] )
res_3_8b.addTerm(1., Y_ijt[k][j][t]);;
}
}
cplex.addEq(cplex.sum(res_3_8a, Z_jt[k][t-1]),
cplex.sum(res_3_8b, Z_jt[k][t]));
}
}
Would be this approuch correct?
I know, it's a lot of text, but I hope somebody can help me! Thank you!
Best Regards
Simon
#CPLEXOptimizers#DecisionOptimization