Commit 51266eb2 authored by Markus Klinik's avatar Markus Klinik

schedule builder

parent 8e4ce2a9
%% Creator: Inkscape inkscape 0.92.4, www.inkscape.org
%% PDF/EPS/PS + LaTeX output extension by Johan Engelen, 2010
%% Accompanies image file 'greedy-fails.pdf' (pdf, eps, ps)
%%
%% To include the image in your LaTeX document, write
%% \input{<filename>.pdf_tex}
%% instead of
%% \includegraphics{<filename>.pdf}
%% To scale the image, write
%% \def\svgwidth{<desired width>}
%% \input{<filename>.pdf_tex}
%% instead of
%% \includegraphics[width=<desired width>]{<filename>.pdf}
%%
%% Images with a different path to the parent latex file can
%% be accessed with the `import' package (which may need to be
%% installed) using
%% \usepackage{import}
%% in the preamble, and then including the image with
%% \import{<path to file>}{<filename>.pdf_tex}
%% Alternatively, one can specify
%% \graphicspath{{<path to file>/}}
%%
%% For more information, please see info/svg-inkscape on CTAN:
%% http://tug.ctan.org/tex-archive/info/svg-inkscape
%%
\begingroup%
\makeatletter%
\providecommand\color[2][]{%
\errmessage{(Inkscape) Color is used for the text in Inkscape, but the package 'color.sty' is not loaded}%
\renewcommand\color[2][]{}%
}%
\providecommand\transparent[1]{%
\errmessage{(Inkscape) Transparency is used (non-zero) for the text in Inkscape, but the package 'transparent.sty' is not loaded}%
\renewcommand\transparent[1]{}%
}%
\providecommand\rotatebox[2]{#2}%
\newcommand*\fsize{\dimexpr\f@size pt\relax}%
\newcommand*\lineheight[1]{\fontsize{\fsize}{#1\fsize}\selectfont}%
\ifx\svgwidth\undefined%
\setlength{\unitlength}{292.72558594bp}%
\ifx\svgscale\undefined%
\relax%
\else%
\setlength{\unitlength}{\unitlength * \real{\svgscale}}%
\fi%
\else%
\setlength{\unitlength}{\svgwidth}%
\fi%
\global\let\svgwidth\undefined%
\global\let\svgscale\undefined%
\makeatother%
\begin{picture}(1,0.20472993)%
\lineheight{1}%
\setlength\tabcolsep{0pt}%
\put(-0.0030175,0.08198805){\makebox(0,0)[lt]{\lineheight{1.25}\smash{\begin{tabular}[t]{l}Resource A\end{tabular}}}}%
\put(-0.0030175,0.01793489){\makebox(0,0)[lt]{\lineheight{1.25}\smash{\begin{tabular}[t]{l}Resource B\end{tabular}}}}%
\put(0,0){\includegraphics[width=\unitlength,page=1]{greedy-fails.pdf}}%
\put(0.21476325,0.08198805){\makebox(0,0)[lt]{\lineheight{1.25}\smash{\begin{tabular}[t]{l}Task 1 (capA)\end{tabular}}}}%
\put(0,0){\includegraphics[width=\unitlength,page=2]{greedy-fails.pdf}}%
\put(0.47097591,0.01793489){\makebox(0,0)[lt]{\lineheight{1.25}\smash{\begin{tabular}[t]{l}Task 2 (capB)\end{tabular}}}}%
\put(0,0){\includegraphics[width=\unitlength,page=3]{greedy-fails.pdf}}%
\put(0.72718857,0.01793489){\makebox(0,0)[lt]{\lineheight{1.25}\smash{\begin{tabular}[t]{l}Task 3 (capB)\end{tabular}}}}%
\put(0,0){\includegraphics[width=\unitlength,page=4]{greedy-fails.pdf}}%
\put(0.19426624,0.18191099){\makebox(0,0)[lt]{\lineheight{1.25}\smash{\begin{tabular}[t]{l}0\end{tabular}}}}%
\put(0,0){\includegraphics[width=\unitlength,page=5]{greedy-fails.pdf}}%
\put(0.4504789,0.18191099){\makebox(0,0)[lt]{\lineheight{1.25}\smash{\begin{tabular}[t]{l}10\end{tabular}}}}%
\put(0,0){\includegraphics[width=\unitlength,page=6]{greedy-fails.pdf}}%
\put(0.70669155,0.18191099){\makebox(0,0)[lt]{\lineheight{1.25}\smash{\begin{tabular}[t]{l}20\end{tabular}}}}%
\put(0,0){\includegraphics[width=\unitlength,page=7]{greedy-fails.pdf}}%
\put(0.96290421,0.18191099){\makebox(0,0)[lt]{\lineheight{1.25}\smash{\begin{tabular}[t]{l}30\end{tabular}}}}%
\end{picture}%
\endgroup%
<svg width="395" height="100"><text x="5px" y="64px">Resource A</text><text x="5px" y="89px">Resource B</text><g><title>Task 1
capA=Resource A</title><rect width="100" height="20" fill="rgb(243,146,146)" stroke="rgb(0,0,0)" stroke-width="2px" x="85px" y="50px"></rect><text x="90px" y="64px">Task 1 (capA)</text></g><g><title>Task 2
capB=Resource B</title><rect width="100" height="20" fill="rgb(118,146,243)" stroke="rgb(0,0,0)" stroke-width="2px" x="185px" y="75px"></rect><text x="190px" y="89px">Task 2 (capB)</text></g><g><title>Task 3
capB=Resource B</title><rect width="100" height="20" fill="rgb(203,243,146)" stroke="rgb(0,0,0)" stroke-width="2px" x="285px" y="75px"></rect><text x="290px" y="89px">Task 3 (capB)</text></g><line x1="85px" y1="35px" x2="395px" y2="35px" stroke="rgb(0,0,0)" stroke-width="2px"></line><g><line x1="85px" y1="30px" x2="85px" y2="40px" stroke="rgb(0,0,0)" stroke-width="2px"></line><text x="82px" y="25px">0</text></g><g><line x1="185px" y1="30px" x2="185px" y2="40px" stroke="rgb(0,0,0)" stroke-width="2px"></line><text x="182px" y="25px">10</text></g><g><line x1="285px" y1="30px" x2="285px" y2="40px" stroke="rgb(0,0,0)" stroke-width="2px"></line><text x="282px" y="25px">20</text></g><g><line x1="385px" y1="30px" x2="385px" y2="40px" stroke="rgb(0,0,0)" stroke-width="2px"></line><text x="382px" y="25px">30</text></g></svg>
......@@ -5,7 +5,7 @@ In this section we describe some design decisions of the implementation of our m
We have implemented our algorithm in the functional programming language Clean.
The source code is available at our university's GitLab.\footnote{\url{https://gitlab.science.ru.nl/mklinik/ga-scheduler}}
The implementation works in two phases.
The scheduler works in two phases.
Phase one uses a genetic algorithm to find a set of good assignments for a given instance definition.
Phase two uses these assignments to build schedules.
......@@ -142,8 +142,49 @@ This results in smaller intermediate numbers, which decreases the chance for inf
\subsection{Greedy Schedule Building}
Depth-first dependency resolution.
This allows modelling task priorities: first in list gets scheduled first.
Our schedule builder is a modified variant of the one by \citet{MyszkowskiLNS2018}.
Given a valid assignment, it builds a schedule as follows.
\begin{itemize}[noitemsep]
\item It always keeps track of the earliest point in time when each resource is available.
Initially, this is 0 for every resource.
\item For every task in the instance definition, in the order in which they occur, first schedule all predecessor tasks.
\item Then, when a task has no more unscheduled predecessors, find the earliest time where all resources assigned to that task are available.
This becomes the start time of the task.
\item Finally, update the resource availabilities by setting them to the end time of the task.
\item Repeat until all tasks are scheduled.
\end{itemize}
The difference between our schedule builder and the one by Myszkowski et al.~is that they do not perform depth-first dependency resolution.
In their instance definitions, all predecessors of a task must occur in the instance definition before the task.
Otherwise the generated schedule may violate the ordering constraints.
Our method allows tasks to occur in any order in the instance definition.
This way of schedule building has some of advantages and disadvantages.
It is simple to understand and easy to implement.
An advantage is that it allows modelling task priorities.
Tasks earlier earlier in the instance definition get scheduled first.
Another advantage is that the schedules it builds are valid by construction, where no resource is assigned to two tasks that are overlapping in time, and where tasks are always preceded by their predecessors.
A disadvantage is it does not always find the schedule with the shortest makespan, because it schedules the tasks in the order in which they occur in the instance definition.
It is sometimes possible to find shorter schedules by changing the order of tasks.
Consider the scenario in \cref{fig:greedy-fails}.
There are two resources, A with one capability capA, and B with one capability capB.
There are three tasks 1, 2, and 3, where task 1 requires capA and tasks 2 and 3 require capB.
Furthermore, task 1 is a predecessor of task 2.
There exists only one valid assignment, namely the one shown in \cref{fig:greedy-fails}.
The greedy schedule builder processes tasks in the order in which they occur, so it fails to see that task 3 could be scheduled at time 0.
\begin{figure}
\centering
\def\svgwidth{0.95\linewidth}
\sffamily
\input{greedy-fails.pdf_tex}
\caption{greedy fails}
\label{fig:greedy-fails}
\end{figure}
Finding the shortest schedule for a given assignment is an optimization problem on its own, which we leave for future work.
\subsection{Quality Functions}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment