Originally posted by: khadeejah
3 errors: processing failed,
syntax error, unexpected execute,
unexpected end of file in scripting
below is my .mod file :
{int} products = ...;
{int} stages = ...;
{int} parts = ...;
int Nbperiods= ...;
range periods = 1..Nbperiods;
float dsj [stages][products]= ...;
float units [periods][products]= ...;
float msj [stages][products]= ...;
float Ms [stages]= ...;
float Qs [stages]= ...;
float alpha [stages][products]= ...;
float Ss [stages]= ...;
float as [stages]= ...;
float delta [products][parts]= ...;
int Beta= ...;
float vj [products]= ...;
int Wst= ...;
dvar int+ X [stages][products][periods];
dvar int+ I [stages][products][periods]; // Q: periods should be written as [ 0..Nbperiods]
minimize
sum (j in products, s in stages, t in periods)(msj [s][j]* X [s][j][t]+
Ss[s]*X[s][j][t]*(dsj[s][j]/Beta)+
(Ms[s]*X[s][j][t]*dsj[s][j]/Qs[s])+
alpha[s][j]*I[s][j][t]);
subject to {
ctInventory:
forall( s in stages, j in products, t in periods,p in parts)
{
if(s==1)
{
sum (p in parts)
I[s][j][t] == I[s][j][t-1] + X[s][j][t] -( delta[j][p] *( X[s+1][j][t]));
}
else if ((s+1)==6){
I[s][j][t] == I[s][j][t-1]+X[s][j][t]- units [j][t];
} else{
I[s][j][t] == I[s][j][t-1] + X[s][j][t] - X[s+1][j][t];}
}
ctCapacity:
forall (s in stages , t in periods)
sum( j in products )
dsj[s][j] * X[s][j][t] <= as[s];
ctWarehouse:
forall( s in stages, t in periods )
{sum( j in products)
vj[j]*I[s][j][t] <= Wst;
execute DISPLAY{
for var (s in stages)
for var (j in products)
for var (t in periods){
writeln ("X[",s,"][",j,"][",t,"]=",X[s][j][t]);
writeln ("I[",s,"][",j,"][",t,"]=",I[s][j][t]);
}}
#CPLEXOptimizers#DecisionOptimization