| |||||||||||||||||||||||||||||||||||||||||||||||||
Scheduling problems Description
Further explanation of this example: 'Applications of optimization with Xpress-MP', Chapter 7: Scheduling problems
Source Files By clicking on a file name, a preview is opened at the bottom of this page. Data Files b2flowshop.mos (!****************************************************** Mosel Example Problems ====================== file b2flowshop.mos ``````````````````` Flow shop production planning A workshop has three machines to produce metal pipes. A piece must go through each machine and cannot stop unless it is between machines. What is the best order of pieces so that the total time for completion is minimized for all pieces? This problem uses four variables to track which job is scheduled in which position, which machines are empty, which jobs are waiting between machines, and when jobs are starting. Note that each job must be assigned a position and every position ('rank) must be assigned a job. The 'rank' variables are either binary variables or defined as members of two SOS-1. (c) 2008-2022 Fair Isaac Corporation author: S. Heipcke, Mar. 2002, rev. Mar. 2022 *******************************************************!) model "B-2 Flow shop" uses "mmxprs" declarations NM = 3 ! Number of machines NJ = 6 ! Number of jobs MACH = 1..NM RANKS = 1..NJ JOBS = 1..NJ DUR: array(MACH,JOBS) of integer ! Durations of jobs on machines rank: array(JOBS,RANKS) of mpvar ! 1 if job j has rank k, 0 otherwise empty: array(MACH,1..NJ-1) of mpvar ! Space between jobs of ranks k and k+1 wtime: array(1..NM-1,RANKS) of mpvar ! Waiting time between machines m ! and m+1 for job of rank k start: array(MACH,RANKS) of mpvar ! Start of job rank k on machine m ! (optional) end-declarations initializations from 'b2flowshop.dat' DUR end-initializations ! Objective: total waiting time (= time before first job + times between ! jobs) on the last machine TotWait:= sum(m in 1..NM-1,j in JOBS) (DUR(m,j)*rank(j,1)) + sum(k in 1..NJ-1) empty(NM,k) ! Every position gets a job forall(k in RANKS) sum(j in JOBS) rank(j,k) = 1 ! Every job is assigned a rank forall(j in JOBS) sum(k in RANKS) rank(j,k) = 1 ! Relations between the end of job rank k on machine m and start of job on ! machine m+1 forall(m in 1..NM-1,k in 1..NJ-1) empty(m,k) + sum(j in JOBS) DUR(m,j)*rank(j,k+1) + wtime(m,k+1) = wtime(m,k) + sum(j in JOBS) DUR(m+1,j)*rank(j,k) + empty(m+1,k) ! Calculation of start times (to facilitate the interpretation of results) forall(m in MACH, k in RANKS) start(m,k) = sum(u in 1..m-1,j in JOBS) DUR(u,j)*rank(j,1) + sum(p in 1..k-1,j in JOBS) DUR(m,j)*rank(j,p) + sum(p in 1..k-1) empty(m,p) ! First machine has no idle times forall(k in 1..NJ-1) empty(1,k) = 0 ! First job has no waiting times forall(m in 1..NM-1) wtime(m,1) = 0 forall(j in JOBS, k in RANKS) rank(j,k) is_binary (! Alternative formulations using SOS-1: forall(j in JOBS) sum(k in RANKS) k*rank(j,k) is_sos1 forall(k in RANKS) sum(j in JOBS) j*rank(j,k) is_sos1 !) ! Solve the problem minimize(TotWait) ! Solution printing writeln("Total waiting time for last machine: ", getobjval) write(strfmt("Item",-11)) forall(k in RANKS) write(strfmt(getsol(sum(j in JOBS) j*rank(j,k)),3)) writeln forall(m in MACH) do write("Machine ", m, ": ") forall(k in RANKS) write(strfmt(start(m,k).sol,3)) writeln end-do end-model | |||||||||||||||||||||||||||||||||||||||||||||||||
© Copyright 2023 Fair Isaac Corporation. |