http://cepac.cheme.cmu.edu/pasi2008/slides/mendez/index.html
Resource-constrained scheduling.gms
* An MILP based technique for a resource-constrained scheduling problem
BINARY VARIABLES
X(o,o0) sequencing variable of product p and p0
A(o,u) allocation of product p to unit u
B(o,m) allocation of product p to operator m
* Activate preordering by slack time.
*$ontext
parameter slt(o) ;
slt(o) = dd(o) - smin(u $pt(o,u),pt(o,u)) ;
X.fx(o,o0) $(ord(o)<ord(o0) and slt(o)>slt(o0)) = 0 ;
X.fx(o,o0) $(ord(o)<ord(o0) and slt(o)<slt(o0)) = 1 ;
*$offtext
large scheduling problem.gms
*solve directly
* how to get this?
TABLE Allocation(P,S) Unit allocated in each stage in the initial schedule
BINARY VARIABLES
X(p,p0,s) sequencing variable of product p and p1 in stage s
X1(p,p0) sequencing variable of product p and p1 in all stages
A(p,m) allocation of product p to unit m ;
solve schedule minimizing MK using MIP;
* UPDATE POSITION FOR ALL BATCHES
loop(s,
loop(m $(stagemach(s,m) > 0) ,
loop(pr1 $(prodmach(pr1,m) > 0 and A.L(pr1,m) = 1 ),
pos = 1 ;
loop(pr2 $(prodmach(pr2,m) > 0 and FT.L(pr2,s) < FT.L(pr1,s) and A.L(pr2,m) = 1 ),
* pr2 is before pr1
pos = pos + 1 ;
);
Position(pr1,s) = pos ;
);
);
);
improvement method.gms
** constructive and improvement
** 0 model:
** Define processing sequence for an already scheduled order and a released order
** Variable sequence and allocation for the released order
** Define processing sequence for a pair of already scheduled orders
** Fixed sequence and allocation for both orders
* 1 Constructive Schedule (insert one by one )
Loop(pr3,
* Set the released table to zero
loop(pr1,
rel(pr1) = 0 ;
) ;
* (insert one by one )
rel(pr3) = 1 ;
pos1 = ord(pr3) ;
solve pharma minimizing TMK using MIP;
* UPDATE ALLOCATION UP TO RELEASED BATCH
* UPDATE POSITION UP TO RELEASED BATCH
* 2 improvement stage
* Improvement optimization-based technique for the scheduling of a multistage Pharmaceutical process
OPTION reslim = 30 ;
* BEST CURRENT OBJECTIVE VALUE (starting point)
SCALAR BEST ;
BEST = TMK.L ;
*
* Maximum number of iterations without changes
SCALAR MAXIT / 30 / ;
***************************************************************
WHILE (ITER < MAXIT ,
* Set the released table to zero
loop(pr1,
rel(pr1) = 0 ;
) ;
* Define the batch to be released
BATCH = BATCH + 1 ;
IF ( BATCH > CARD(p),
BATCH = 1 ;
);
* Release batch
loop(pr1 $(BATCH = ord(pr1)),
rel(pr1) = 1 ;
) ;
* INCREASE THE NUMBER OF ITERATIONS BY 1
ITER = ITER + 1 ;
solve pharma minimizing MK using MIP;
reschedtime = reschedtime + pharma.resusd ;
IF ( (pharma.modelstat = 1 or pharma.modelstat = 2) and
MK.L < BEST ,
pharma.cutoff = MK.L ;
put batch:<2:0 , MK.L:>9:3 / ;
BEST = MK.L ;
ITER = 1 ;
* UPDATE ALLOCATION FOR RELEASED BATCHES
* UPDATE POSITION FOR ALL BATCHES
* Generate the best schedule that was found for output report
没有评论:
发表评论