Hello,
I started to use cplex opl a few months ago. Now I have a problem which I can´t solve by myself.
It is a scheduling problem with l=1..4 Lines; i,j=1..25 Blocks and s=1..20 MicroPeriods.
Because every block is assigned to a line it should be possible to reduce the amount of possible combinations for the decisionvariable z_lijs. z_lijs is 1 if there is a changeover from block i to block j on line l and in microperiod s/ 0 otherwise. The objective function is to minimize: z_lijs * c_lij (c_lij are setup costs).
range Line =1..4;
range Block=1..25;
range Micro=1..20;
tuple zIndizes{
int Line;
int Block1;
int Block2;
int Micro;
}
{zIndizes} Index = {<l,i,j,s> l in Line: l==1, i in 20..24, j in 20..24, s in 1..20};
{zIndizes} Index = {<l,i,j,s> l in Line: l==2, i in 11..19, j in 11..19, s in 1..20};
{zIndizes} Index = {<l,i,j,s> l in Line: l==3, i in 1..10, j in 1..10, s in 1..20};
{zIndizes} Index = {<l,i,j,s> l in Line: l==4, i in Block: i==25, j in Block: j==25, s in 1..20};
float cLineBlockBlock=…;
dvar float+ zIndex;
minimize
sum (l in Line, i in Block1, j in Block2, s in Micro)
c[l][i][j]*z[<l,i,j,s>};
I know that it is wrong to define 4 types of “Index” but my intention was to show what the problem is about.
If it is possible I would like the setupcostvariable to stay like c[l][i][j] and not be changed to c<l,i,j>.
Maybe there is a possibility to use IFconstraints in the definition of the tuple or to use subtuples? I tried different things but it didn’t work out well.
It would be really nice if somebody could help me.
Thanks,
Kind regards,
MP_10
Topic
NOTICE: developerWorks Community will be offline May 2930, 2015 while we upgrade to the latest version of IBM Connections. For more information, read our upgrade FAQ.
This topic has been locked.
5 replies
Latest Post
 20130317T15:55:40Z by SystemAdmin
ACCEPTED ANSWER
Pinned topic Restrict combinations of indices for decision variable to reduce runtime.
20130217T18:11:17Z

Answered question
This question has been answered.
Unanswered question
This question has not been answered yet.
Updated on 20130317T15:55:40Z at 20130317T15:55:40Z by SystemAdmin

ACCEPTED ANSWER
Re: Restrict combinations of indices for decision variable to reduce runtime.
20130301T17:08:42Z in response to SystemAdminFinally, I solved the problem by creating a new array LILineBlock where LI[l][i]=1 if Block i is produced on line l.
{zIndizes} Index = {<l,i,j,s> l in Line, i in Block1, j in Block2, s in Micro: LI[l][i]==1 && LI[l][j]==1};
But now there is a little problem with a constraint in the model.
In the constraint, I would like to refer to the i and j from the tuple.
So I tried this but it doesn´t work:
forall(l in Line, d in Macro2)
sum (idx in Index: idx.i==i)sum(idx in Index: idx.j==j) sum(s in S[d])
stb[l][i][j]*z<l,i,j,s>....
Can anybody tell how the sum i and sum j have to be formulated so that the i,j are taken from tuple "Index"?
Thanks,
regards
MP_10
ACCEPTED ANSWER
Re: Restrict combinations of indices for decision variable to reduce runtime.
20130301T19:39:31Z in response to SystemAdminI cannot read your code, since you did not surround it with code tags, but I suspect that what you need to do its create a set of valid tuples and then index the constraint over all tuples in the set. I'm pretty sure the OPL documentation explains this and provides examples.
Paul
Mathematicians are like Frenchmen: whenever you say something to them, they translate it into their own language, and at once it is something entirely different. (Goethe)
ACCEPTED ANSWER
Re: Restrict combinations of indices for decision variable to reduce runtime.
20130307T11:10:52Z in response to SystemAdminHi,
can you post your code with code tags and add your dat file?
regards
ACCEPTED ANSWER
Re: Restrict combinations of indices for decision variable to reduce runtime.
20130317T15:50:43Z in response to AlexFleischerThank you for your responses.
Finally I solved the problem. I initially didn´t understand how the tuples work.
{forall(l in Line, d in Macro2)
sum (idx in zIndex: idx.l==l && idx.s in S[d])
stbhttp://idx.lhttp://idx.ihttp://idx.j*zidx ...}
Regards,
MP10
ACCEPTED ANSWER
Re: Restrict combinations of indices for decision variable to reduce runtime.
20130317T15:55:40Z in response to SystemAdminok now I try it with codetags...
forall(l in Line, d in Macro2) sum (idx in zIndex: idx.l==l && idx.s in S[d]) stb[idx.l][idx.i][idx.j]*z[idx] ...



