Optimal design: Scheduling

Definition

In the design of sche­du­les (= sche­du­ling), the goal is to time a set of inter­de­pen­dent tasks in such a way that the total effort requi­red to com­ple­te all tasks is mini­mi­zed. The tasks in ques­ti­on can be indus­tri­al pro­duc­tion pro­ces­ses, staff deploy­ments, or simp­le room allocations.

Illus­tra­ti­ons and qua­li­ty cri­te­ria for sche­du­les have been known sin­ce the ear­ly 20th cen­tu­ry, and the Gantt charts deve­lo­ped during that peri­od are still in use today. The­se charts allow exis­ting sche­du­les to be visua­li­zed in the form of bar dia­grams, sim­pli­fy­ing the com­mu­ni­ca­ti­on of the plan con­tents and faci­li­ta­ting troubleshooting.

The design of sche­du­les is car­ri­ed out eit­her manu­al­ly accor­ding to heu­ristic rules or through optimi­zation algo­rith­ms. The fol­lo­wing exam­p­le illus­tra­tes both approaches.

Example: Problem statement

A machi­ne has to per­form 4 jobs \(J_1, …, J_4\). The­se jobs con­su­me resour­ce amounts \(r_1, …, r_4\) and requi­re pro­ces­sing times \(p_1, …, p_4\).

\(p_1\)\(p_2\)\(p_3\)\(p_4\)in days\(r_1\)\(r_2\)\(r_3\)\(r_4\)in tons
5610121111

The cost of sto­ring the resour­ces is direct­ly pro­por­tio­nal to the amount of resour­ces stored and the sto­rage time and should be mini­mi­zed. The pro­blem is small and simp­le to ana­ly­ze and sol­ve. For this pur­po­se, all poten­ti­al­ly pos­si­ble Gantt dia­grams are plotted.

Figu­re 1: Sketch of the pro­duc­tion plan­ning pro­blem, whe­re 4 jobs are to be exe­cu­ted in an order that mini­mi­zes sto­rage cos­ts for resour­ces (a). The­re are 4!=4*3*2*1=24 dif­fe­rent sequen­ces accor­ding to which the jobs can be car­ri­ed out wit­hout delay. The sto­rage cos­ts \(K\) are also lis­ted (b).

Example: Cost minimization

The cos­ts \(K\) are cal­cu­la­ted as the sum of the resour­ces to be stored and the sto­rage dura­ti­ons accor­ding to the equation

$$\begin{align} K & = r_1(\text{Storage dura­ti­on of resour­ces for Job1})+ r_2(\text{Storage dura­ti­on of resour­ces for Job2})+… \\ & =\sum_{j=1}^4 r_jC_j \end{align}$$

whe­re \(C_j\) is the com­ple­ti­on time of Job \(j\). After com­pa­ring all vari­ants, the best sche­du­le turns out to be

$$\text{Job}_1 \rightarrow \text{Job}_2 \rightarrow \text{Job}_3 \rightarrow \text{Job}_4 \text{ with } K=r_1 5+r_2 11+ r_3 21+r_4 33=70.$$

It can even gene­ral­ly be shown [1, p. 131] that for the abo­ve sys­tem, an arran­ge­ment accor­ding to ascen­ding pro­ces­sing times is opti­mal. If the resour­ce quan­ti­ties \(r_1, …, r_n\) are not all equal, then the WSPT rule (weigh­ted shor­test pro­ces­sing time first) appli­es: the ascen­ding arran­ge­ment accor­ding to the quo­ti­ents \(r_jp_j^{-1}\) is the opti­mal sequence and sol­ves the optimi­zation problem

$$\min_{\text{Schedule}} \sum_{j=1}^n r_jC_j.$$

Generalizations

If the­re are mul­ti­ple dif­fe­rent resour­ces, pro­ces­sing machi­nes, and cons­traints pre­sent, or if a dif­fe­rent qua­li­ty cri­ter­ion is to be opti­mi­zed, then the­re likely exist no opti­mal sche­du­les that can be manu­al­ly con­s­truc­ted fol­lo­wing simp­le rules.

