\documentclass[a4paper,UKenglish,cleveref, autoref, thm-restate]{lipics-v2021} %This is a template for producing LIPIcs articles. %See lipics-v2021-authors-guidelines.pdf for further information. %for A4 paper format use option "a4paper", for US-letter use option "letterpaper" %for british hyphenation rules use option "UKenglish", for american hyphenation rules use option "USenglish" %for section-numbered lemmas etc., use "numberwithinsect" %for enabling cleveref support, use "cleveref" %for enabling autoref support, use "autoref" %for anonymousing the authors (e.g. for double-blind review), add "anonymous" %for enabling thm-restate support, use "thm-restate" %for enabling a two-column layout for the author/affilation part (only applicable for > 6 authors), use "authorcolumns" %for producing a PDF according the PDF/A standard, add "pdfa" %\pdfoutput=1 %uncomment to ensure pdflatex processing (mandatatory e.g. to submit to arXiv) %\hideLIPIcs %uncomment to remove references to LIPIcs series (logo, DOI, ...), e.g. when preparing a pre-final version to be uploaded to arXiv or another public repository %\graphicspath{{./graphics/}}%helpful if your graphic files are in another directory % my custom commands so that I can write the sets of natural en integer numbers etc. \usepackage{algpseudocode} \usepackage{algorithm} \usepackage{ dsfont } \newcommand{\N}{\mathds{N}} \bibliographystyle{plainurl}% the mandatory bibstyle \title{Scheduling Borrels to maximize students attendance and social experience} %TODO Please add %\titlerunning{Dummy short title} %TODO optional, please use if title is longer than one line \author{Floris van der Hout}{Utrecht University , 7234080, Netherlands}{f.l.vanderhout@students.uu.nl}{}{} \author{Thomas van Maaren}{Utrecht University , 9825827, Netherlands}{t.vanmaaren@students.uu.nl}{}{} \author{ Rens Versnel}{Utrecht University , 2693852, Netherlands}{r.k.versnel@students.uu.nl}{}{} \author{Wessel van der Ven}{Utrecht University , 2828189, Netherlands}{w.j.vanderven@students.uu.nl}{}{} \author{Ids de Vlas}{Utrecht University , 6967396, Netherlands}{i.devlas@students.uu.nl}{}{} \authorrunning{Floris van der Hout, Thomas van Maaren, Rens Versnel, Wessel van der Ven and Ids de Vlas} %TODO mandatory. First: Use abbreviated first/middle names. Second (only in severe cases): Use first author plus 'et al.' \Copyright{Floris van der Hout, Thomas van Maaren, Rens Versnel, Wessel van der Ven and Ids de Vlas} %TODO mandatory, please use full first names. LIPIcs license is "CC-BY"; http://creativecommons.org/licenses/by/3.0/ \ccsdesc[100]{Online algorithms} %TODO mandatory: Please choose ACM 2012 classifications from https://dl.acm.org/ccs/ccs_flat.cfm \keywords{Borrels Scheduling, NP-completeness, competitive ratio's} %TODO mandatory; please add comma-separated list of keywords \category{} %optional, e.g. invited paper \relatedversion{} %optional, e.g. full version hosted on arXiv, HAL, or other respository/website %\relatedversiondetails[linktext={opt. text shown instead of the URL}, cite=DBLP:books/mk/GrayR93]{Classification (e.g. Full Version, Extended Version, Previous Version}{URL to related version} %linktext and cite are optional %\supplement{}%optional, e.g. related research data, source code, ... hosted on a repository like zenodo, figshare, GitHub, ... %\supplementdetails[linktext={opt. text shown instead of the URL}, cite=DBLP:books/mk/GrayR93, subcategory={Description, Subcategory}, swhid={Software Heritage Identifier}]{General Classification (e.g. Software, Dataset, Model, ...)}{URL to related version} %linktext, cite, and subcategory are optional %\funding{(Optional) general funding statement \dots}%optional, to capture a funding statement, which applies to all authors. Please enter author specific funding statements as fifth argument of the \author macro. \acknowledgements{}%optional %\nolinenumbers %uncomment to disable line numbering %Editor-only macros:: begin (do not touch as author)%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % \EventEditors{John Q. Open and Joan R. Access} % \EventNoEds{2} % \EventLongTitle{42nd Conference on Very Important Topics (CVIT 2016)} % \EventShortTitle{CVIT 2016} % \EventAcronym{CVIT} % \EventYear{2016} % \EventDate{December 24--27, 2016} \EventLocation{} \EventLogo{} \SeriesVolume{} \ArticleNo{5} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \begin{document} \maketitle %TODO mandatory: add short abstract of the document \begin{abstract} A challenge for event organizers is attracting the maximum number of attendees. In this paper we introduce the borrel scheduling problem. We prove that no deterministic algorithm can achieve a constant competitiveness for the problem in a number of online settings with different restrictions. Moreover, we show that this problem is NP-hard in the offline setting even for a restricted case. To cope with this hardness we have created a brute forcing algorithm for an offline setting. We introduce a social matrix to take social relationships into account in the borrel scheduling problem, which is also solved by our offline algoritm. Finally we evaluate our offline algorithm with a number of experiments. % A challenge for event organizers is attracting the maximum number of attendees while also making sure the attendees are with their friends. In this paper we introduce the borrel planning problem with social matrix. We show that this problem is NP-hard even for a highly restricted case. To cope with this hardness we have created a brute forcing algorithm for an offline setting. Moreover we prove that no deterministic algorithm can achieve a constant competitiveness for the problem without the social matrix in a number of online settings with different restrictions. Finally we evaluate our offline algorithm with a number of experiments. \end{abstract} \section{Introduction} Image you are part of the student organization responsible for organizing ``borrels'' (social gatherings) for freshmen. However, the freshmen have many obligations such as deadlines, group meetings, exams, ect. These obligations are flexible and can be rescheduled or delayed, but they still need to be completed eventually. Freshmen are eager to attend the borrels and will do so as long as they don't have any conflicting obligations. However, if their schedules clash with their obligations, they will prioritize those obligations over the borrel. Borrels are typically free for students to attend, but they do incur costs for the student organization, such as renting a venue, providing snacks, and other logistical expenses. It's common for borrels to offer the first drink for free, but any additional drinks must be purchased. The revenue generated from drink sales is used to help cover the borrels costs. If students enjoy themselves, they're more likely to buy drinks. One key factor that can enhance their experience is being able to attend the borrels with their friends. Therefore, it's in the student organization's interest to not only focus on attendance but also on maximizing the happiness of the freshman by scheduling borrels in a way that allows groups of friends to participate together. This can boost the overall success of the event both socially and financially. \\ This paper will present two offline algorithms for scheduling borrels: one focused on optimizing student attendance, and the other designed to maximize the overall happiness of the freshman by considering factors like social connections and shared availability. Additionally, we will provide problem competitive ratios for online algorithms which focusing on maximizing the attendance of freshmen at the borrels in multiple scenario's. \subsection{Literature review} We will visit several relevant problems in the literature, the first of which is the Social Event Scheduling Problem (SES) \cite{SocialEventPlanning}. In this context, the goal is to schedule a series of events or borrels while maximizing attendance or overall utility, considering that third-party events (in our problems context obligations) are already scheduled. Utility is defined as the expected attendance across all scheduled events. The difference between Borrels Scheduling and Social Event Scheduling lies in how competing events are treated. In the SES problem, competing events are those that have already been scheduled by third parties, resulting in fixed time slots. In contrast, our constraints, which can be viewed as competing events, can often be postponed within their designated time windows. Furthermore, in the SES problem, each event is assigned a probability indicating a user's likelihood of attending. If two events overlap, the probability distribution determines which event the user will choose. However, if there are 5 events, we cannot impose a requirement for users to attend exactly 4 out of 5 third-party events (the obligations) while leaving the remaining event slots for our events (borrels). In our case, the probability of attending an event changes based on which event the user chooses to attend. There is no trivial way to translate the Borrel Scheduling problem into the SES problem. \\ Another relevant problem is the Optimization Of Calendar Events. Especially when optimizing the scheduling of meetings within large organizations, where the objective is to maximize attendance while considering each participant's individual schedule/calendar. Since it is not always feasible for everyone to attend, the focus shifts to maximizing the number of attendees at the meeting which is similar to our problem \cite{distributedOptimizationOfCalendarEvents} \cite{EventSchedulingWithSoftConstraints}. However, solutions derived from this model are not directly applicable to our problem. In these frameworks, a participant calendars time slots are either marked available or unavailable which is different from our problem. In our case, there is a time window within which certain obligations must be fulfilled, but the exact timing has yet to be determined. This differs from the SES problem because the Optimization Of Calendar Events allows for soft constraints. Soft constraints refer to events in a user's schedule that can be rescheduled to another date for a small penalty cost. This approach resembles the Borrel Scheduling problem, where rescheduling is allowed if the event can be moved to another time within the available time slot. However, incorporating this flexibility significantly complicates the problem, making it more challenging to solve. \\ The final relevant problem is the Job Scheduling Problem with Deadlines \cite{JobShopSchedulingWithDeadlines}, which closely parallels the obligation and borrel planning aspects of our study. In this scenario, each obligation can be viewed as a job that needs to be scheduled on a specific machine, with both a deadline and a start time. Similarly, we have borrels that also need to be scheduled on these machines. In our problems context, we want to maximize for the scheduling borrels on different machines simultaneously, the same as maximizing attendance at the events. However, this is different from the objective in the job scheduling problem with deadlines which is to minimize the makespan while ensuring that all tasks remain feasible within their respective constraints. There is no trivial way to translate the Borrel Scheduling problem to the Job Scheduling problem with deadlines. \section{Preliminaries} \subsection{Formal problem definition} The timeline is partitioned into t integral time slots. The time interval from time 0 (inclusively) to time 1 (exclusively) is time slot 1, and the time interval from time $i - 1$ (inclusively) to time $i$ (exclusively) is time slot i for all $i \geq 1$. There are $m$ borrels, and each borrel $h$ has a length of $b_h$ time slots. There are $n$ students. Each student $i$ has a set of obligations $I_i = \{(I_{i,1}, p_{i,1}), (I_{i,2}, p_{i,2}), ... , (I_{i,l_i} , p_{i,l_i} )\}$, where $I_{i,j} = [r_{i,j} , d_{i,j} ]$ is a time interval from time slot $r_{i,j}$ to time slot $d_{i,j}$ , and $p_{i,j}$ is the time slots needed by the obligation $j$ that has to be finished within $I_{i,j}$ . A feasible schedule for a student $i$ of obligation $j$ is a schedule $S_{i,j}$ , which is a set of time slots, such that $S_{i,j} \subseteq I_{i,j}$ and $|S_{i,j}| = p_{i,j}$ . Moreover, for a student $i$ and two of their obligations $j$ and $j'$, $S_{i,j} \cap S_{i,j'} = \varnothing$. Note that we assume $p_{i,j}$ are integral for all $i$ and $j$, and we cannot assign a time slot partially to an obligation. As a borrels planner, you aim to schedule each borrel $h$ starting at time slot $s_h$ and lasting until time slot $s_h + b_h - 1$, such that as many students attend the borrels as possible. More formally, you want to find the start time $s_h$ of each borrel $h$ such that there exists a set of feasible schedules $S_{i,j}$ for every pair of student $i$ and obligation $j$ such that the conflict among the borrels and the students’ schedules, $[s_h, s_h + b_h - 1] \cap S_{i,j} \neq \varnothing$ for some $i$ and $j$, is minimized. We also assume that borrels start at integral time (that is, the beginning of a time slot). \subsubsection{Offline setting} In the offline setting, all the parameters are known to the algorithm from the very beginning. That is, the algorithm knows $t$, $m$, $b_h$ for all $h \in [1, m]$, $n$, and $I_i$ for all $i \in [1, n]$. Once the algorithm receives the information, it should suggest schedules for all borrels. \subsubsection{Online setting} In the online setting, the online algorithm knows the number of time slots ($t$), the number of students ($n$), the number of borrels ($m$), and all $b_h$ for each borrel $h$ in the beginning but only learns about $I_{i,j} = [r_{i,j} , d_{i,j} ]$ and $p_{i,j}$ at the beginning of time slot $r_{i,j}$ (that is, at time $r_{i,j} - 1$). The online algorithm has to decide if a borrel will start at time slot $x + 1$ right at time $x$ (that is, the beginning of time slot $x + 1$). Formally, at time $x$ (that is, the beginning of time slot $x + 1$), the algorithm first learns the obligations that have release time at time slot $x + 1$ and then decides if it wants to schedule a borrel starting from time slot $x + 1$. \subsubsection{Decision problem} \label{decision-problem} % This is the outline % In this section we will formulate the decision version of the borrel scheduling problem in which the aim is to decide if there exists a feasible schedule of borrels such that there are at least $k$ attendances for some $k\in\N$. We will use most of the formulation of the original borrel scheduling problem but change the objective. % This is the actual thing In order to prove the complexity class of borrel scheduling it needs to be formulated as a decision problem. The aim of the original problem is to schedule each borrel $h$ starting at time slot $sh$ and lasting until time slot $s_h + b_h - 1 $, such that as many students attend the borrels as possible. In the decision version of this problem the aim is then to decide if there exists an assignment of borrels to timeslots such that there are at least $k$ attendances in total for some $k\in \N$. % maybe move this formal definition below to somewhere far away (or just delete it) %More formally, the aim is to decide if there exists a start time $s_h$ for each borrel $h$ such that there exists a set of feasible schedules $S_{i,j}$ for every pair of student $i$ and obligation $j$ where the number of attendances is at least some $k\in \N$. The number of attendances can be defined by defining the set of possible attendances $A = \{(h, i) : \forall j, [s_h, s_h+b_h-1] \cap S_{i,j} = \emptyset \}$. The actual attendances of borrels is a subset $G\subseteq A$ where for any two attendances $(h_1,i_1), (h_2,i_2)\in G: i_1 \neq i_2 \vee [s_{h_1}, s_{h_1}+b_{h_1}-1] \cap [s_{h_2}, s_{h_2}+b_{h_2}-1] = \emptyset$. If there exists a set $G$ with a cardinality of at least some $k\in \N$ for some borrel schedule, then the answer to the decision problem should be positive (``yes'' or ``accept''). % I think the formal formulation of the problem in the borrel.pdf is not complete or not correct, so I made my own shitty one. Maybe I should just stick to the less formal formulation because this is kind of a mess.. \subsubsection{Borrel scheduling with at most 2 concurrent obligations (BS-2CO)} \label{BS-2CO} We define a special case of borrel scheduling, henceforth referred to as BP-2CO, where each student has at most two obligations at every timeslot. More formally, For all students $i$ and any three obligations $o_1,o_2,o_3 \in I_i$ they do not span a common timeslot unless some of these obligations are the same: $(o_1 \neq o_2 \wedge o_2 \neq o_3 \wedge o_3 \neq o_1) \implies o_1 \cap o_2 \cap o_3 = \emptyset$. The decision version of this problem is defined analogous to the decision version of the original version \ref{decision-problem}. \subsection{Set cover} In order to prove NP-hardness, we will consider the set cover decision problem with a universe $U=\{u_1,u_2,...,u_{|U|}\}$ containing all possible elements and the set $\mathcal{S}= \{S_1,S_2,...,S_{|\mathcal{S}|}\}$ containing subsets of the universe $U$ and a goal $g\in \N$. The set $\mathcal{S}$ must contain all elements in the universe, so its union must equal $U$: $\bigcup_{S_a\in\mathcal{S}} S_a = U$. The aim in the set cover problem is to decide if there exists a subset $A$ of $\mathcal{S}$ such that the union of $A$ is equal to $U$ and $|A| \leq g$. % This is the actual thing %We consider the set cover decision problem with a universe $U=\{1,2,...,n\}$ containing all possible elements and the set $S$ containing $m$ subsets of the universe $U$ and a goal $k\in \N$. %(We can require that the union of $S$ is equal to $U$, but this is not strictly necessary when considering the decision problem, I think). %The aim in the set cover problem is to decide if there exists a subset $A$ of $S$ such that the union of $A$ is equal to $U$ and $|A| \leq k$. We will construct an instance of the borrel scheduling decision problem whose answer is the same as the answer to this set cover problem. \section{Problem competitive ratio} \subsection{Base problem} \label{base} To prove the competitive ratio of the base problem we will start by taking in to consideration the following adversary cases: \\ $A := \{t = 2, m = 1, b_1 = 1, \forall i : 1 < i \leq n : I_i = \{([t_1,t_1],1)\}\} $ \\ $OPT(A) = n$ where $b_1$ is held at $t_2$ \\ $B := \{t = 2, m = 1, b_1 = 1, I_1 = \{([t_2,t_2],1)\}, \forall i : 1 < i \leq n : I_i = \{([t_1,t_1],1),([t_2,t_2]1)\}\} $ \\ $OPT(B) = 1$ where $b_1$ is held at $t_1$ \\ \\ For both cases every student except for one has an obligation at timeslot $t_1$. Note that $A \subset B$, and the adversary can freely choose to switch after $t=1$ between these cases depending on the behaviour of any arbitrary online algorithm. Since there exists one borrel $b_1$ with length 1 every online algorithm can either plan this borrel on $t_1$ or not, creating two possible cases. \\ If some algorithm $ALG_1$ chooses to host the borrel on $t_1$ then the adversary case is $A$ where $ALG_1(A) = 1$ and $OPT(A) = n$ giving a competitive ratio of $\frac{OPT(A)}{ALG_1(A)} = \frac{n}{1} = n$. \\ If some algorithm $ALG_2$ chooses not to host the borrel on $t_1$ then the adversary case is $B$ where $ALG_2(B) = 0$ and $OPT(B) = 1$ giving a competitive ratio of $\frac{OPT(B)}{ALG_2(B)} = \frac{1}{0} = \infty$ \\ \\ This gives the problem a competitive ratio of $n$ \\ \\ Moreover, every algorithm hoping to attain a competitive ratio $c < \infty$ should always plan a borrel the first chance it gets to avoid having a score of 0. \subsection{Multiple borrels} \label{multiple} Now we will investigate the competitive ratio when $m = 2$. Every algorithm must still schedule a borrel at the first possible moment where at least one person can attend for the same reasons as $m=1$, but after that the algorithm has a lot more freedom and can't be ``forced'' to perform an action anymore. This still isn't enough to achieve a constant competitive ratio however. \\ To provide a lower bound of the competitive ratio of the problem with $m = 2$, we'll look at the following set of cases:\\ $A := \{t = 3, m = 2, b_1 = 1, b_2 = 1, I_1 = \{([t_2,t_3], 2)\}, \forall i : 1 < i \leq n : I_i = \{([t_1,t_1],1), ([t_2,t_3], 2)\}\} $ $OPT(A) = 1$, where $b_1$ is held at $t_1$. $b_2$ can be held at any time and not affect the score. \\ $\forall 1 \leq p \leq n: B_p := \{t = 3, m = 2, b_1 = 1, b_2 = 1, I_1 = \{([t_2,t_2], 1)\}, \forall i : p < i \leq n: I_i = \{([t_1,t_1],1), ([t_2,t_2], 1)\}, \forall j: 1 < j \leq p: I_j = \{([t_1, t_1],1)\}$\\ $OPT(B_p) = n+p$ where $b_1$ is held at $t_2$, and $b_2$ is held at $t_3$.\\ $\forall 1 \leq p \leq n: C_p := \{t = 3, m = 2, b_1 = 1, b_2 = 1, I_1 = \{([t_2,t_2], 1), ([t_3, t_3],1)\}, \forall i : p < i \leq n : I_i = \{([t_1,t_1],1), ([t_2,t_2], 1), ([t_3, t_3], 1)\}, \forall j: 1 < j \leq p: I_j = \{([t_1, t_1],1), ([t_3, t_3],1)\}\}$\\ $OPT(C_p) = p+1$, with $b_1$ held at $t_1$ and $b_2$ at time $t_2$.\\ Adversary cases $B_p$ and $C_p$ can be understood as cases where $p$ people will be able to attend at $t_2$. To start, any arbitrary online algorithm must schedule a borrel at $t_1$, because if this the algorithm decides to forgo this, the adversary can switch to case $A$, which would result in a competitive ratio $\frac{OPT(A)}{ALG(A)} = \frac{1}{0} = \infty$. Therefore, we will assume every algorithm chooses to schedule their first borrel at timeslot $t_1$. For the purpose of contradiction, we assume an online algorithm $ALG$ with a competitive ratio of $c$ exists. This algorithm must forgo scheduling a borrel at $t_2$ if there are less than $\frac{n}{c}$ students that can attend. However, this still gives a contradiction. Consider $B_{\lfloor\frac{n}{c}\rfloor-1}$. If $ALG$ does schedule a borrel at timeslot $t_2$, the amount of people that will be able to attend is equal to $\lfloor\frac{n}{c}\rfloor-1+1 = \lfloor\frac{n}{c}\rfloor$. This would result in a competitive ratio of $\frac{OPT(B_{\lfloor\frac{n}{c}\rfloor-1})}{ALG(B_{\lfloor\frac{n}{c}\rfloor-1})} = \frac{n + \lfloor\frac{n}{c}\rfloor-1}{\lfloor\frac{n}{c}\rfloor} \geq c + 1 - \frac{c}{n}$. As long as $n > c$, $c+1 - \frac{c}{n} > c$ so the performance is worse than $c\cdot OPT(B_{\lfloor\frac{n}{c}\rfloor-1})$. Therefore an algorithm that would schedule a borrel at timeslot $t_2$ for $p = {\lfloor\frac{n}{c}\rfloor-1}$ would not have a competitive ratio of $c$. This means an online algorithm that schedules a borrel at $t_2$ for $B_{\lfloor\frac{n}{c}\rfloor-1}$ cannot have a constant competitive ratio $c$. Now consider the case where $ALG$ does not schedule a borrel at timeslot $t_2$. Looking at the case $C_{\lfloor\frac{n}{c}\rfloor-1}$ will give us that $ALG(C_{\lfloor\frac{n}{c}\rfloor-1}) = 1 + 0$, as the first borrel must be placed at $t_1$ with 1 person attending, and the second borrel must be planned at $t_3$ with 0 people attending. $OPT(C_{\lfloor\frac{n}{c}\rfloor-1}) = \lfloor\frac{n}{c}\rfloor-1+1 = \lfloor\frac{n}{c}\rfloor$. Therefore the competitive ratio for any algorithm that does not schedule a borrel at $t_2$ in the case of $C_{\lfloor\frac{n}{c}\rfloor-1}$ is equal to $\frac{OPT(C_{\lfloor\frac{n}{c}\rfloor-1})}{ALG(C_{\lfloor\frac{n}{c}\rfloor-1})} = \frac{\lfloor\frac{n}{c}\rfloor}{1} = \lfloor\frac{n}{c}\rfloor$ which is greater than $c$ for every $n > c^2 + c$. Since $ALG$ cannot attain a competitive ratio of $c$ regardless of the decision it makes in the case of $p = {\lfloor\frac{n}{c}\rfloor-1}$, $ALG$ cannot have a competitive ratio of $c$ and therefore our assumption that an online algorithm with a constant competitive ratio exists must be false. \subsection{Lookahead} Next we will look at the problem where the algorithm can look $k$ timeslots ahead instead of 1. So in a setting with $k=3$ the algorithm would be able to see obligation information about timeslots $\{t_1,t_2,t_3\}$ at timeslot $t_1$ and timeslots $\{t_2,t_3,t_4\}$ at timeslot $t_2$.\\ \\ If $k \geq t$ the problem is simply the offline problem and thus trivial with a competitive ratio of $c=1$. \\ \\ For a smaller $k$ the competitive ratio can be proven similarly to the base problem with adversary cases: \\ $A := \{t = k + 1, m = 1, b_1 = 1, \forall i : 1 < i \leq n : I_i = \{([t_1,t_k],1)\}\} $ \\ $OPT(A) = n$ where $b_1$ is held at $t_{k+1}$ \\ $B := \{t = k + 1, m = 1, b_1 = 1, I_1 = \{([t_{k+1},t_{k+1}],1)\}, \forall i : 1 < i \leq n : I_i = \{([t_1,t_k],1),([t_{k+1},t_{k+1}]1)\}\} $ \\ $OPT(B) = 1$ where $b_1$ is held at $t_1$ \\ \\ At timeslot $t_1$ any algorithm will see a timeslot with 1 free student at $t_1$ and 0 free students at $\{t_2...t_k\}$ creating once again the same choice every algorithm must make at $t_1$ for hosting a borrel at $t_1$. \\ \\ Then like the base problem: If some algorithm $ALG_1$ chooses to host the borrel on $t_1$ then the adversary case is $A$ where $ALG_1(A) = 1$ and $OPT(A) = n$ giving a competitive ratio of $\frac{OPT(A)}{ALG_1(A)} = \frac{n}{1} = n$. \\ If some algorithm $ALG_2$ chooses not to host the borrel on $t_1$ then the adversary case is $B$ where $ALG_2(B) = 0$ and $OPT(B) = 1$ giving a competitive ratio of $\frac{OPT(B)}{ALG_2(B)} = \frac{1}{0} = \infty$. The adversary can freely switch between these after the algorithm has chosen whether to plan a borrel at $t_1$, as the revealed information is exact same. \\ \\ This gives this problem also a competitive ratio of $n$. \subsection{Combination of lookahead and multiple borrels} Combining all previous restrictions is unfortunately also uncompetitive. This can be proven with the same proof as the one used to proof multiple borrels \ref{multiple} is uncompetive, with the addition of ``stalling obligations'' to make lookahead ineffective. These stalling obligations could be obligations between the obligations placed in the original proof with a lenght greater than or equal to the amount of lookahead. This would provide the algorithm with the same amount of information as in the case of multiple borrels, and would therefore achieve the same competitiveness. %possible additional restrictions: Minstens 1 timeslot vrij tussen obligaties (sterkere versie van non-overlapping), alleen niet heel spannend (met behulp van een "trap" kan dit gebroken worden) maar misschien met tk$ will remain the same. We see that $f(s) = (0,\dots,0,s_k+1,s_{k+1},\dots,s_m)$, hence \begin{align*} i \circ f\circ i^{-1}(n)&= i(0,\dots,0,s_k+1,s_{k+1},\dots,s_m)\\ &=i(t+1-b_1,\dots,t+1-b_{k-1},s_k,\dots,s_m)+1\\ &= i(s)+1=n+1=(n+1)\mod \#X-1. \end{align*} We therefore see that $\{i \circ f^n\circ i^{-1}(0)\mid n \in\mathbb{N}\} = \{0,\dots,\#X-1\}$, hence \[\{f^n(1,\dots,1)\mid n \in\mathbb{N}\} = X\] \end{proof} \subsubsection{Subsets}\label{BorSub} For each student we need to make a decision on which borrels they should attend. Again we need to go through all possibilities to see which choice is the best. The easiest way of doing this is by using the binary counter method. Given a set $T$ we make a binary number $b$ that has the same amount of bits as $T$ has elements. A $1$ in the $i$-th digit indicates that the $i$-th element of $T$ is part of $S$ and a $0$ indicates that it is not part of $S$. By incrementing this number until all bits are set to 1 we get all possible subsets. For example if $T=\{12,2,4\}$ we get the following iteration as seen in table \ref{binaryCount}. \begin{table}[h] \begin{tabular}{|c|c c c c c c c c|} \hline b& 000 & 001 & 010 & 011 & 100 & 101 & 110 & 111 \\\hline S& $\emptyset$ & $\{12\}$ & $\{2\}$ & $\{2,12\}$ & \{4\} & $\{12,4\}$ & $\{2,4\}$ &\{12,2,4\}\\\hline \end{tabular} \caption{Subset iteration when using the binary counter method.} \label{binaryCount} \end{table} The downside of using this method in our case is that we would be doing a lot of unnecessary work. Assume that it is possible for a student to go to a set of borrels $B$. If $C\subset B$ we know that $C$ can not contain more borrels and therefore it will always be able to go to the borrels in $C$. It is therefore much better to use an iteration where bigger subsets come first (See table \ref{bigSetFirst}). The subset iterator will use a separate procedure called the fixed subset iterator which will iterate over subsets of the same size (see algorithm \ref{subsetIt}). The subset iterator will keep lowering the size of the sets until there are no elements left (see algorithm \ref{notFixedSub}). \begin{table}[h] \begin{tabular}{|c|c c c c c c c c|} \hline S & $\{12,2,4\}$ & $\{12,2\}$ & $\{12,4\}$ & \{2,4\} & $\{12\}$ & $\{2\}$ &\{4\} & $\emptyset$\\\hline \end{tabular} \caption{Subset iteration when asserting that bigger subsets should come first.} \label{bigSetFirst} \end{table} We will first prove that the fixed subset iterator is correct, by proving that it will eventually pass through all subsets of the given size. For a given finite set $C=\{c_1,\dots,c_{\#C}\}$ we will define $f:\mathcal{p}(C)\to \mathcal{p}(C)$ as $f(A) = \pi_2\circ \text{fSubIt}(A,C)$ where $\pi_2$ is the second projection. \begin{lemma}\label{iterateSets} Define \[i^*:= \max\{1\leq i\leq \#C \mid c_i\in A \mid c_i \in A,\#(\{c_i,\dots,c_{\#C}\}\cap A)\leq \#C -i\}\]. Then \[f(A) = C\backslash \{c_i\} \cup \{c_i,\dots,c_{i+j}\}\backslash\{c_{i+j+1},\dots,c_{\#C}\}\] for an $A\subset C$ unequal to $A\neq \{c_1,\dots c_{\#A}\}$ \end{lemma} \begin{proof} We see that once the program has reached line 8 of algorithm \ref{subsetIt} that $c_i\in A$ and that $j\leq \#C-i$. We also see that that $j$ was inceremented every time $c_i\in A$, hence $j=\#(\{c_i,\dots,c_{\#C}\}\cap A)$, so $\#(\{c_i,\dots,c_{\#C}\}\cap A)\leq \#C -i$. We also that the $i$ at line 8 is the biggest with this property, because the algorithm has started with $f = \#C$, and has decremented $i$ since. Therefore we can say that $i=i^*$ at line 8. Now we see that \[f(A) = C\backslash \{c_i\} \cup \{c_i,\dots,c_{i+j}\}\backslash\{c_{i+j+1},\dots,c_{\#C}\}.\] \end{proof} We will now give every $A\subset C$ the following index $i(A):= \sum_{i=1}^{\#C}2^{i-1}\cdot 1_{c_i\in A}$. For any number $n\in \N$ we define $\#n$ as the amount of 1's in $n$'s binary notation. For example $\#4=1$ and $\#10=2$. Note that $\#i(A)=\#A$ for any set subset $A$. \begin{lemma}\label{iterateNumbers} Let $0\leq n< 2^{\#C}$. Assume that there exists a smallest $0\leq k\#k=\#n$. We know that $\#(\{c_{i^*},\dots,c_{\#C}\}\cap A)\leq \#C-i^*$ and $\#(\{c_{i^*+1},\dots,c_{\#C}\}\cap A)\geq \#C-i^*-1$, because $i^*$ is the maximum. Therefore $\#(\{c_{i^*},\dots,c_{\#C}\}\cap A)=1+\#(\{c_{i^*+1},\dots,c_{\#C}\}\cap A)\leq \#C-i^*$, hence $\#(\{c_{i^*},\dots,c_{\#C}\}\cap A)=\#C-i^*$. If $l\geq i^{-1}(A\cap\{c_1,\dots,c_{i^*})$, there has to be a $i>i^*$ such that $c_{i}\in A$. Because $i^*$ is the maximum we know that $\#(\{c_{i},\dots,c_{\#C}\}\cap A)>\#C-i^*$, hence $\{c_{i},\dots,c_{\#C}\}\subset A$ and therefore $\#l< \#n$. We conclude that $l$ cannot have the property that $\#k=\#n$, hence $k$ is the smallest value such that $\#k=\#n$. \begin{proof} We leave this as an exercise for the reader. %TODO \end{proof} \begin{theorem} The fSubIt$(A,C)$ procedure will eventually pass through all subsets of $C$ that have the same size as $A$. \end{theorem} \begin{proof} Let $0 \leq m\leq \#C$. Define $X:= \{0\leq 1< n < 2^{\#C}\mid \#n=m\}$ Take the set $A:=\{c_{\#C},\dots,c_{\#C-m+1}\}$. We see that $i(A)=\max(X)$. Because $X$ is finite and because of lemma \label{iterateNumbers}, we see that $\{(i\circ f \circ i^{-1})^n (A)\mid n\in \N\}= X$. This means that $\{f^n(A) \mid n\in \N\} = i^{-1}(X) = \{A'\subset C \mid \#A' = t\}$. Hence we see that all subsets of length $t$ are passed by the fixed subset iterator. \end{proof} \subsection{Base case} Now we will provide an algorithm for the base case. You can find the algorithm in the appendix (See algorithm \ref{BaseAlg}). The algorithm will return $s$, $o$ and $v$. $s_h$ for every borrel $h$ is the time where borrel $h$ starts. For every student $i$ and for every obligation $j$ of student $i$, we define $o_{i,j}$ as the set of timeslots that obligation $j$ should be performed. $v$ is the the value of this case, which is the sum of the amount borrels that every student is able to attend. The $s^*$, $o^*$ and $v^*$ variables represent the best case found so far. The algorithm works by iterating of all possible borrel positions as discussed in section \ref{BorPos}. For every student it will then iterate over borrel subsets as discussed in section \ref{BorSub}. The ChooseObl procedure is used to check if it can attend all borrels and to provide the times the student will be working on the obligation. Whenever it finds a borrel subset it can attend, the loop ends, because all subsets that come afterwards will not have a greater size. The choose obligation procedure works by having a set $U$ of all the taken timeslots. It first adds all the borrels and returns false if there is an overlap. It will then use the fixed subset iteration to look at all the possible times for the obligations and seeing if it can find a case where there are no overlaps. \subsection{Social Matrix algorithm} In the original problem every borrel attendance had the same value. Now we will introduce a social matrix. This social matrix will tell us how much students like each other. The value is calculated by taking the vector $V_h$ defined as \[V_{h,i} = \begin{cases}1&\text{if student }i\text{ is present at borrel $h$}\\0&\text{if student}i\text{ is not present at borrel }$h$\end{cases}\] and multiplying it with the social matrix: \[v=\sum_{h=1}^m V_h^T\cdot M \cdot V_h.\] Algorithm \ref{SocialAlg} is the algorithm for the case with social matrix. \section{Complexity} We will now calculate the time complexity of the borrel algorithm. We see that we first iterate over all possible borrel positions. We know that there are $\prod_{h=1}^m (t-b_h+1)$ possible borrel positions. We then loop over the $n$ students. Within the student loop we loop over al borrel subsets. In the worst case we will need to loop $2^m$ times. For every borrel subset we will need to check if the student can attend these borrels. In the chooseObl procedure we first loop over all the borrels wich takes $m$ time and afterwards we will be looping over all the fixed size subsets of the obligations. We know that for any student $i$ and obligation $j$ of student $i$, there are $\ _{(d_{i,j}-r_{i,j}+1)}\text{C}_{p_{ij}}$ subsets of size $p_{i,j}$. Within this loop it will need to go throug all obligations to check if there is a overlap. The time complexity becomes \[\mathcal{O}\left(\left(\prod_{h=1}^m t-b_h+1\right ) \cdot n\cdot 2^m \left(m+\sum_{i=1}^n\prod_{j=1}^{\ell_i}\ _{(d_{i,j}-r_{i,j}+1)}\text{C}_{p_{ij}}\cdot \ell_i\right)\right).\] \section{Experiments} In this section, we present computational results from our algorithm, which has optimally solved the base problem. Our primary focus is on the efficiency of our algorithm, as detailed in the algorithm section, where we demonstrate that it consistently delivers optimal solutions. Our approach utilizes a brute-force method enhanced with strategic shortcuts, making it a robust benchmark for other researchers. These results will help determine whether alternative strategies can outperform our exhaustive search for the optimal solution. In table \ref{Benchmarks} you see the runtime of every instance. \begin{table}[h] \begin{tabular}{|l | r|} \hline Name of instance &Time in seconds\\\hline Example &0.007611\\ Group a &0.016793\\ Group b &0.707175\\ Group c &0.000965\\ Group d (1) &0.000245\\ Group d (2) &0.112592\\ Group d (3) &0.827414\\ Group e &0.357478\\ Group f (many) &0.323208\\ Group f (overlap) &0.003717\\ Group g &0.000751\\ Group h &0.000779\\ Group i (Overlapping Borrels) &0.003077\\ Group i (Online Destroyer 1) &0.000045\\ Group i (Online Destroyer 2) &0.000050\\ Group i (Simple pre-emption) &0.000142\\ \hline \end{tabular} \caption{Runtime of the algorithm on all the instances. \textbf{CPU:} Intel i5-7200U (4) 3.100GHz, \textbf{OS:} Manjaro Linux x86\_64} \label{Benchmarks} \end{table} %\subsection{Benefit of a social matrix.} % %We will now give an example of an instance of the borrel problem. We will then compare %the results of the algorithm of the social matrix with the algorithm of the base case. %Suppose there are four students: Alan, Grace, Tim and Ada. Let us say that everyone really wants to meet Alan. In this case it would be ideal if all students could meet Alan at some point. Our social matrix will be the following % %\begin{align*} %S = \begin{pmatrix} % 0.0 & 0.3 & 0.1 & 0.7\\ % 2.0 & 0.0 & 0.2 & 0.8\\ % 1.5 & 1.2 & 0.0 & 0.4\\ % 1.8 & 1.0 & 0.8 & 1.0 % \end{pmatrix}. %\end{align*} % %We will now give our algorithm the following input %really likes Grace and Tim really likes Ada. As stated earlier earlier %TODO: Specify where %it is impossible for values in the social matrix to be negative. In other words student have to have a neutral relationship with each other at a minimum. \section{Conclusion} In this paper we have established the NP-hardness of the borrel scheduling (with social matrix) problem. This result shows the intrinsic difficulty of solving the problem even in an offline setting. We have also provided a brute force approach to solving the offline problem, with experiments showing the performance of this algorithm. These performance statistics may be used as benchmarks for researchers looking to create a more refined offline algorithm. \\ For the online variant of the problem we have proven that no algoritm can achieve constant competitiveness in a number of different settings. With this we have shown that even with multiple restrictions to the problem, online algorithms will still provide poor attendence. \\ \\ Our findings provide significant theoretical insights into the landscape of the borrel scheduling problem. Future work may investigate heuristic based offline algorithms to solve the offline problem more efficiently or seek specialized algorithms that perform well under specific conditions of the problem. \section{Appendix} \begin{algorithm} \caption{Borrel iteration}\label{borrelIt} \begin{algorithmic}[1] \Procedure{borrelIt}{$t,m,b,s$} \For{$h\gets 1,m$} \State $s_h\gets s_h+1$ \If{$s_h+b_h-1\leq t$} \State \textbf{return} (False,$s$) \Else \State $s_h\gets 0$ \EndIf \EndFor \State \textbf{return} (True,$s$) \EndProcedure \end{algorithmic} \end{algorithm} \begin{algorithm} \caption{Fixed Subset iterator.}\label{subsetIt} \begin{algorithmic}[1] \Procedure{fSubIt}{sub,set} \State $i \gets$ \#set \For {$j\gets 1,$\#sub} \While {$\text{set}_i\notin \text{sub}$} \State $i\gets i-1$ \EndWhile \If{$j\leq \#\text{set}-i$} \State $\text{sub} \gets \text{sub} \backslash \{\text{set}_i\} \cup \{\text{set}_i,\dots,\text{set}_{i+j}\}\backslash \{\text{set}_{i+j+1},\dots,\text{set}_{\#\text{set}}\}$ \State \textbf{return}(False,sub) \EndIf \State $i\gets i-1$ \EndFor \State \textbf{return}(True,\{$\text{set}_1,\dots,\text{set}_{\#\text{sub}}$) \EndProcedure \end{algorithmic} \end{algorithm} \begin{algorithm} \caption{Subset iterator.}\label{notFixedSub} \begin{algorithmic}[1] \Procedure{subIt}{sub,set} \If{\#sub=0} \State \textbf{return}(True,set) \EndIf \If(end) \State \textbf{return}(False,\{$\text{set}_1,\dots,\text{set}_{\#\text{sub}-1}$) \Else \State \textbf{return}(False,sub) \EndIf \EndProcedure \end{algorithmic} \end{algorithm} \begin{algorithm} \caption{Checks if the current obligation times are valid.} \begin{algorithmic} \Procedure{obligationoverlap}{t,obl,k,r,p,d,U}: \State $V \gets \emptyset$ \For{$j\gets 1, k$} \If{$(U\cup V)\cap \text{obl}_j = \emptyset$} \State $V \gets V \cup \text{obl}_j$ \Else \State \textbf{return} True \EndIf \EndFor \State \textbf{return} False \EndProcedure \end{algorithmic} \end{algorithm} \begin{algorithm} \caption{Choose obligation times.} \begin{algorithmic}[1] \Procedure{chooseObl}{t,borSub,b,s,r,p,d,k} \State $U \gets \emptyset$ \For{$j\gets 1,k$} $\text{obl}_j \gets \{r_j,...,r_j+p_j-1\}$ \EndFor \For{$h\gets 1, \#b$} \State $A \gets {s_h,...,s_h+b_h-1}$ \If{$A \cap U \neq \emptyset$} \State \textbf{return}(False, \text{obl}) \EndIf \State $U \gets U \cup \{s_h,...,s_h+b_h-1\}$ \EndFor \State loop $\gets$ True \While{loop} \If{$\neg$\Call{obligationoverlap}{t,obl,k,r,p,d,U)}} \State \textbf{return}(True, obl) \EndIf \For{$i\gets 1,k$} \State (end,$\text{obl}_j$) $\gets$ \Call{fSubsIt}{$\text{obl}_j,\{r_j,...,d_j\}$} \State loop $\gets$ $\neg$end \If{end} \State $\text{obl}_j \gets \{r_j,...,r_j+p_j-1\}$ \Else \State \textbf{break} \EndIf \EndFor \EndWhile \EndProcedure \end{algorithmic} \end{algorithm} \begin{algorithm} \caption{Finds the optimum borrel times.} \label{BaseAlg} \begin{algorithmic} \Procedure{initialState}{$t,m,b,n,I,p$} \For{$h\gets 1, m$} \State $s_h \gets 0$ \EndFor \For{$i \gets 1, n$} \For{$j\gets 1, \ell_i$} \State $o_{i,j} \gets \{r_{i,j},...,r_{i,j}+p_{i,j}-1\}$ \EndFor \EndFor \State $v\gets 1$ \State \textbf{return}(s,o,v) \EndProcedure \\ \Procedure{borrel}{$t,m,b,n,I,p,\ell$} \State $(s,o,v) \gets \text{initialState}(t,m,b,n,I,p,\ell)$ \State $(s^*,o^*,v^*) \gets \text{initialState}(t,m,b,n,I,p,\ell)$ \While{True} \State $v\gets 0$ \For{$i\gets 1, n$} \State borSub $\gets \{1,...,m\}$ \State $vS \gets 0$ \While{True} \State (canAttend,obl) $\gets$ \Call{chooseObl}{$t,\text{borSub},b,s,r_i,d_i,p_i,\ell_i$} \If{canAttend}: \State $vS \gets \#\text{borSub}$ \State $o^*_i <- \text{obl}$ \State \textbf{break} \EndIf \State (end,borSub) $\gets$ \Call{subsIt}{borSub,{1,...,m}} \If{subsIt(borSub)} \State \textbf{break} \EndIf \EndWhile \State $v \gets v+vS$ \EndFor \If{$v^*v^*$} \State $o^* \gets o$ \State $v^* \gets v$ \EndIf \EndIf \For{$i\gets 1,n$} \State (end,$\text{borSub}_i$) $\gets$ \Call{subsIt}{$\text{borSub}_i,\{1,...,m\}$} \If{end} \State $\text{borSub}_i \gets \{1,...,m\}$ \EndIf \EndFor \EndWhile \If{$v^{**}