Ins­tead, optimi­zation algo­rith­ms must be employ­ed. Often, the­se are mixed-inte­ger optimi­zation pro­blems, which are com­pu­ta­tio­nal­ly chal­len­ging to sol­ve. A sto­rage cost-mini­mi­zing sche­du­le for \(n\) jobs on \(m\) machi­nes can be for­mu­la­ted as the optimi­zation pro­blem [1, p. 134]

$$\begin{align} \min ~~~& \sum_{i=1}^m \sum_{j=1}^n \sum_{k=1}^nR_{ijk} p_{ij} x_{ikj} && \\ \text{s.t.} ~~~& \sum_{i=1}^m \sum_{k=1}^n x_{ikj}=1 &&j=1, …, n  \\ & \sum_{j=1}^m x_{ikj} \le 1 && i=1, …,m ~ k=1, …, n \\ & x_{ikj}\in \{0,1\} && i=1, …, m ~ k=1, …, n ~ j=1, …, n \end{align}$$

Here, \(p_{ij}\) is the pro­ces­sing dura­ti­on of job \(j\) on machi­ne \(i\), and \(x_{ikj}\) is a bina­ry indi­ca­tor varia­ble signi­fy­ing whe­ther job \(j\) is exe­cu­ted on machi­ne \(i\) in the \(k\)-th last posi­ti­on. The cons­traints ensu­re that each job is assi­gned exact­ly once. The term \(R_{ijk}\) repres­ents the resour­ce quan­ti­ties that need to be stored at the \(k\)-th last moment for pro­ces­sing on machi­ne \(i\). The­se are the resour­ce quan­ti­ties for later pro­jects on machi­ne \(i\) that need to be stored over the dura­ti­on \(p_{ij}\). The­r­e­fo­re, it follows:

$$R_{ijk} = \begin{cases} kr ~~~~~~~~~~~\text{ if } r_1=r_2= … = r_n =:r \\ \sum_{l\le k} x_{ikj}r_j \text{ other­wi­se }\end{cases} $$

In the case of une­qual resour­ce con­sump­ti­on, the optimi­zation pro­blem is non­line­ar in the indi­ca­tor varia­bles \(x_{ikj}\) and can only be sol­ved appro­xi­m­ate­ly, e.g., through rela­xa­ti­ons based on semi­de­fi­ni­te pro­gramming [2].

Example: m machines, n jobs

Howe­ver, if all jobs use the same amount of resour­ces, then with \(R_{ijk}=kr\) as the cur­rent sto­rage quan­ti­ty on machi­ne \(i\), the optimi­zation pro­blem can be for­mu­la­ted as a line­ar pro­gram with the objec­ti­ve function

$$ \sum_{i=1}^m\sum_{j=1}^n \sum_{k=1}^nrkp_{ij}x_{ikj}$$

and the same cons­traints as abo­ve. This pro­blem can be sol­ved, for exam­p­le, with the GLPK sol­ver [3] for mixed-inte­ger line­ar pro­gramming. As the fol­lo­wing exam­p­le shows, the opti­mal results can­not be achie­ved by intui­tively gues­sing a job sequence or tabu­la­ting all poten­ti­al solu­ti­ons. It invol­ves mini­mi­zing resour­ce sto­rage cos­ts for 12 jobs on 3 machi­nes. The pro­ces­sing dura­ti­ons \(p_{ij}\) are as follows:

Machi­ne\ Job123456789101112
111/2211/21/4321/8121
21/2211/21/4321/81211
3211/21/4321/812111/2

The cor­re­spon­ding line­ar pro­gram is

$$\begin{align} \min ~~~ & q^T \operatorname{vec} (x) \\ \text{s.t.} ~~~ & x^TA=\vec{1} \\ & xG \le \vec{1} \\ & x_{ikj}\in \{0,1\} \end{align} $$

whe­re \(q\in \mathbb{R}^{mn^2}, A=[1, …, 1]^T \in \mathbb{R}^{mn}, G=[1, …, 1]^T \in \mathbb{R}^n\). Here, \(\operatorname{vec}\) is the vec­to­riza­ti­on ope­ra­tor, which remo­dels matri­ces into vec­tors. The matri­ces and vec­tors are defi­ned as

$$\begin{align} q & = \operatorname{vec}(Q) ~~~~(Q)_{ikj}=kp_{ij} \\ x & = \begin{bmatrix} x_{111} & \cdots & x_{11n} \\ \vdots & \ddots & \vdots \\ x_{311} & \cdots & x_{31n}\\ x_{121} & \cdots & x_{12n} \\ \vdots & \ddots & \vdots\\ x_{3n1} & \cdots & x_{3nn} \end{bmatrix} \in \mathbb{R}^{mn \times n}\end{align}$$

Example: Solution

The result (GLPK, 60 ms) is given by the fol­lo­wing matrix and asso­cia­ted Gantt-chart.

Figu­re 2: The matrix \(x\) of indi­ca­tor varia­bles (a) and the asso­cia­ted sche­du­le (b).

The objec­ti­ve func­tion atta­ins the value 9.25. Compa­re this to the fol­lo­wing ran­dom­ly sel­ec­ted schedule.

The cos­ts asso­cia­ted to this sche­du­le are

$$\begin{align} K  =& p_{11}(4)+ p_{12}(3)+p_{13}(2)+p_{14}(1)\\ & +p_{25}(4)+p_{26}(3)+p_{27}(2)+p_{28}(1) \\ & + p_{39}(4)+p_{310}(3)+p_{311}(2)+p_{312}(1) \\& = 4(1+1/4+2)+3(1/2+3+1)+2(2+2+1)+1(1+1/8+1/2) \\ & = 38.125 \end{align} $$

The­se cos­ts are more than 4 times as high as tho­se of the opti­mal schedule.

Practical aspects

With 12 jobs, a nai­ve approach to check all job arran­ge­ments would alre­a­dy be chal­len­ging. For just one of the machi­nes, the­re would be \(12! \approx 500 000 000\) arran­ge­ments to expli­cit­ly list and eva­lua­te regar­ding their cons­traints and resour­ce con­sump­ti­on. With three machi­nes, it sur­pas­ses \(10^{16}\), which exceeds the capa­bi­li­ties of nor­mal office computers.

The­re are various other cons­traints and objec­ti­ve func­tions. Typi­cal ones include [1, pp. 14–20]:

  • Machi­ne set­ups: Sin­gle machi­ne, iden­ti­cal machi­nes, machi­nes with dif­fe­rent work speeds, inde­pen­dent machi­nes, flow jobs, job shops, etc.
  • Cons­traints: Inter­rup­ti­bi­li­ty of jobs, sequence con­di­ti­ons, set­up times, wai­ting times, dead­lines, job groups, machi­ne rest­ric­tions, batch pro­ces­sing, etc..
  • Objec­ti­ve func­tions: Sum of com­ple­ti­on times, kee­ping to pro­ces­sing ends and dead­lines, sum of delays, etc.

For many of the abo­ve com­bi­na­ti­ons, it’s not straight­for­ward to for­mu­la­te and sol­ve them as mixed-inte­ger pro­grams. Howe­ver, mathe­ma­ti­cal sche­du­ling can tack­le pro­blems that manu­al plan­ning can­not due to com­ple­xi­ty reasons.

Code & Sources

Exam­p­le code: OD_scheduling.py in our tuto­ri­al­fol­der

[1] Pine­do, Micha­el L. (2016). Sche­du­ling: Theo­ry, Algo­rith­ms, and Sys­tems. Ber­lin, Hei­del­berg: Springer.

[2] Ban­sal, N., Sri­ni­va­san, A., & Svens­son, O. (2016). Lift-and-round to impro­ve weigh­ted com­ple­ti­on time on unre­la­ted machi­nes. Pro­cee­dings of the for­ty-eighth annu­al ACM sym­po­si­um on Theo­ry of Com­pu­ting. Asso­cia­ti­on for Com­pu­ting Machi­nery, New York, NY, USA, 156–167.

[3] GNU Line­ar Pro­gramming Kit: https://www.gnu.org/software/glpk/