Secretary problem: graphs, matroids and greedoids

In the paper the generalisation of the well known"secretary problem"is considered. The aim of the paper is to give a generalised model in such a way that the chosen set of the possible best $k$ elements have to be independent of all rejected elements. This condition is formulated using the theory of greedoids and in their special cases -- matroids and antimatroids. Examples of some special cases of greedoids (uniform, graphical matroids and binary trees) are considered.


Introduction
The secretary problem also known as the marriage problem relies on a choice of the best candidate in such a way that only the relation to the previously interviewed candidates is known and the rejected candidates are definitively lost. The number of candidates is also known before the interview starts. Then after the interview we have to decide whether to accept the candidate or not? Our goal is to choose the best candidate, i.e. we have to decide when the process of recruitment should be stopped. In a more general situation we want to choose not only one, the best candidate, but we want to choose the best k members who form a team.
In the simplest case we do not have any limitation given to recruitment process or the relationships inside the team. In this paper we focus our attention on the limitation of a recruitment process. namely we can choose only such candidates who are not dependent on the candidates rejected in the current interview.
Such an idea of a recruitment process requires a precise explanation of the meaning of the sentence "independent of previously rejected candidates". As the next step we have to determine the stopping rule to obtain the optimal stopping time. The main aim of this paper is to formulate a sufficiently general but practicably useful structure of dependence.
Finding the optimal solution of the problem described above in the general case seems impossible in general cases. Therefore we study optimal algorithms for finding the best solution only in the some particular, but apparently useful cases.
The paper is organised as follows. In Section 2 the classical secretary problem is introduced. Next, the variant of this problem with the the necessary independence between rejected candidates and accepted ones is presented. Section 3 introduces the most known independence structures: matroids and their generalisation -greedoids. At the end of that section, the problem in the general greedoid case, is introduced. In Section 4 some particular, selected models are introduced. In the simpler models, the solutions are given. In the more complicated models only some connections between known results (for example from random graph theory) and problems of optimal stopping in such models are discussed.

Secretary problem 2.1 Classical secretary problem
In the classical secretary problem there are n linearly ordered elements {1, 2, . . ., n}. They are being observed at a random order (e 1 , e 2 , . . ., e n ). At the moment t = i the observer knows only the relative ranks of the elements e t examined so far. Once rejected, an element cannot be recalled.
The aim of the observer is to choose the currently examined object in such a way that the probability Pr (e t = n) will be maximal.
This problem is well known and solved. Dynkin in 1963 shows that for large n, it is approximately optimal to wait until a fraction 1/e of the elements appears and then to select the next relatively best one. The probability of success is also 1/e. More strictly, we can present this result as follows. Let w (e) denote the rank of e and w (A) = max e∈A w (e). Theorem 1. Let us assume that an algorithm of choices has the following form.
1. Reject all elements e t for subsequent t ≤ v for some v.
2. If t > v then we accept e t if w (e t ) ≥ w (A t−1 ) or reject it in the opposite case. The rejection is irrevocable.
3. The process is stopped if the element is accepted or t = n.
If v ∼ n/e with n → ∞ then the Pr (e t = n) is maximal and is equal to 1/e.
The easy proof of Theorem 1 is a good pattern for considerations which will be used in more general models given in the next parts of this article. Therefore, this proof is presented in a more detailed way than it is required in this particular case.
Proof. (see Ferguson [1989]) Assume that the first v − 1 elements are rejected and element m has the highest rank among these v − 1 elements. Next, select the first subsequent element that is better than element m. For an arbitrary v, the probability that the element with the highest rank is selected is Pr (element i is selected|element i has the highest rank) × Pr (element i has the highest rank) the element with the highest rank of the first i − 1 elements is in the first v − 1 elements element i has the highest rank Therefore the best choice is with probability: The the maximum is achieved for v ≈ n/e. See Ferguson [1989] for a brief historical review of this classical secretary problem.
An important generalisation of this problem is known as the multiple choice secretary problem (see Hajiaghayi et al. [2004], Kleinberg [2005], Girdhar and Dudek [2009]). The objective of this problem is to select a group of at most k secretaries from a pool of n applicants having a combined value as large as possible.

Secretary problem and independence
Our generalisation leaves a linear order but assumes an additional combinatorial structure in the set of elements e i . Using the language of the optimal choice of the candidate to a position (secretary problem), our problem can be described as follows.
The subsequent candidates arrive. We can reject the candidate and then we consider a new candidate. The rejected candidate is irretrievably lost. Every new candidate is compared to the previously rejected candidates. If a new candidate is dependent on the previously rejected ones, such a candidate is also rejected. If the candidate is not dependent, then as a result of the comparison we can reject or accept him/her.
The main aim of the article is the research of stopping criteria if the random variables are indexed by elements of a finite structure and the permissible choice is limited by such a structure. Assume tentatively that an element e is independent on the set A if it does not belong to the closure of A. The name 'closure' needs defining which will be done in the next sections. Our basic assumptions are: • in the structure, a closure operator and a family of closed sets are specified, • if a new element belongs to the closure of previously rejected elements, then it also has to be rejected, • if it does not belong to the closure, the new element can be accepted.
Let us consider a simple, but illustrative example. The structure in this example is known as "linear structure" which is a special case of "strictly hierarchical structure" (see Klimesch [1994] is equal Proof. For i = π ( j) the number of permutations fulfilling (1) is equal which completes the proof. If S is the set of candidates rejected so far, then if r (t) < r (S) for a new t / ∈ S, t has to be rejected even if w (t) > w (S). In other words, having rejected the boss we must not employ the subordinate. More formally, the element t is independent of the S if r (t) > r (S). Note however, that at the moment t we do not know the values r (t) and w (t) but we can only verify if the inequalities r (t) > r (S) and w (t) > w (S) are fulfilled.
In this example we consider two completely different cases. The first ideal case: Then we can assume that r (i) = w (i) = i. This case coincides with the classical secretary problem. The second is the most haphazard case: weight and rank are independent random variables 1 . Then we can assume that r In this case let us try to pick the best candidates in the same way as in the classic problem. First we examine and reject a fraction α of n candidates (say S α ) and at the next steps k > n/α we pick the first candidate s k with the rank and weight higher of the candidates rejected so far, i.e. r ( Let us denote the most valuable candidate by z 1 and the second most valuable by z 2 . If z 2 ∈ S α , z 1 / ∈ S α and moreover r (z 1 ) > r (S α ), the selected candidate is the best. Therefore the probability that the randomly chosen permutation fulfils (1) for given n and j > k 0 for some fixed k 0 is equal where γ = 0.5772156649 . . . is an Euler constant. Continuing this example for the second, haphazard case, let us assume that α = 1/2. In such the case, let z 1 ∈ S 1/2 and z 2 / ∈ S 1/2 . The candidate z 1 is elective if r ( j) < r (z 1 ) for all j < z 1 . From Pr (z 1 ∈ S 2 and z 2 / ∈ S 2 ) = 1 4 (4) and from Equation (3) we obtain It seems that a better way is to take as α the value other than 1/2. Then we have and instead of (5) we obtain 1 Any similarity to actual events is purely coincidental.
Nevertheless the difference between the right side of (5) and the maximal value of the right side of (7) is very small, less than 1% -see Table 1. Table 1: Right-hand side of (5) and maximum of right-hand side of (7) Note that in the ludicrous situation 2 for any pair e 1 , e 2 , the optimal strategy is to choose the first candidate. Every next candidate will be either worse or dependent. This situation leads of course, with high probability (n − 1) /n, to the lack of choice, so it can be neglected.
As the third case in this example we can consider such a situation that the correlation between ranks and weights is positive (usually essentially greater than zero), but smaller than one. Such a case needs more precise assumptions and probabilistic considerations hence it will be omitted in this paper.

Matroids and greedoids
As it was mentioned previously we need a precise definition of the words 'closure' of A and 'independent' element e from the set A. The useful tool to give such the definitions are structures known as matroids and more generally -greedoids. In the next two sections we provide the necessary definitions and results from the matroid and greedoid theory.

Matroids
Let E be a finite set. A family I of subsets of E is the family of independent sets if the following conditions hold: A pair (E, I ) is a matroid (see for example Oxley [2011], Welsh [1976], Wilson [2010]). A basis is every maximal independent set. All bases have the same number of elements. A rank ρ (A) of any set A ⊆ E is the number of elements of maximal independent set I ⊆ A. A closure σ (A) of a set A is the maximal set with the same rank as A. The set A is closed if σ (A) = A. The operator σ for matroids fulfils the following properties: Using the definition of matroid, we can interpret "an independence" of element e of the set A in such a way that e / ∈ σ (A). Comparing this interpretation with the example in Section 2.2, we can remark that such a meaning of independence is not fortunate because the closure σ (A) has the exchange property: A structure (E, I ) is a matroid if and only if σ fulfils the conditions (s 1 ) and (s 2 ) and the condition (ex). Note that (s 3 ) follows from (s 1 ) and (s 2 ) and the condition (ex) but (s 1 ) -(s 3 ) does not give (ex). Therefore the set of conditions (s 1 ) -(s 3 ) is not a characterisation of a matroid.

Basic definitions and properties
The hierarchical structure of dependence in Example 1 does not fulfil the condition (ex). Therefore we have to use more a general structure than matroids. A greedoid (a greedy structure) is the family F of subsets of the set E which fullfils the following conditions (see for example Korte et al. [1991], Korte and Vygen [2012]): Note that the conditions for greedoids are the conditions for matroids with the exception of (i 2 ). The family F is called feasible. The family F is called accessible if the following condition holds: The pair (E, F ) where F is accessible is called an accessible system. Every greedoid is an accessible system. Matroids are also greedoids with independent sets as feasible sets. Clearly, the property (a 1 ) is weaker than the property (i 2 )does not every subset of an independent set is independent, but at least one subset of a feasible set is also feasible. A basis is every maximal feasible set. All bases have the same number of elements. A rank ρ (A) of any set A ⊆ E is the number of elements of maximal feasible set F ⊆ A. A closure τ (A) of a set A is the maximal set with the same rank as A, i.e. (see Korte and Lovás [1983] or Korte et al. [1991]) The closure τ (A) defined by (8) fulfils the conditions (s 1 ) and (s 3 ) but not necessarily the condition (s 2 ), i.e. closure operator is not necessarily monotone (see Korte et al. [1991], Example on p. 69, fig. 6). However one can define the monotone closure operator σ (A): It is easy to see that the monotone closure σ (A) satisfies all conditions (s 1 ) -(s 3 ), but greedoids is not uniquely determined by its monotone closure operator (see Korte et al. [1991], p. 63). If a greedoid fulfils the antiexchange property then we call such a greedoid an antimatroid.
for every pair i < j. Then the sequence e 1 . . . , e n is linearly ordered.
In the next parts of this section we give some examples of greedoids. The exhaustive review of examples of greedoids can be found in Goecke et al. [1989]. In our article we give only some simplified examples, useful for our aim.

Trees
Let T be a tree with the root r and the set of vertices V . The distance from the root r to other v is a height h (v) of v then h (r) = 0. The height h = h (T ) of the tree T is the maximum height of the leaf.
Let F be the family of all vertex sets such that U ∈ F if U is a subtree of T and r ∈ U . Let Then T = (V, F ) is a greedoid of feasible sets and σ defined by (12) is the closure operator, which fulfils the property (aex). Therefore T is an antimatroid. Such an antimatroid can be considered as an example of a hierarchical organisation. Note that the hierarchical structure of dependence in Example 1 is the trivial example of a tree (with the element n as a root), and it is a very simple example of antimatroid. From Theorem 2 and equation (12) we have the following result. In Fig. 1

Acyclic digraphs
Let D be a rooted directed acyclic digraph with the root r and the set of arcs E. A rooted subgraph of D is connected (directionally connected) if for its every vertex v there exist a path from r to v. Let F be the family of all sets of arcs of connected subgraphs rooted at r. Let Then D = (V, F ) is a greedoid of feasible sets and σ defined by (13) is the closure operator (see Korte et al. [1991], p. 26). Such a greedoid can be considered as an example of a hierarchical organisation with multiple dependencies. Note that if every vertex v = r has indegree d − (v) = 1, the the linegraph of D is a tree. Therefore in such a case, a greedoid D is isomorphic to a greedoid T presented in 3.2.2.
In Fig. 2 Figure 2: Rooted acyclic digraph -greedoid of hierarchical organisation with multiply dependence not rooted in r) and {b, e, j} does not belong to F either (it is not connected, so it is not rooted in r).

Secretary problem in greedoids
Now we formulate the problem in the most general way, for any greedoid. Let (E, F ), |E| = n, be a greedoid with closure operator σ . On the set E a weight function w : E → N is defined. We want to choose the element with the greatest weight under the following conditions.
1. The structure (E, F ) and the function w : E → R, w (e) > 0 for all e ∈ E, is defined but it is not known.
3. At the moment t we know which element arrives (say the element e t ) and we can observe its weight w (e t ) and the closure of

For any two subsets
5. Let A t−1 be the set of elements which arrived before the moment t. If e t ∈ σ (A t−1 ) then e t is rejected irrevocably.
6. If e t / ∈ σ (A t−1 ) then we can accept e t if w (e t ) ≥ w (A t−1 ) or reject it in the opposite case. The rejection is irrevocable.
7. The process is stopped if the element is accepted or if there are no next elements to observe.
The proposed algorithm is similar to the algorithm known as Secretary Problem.
Algorithm 1. At each step the observer knows the weight of the chosen element e and performs the actions below: 1. Fix the closed family of test sets T or least σ (T).

If w (e t ) > w (A t−1 ) and e t / ∈ σ (A t−1 ) accept e t and stop the process.
We take as the criterion the subspaces of the appropriately chosen rank, say rank k 0 . Therefore we unconditionally reject the elements e t until ρ (A t ) = k 0 . For the next t we reject the element e t if w (e t ) < w (A t−1 ) or e t ∈ σ (A t−1 ). If w (e t ) > w (A t−1 ) and e t / ∈ σ (A t−1 ) we accept e t and stop the process. To solve this problem we need to determine the distribution of the random variable ρ (A t ).
The presented model in the matroid case is different from the known so far Matroid Secretary Problem introduced in Babaioff et al. [2008]. Their model is a generalisation of the multiple choice secretary problem by an additional condition that the chosen set has to be independent. In such a model the accepted elements do not have to be independent of the previously rejected elements. The paper Soto [2013] gives an exhaustive review of known results and presents some new ones. with the number of element no greater than k: Obviously there must be k > v. Assume w (i) = i. Then the best choice is with probability: as in Theorem 1. The maximum is achieved for v ≈ k/e and the optimal probability is (k/n) /e. If k = n we obtain the classical case with the solution given by Theorem 1.

Binary trees
Definition 1. A binary tree with n vertices is an empty tree T = / 0 if n = 0 or a triple T = (L, r, R) where r is the root of the tree, L (left subtree) is a binary tree with l vertices and R (right subtree) is a binary tree with p vertices, where n = l + p + 1. For nonempty T , the root of L is called a left child of r and the root of R is called a right child of r. If T = ( / 0, v, / 0), then v is a leaf.

Definition 2.
A complete binary tree is a binary tree in which all nodes other than the leaves have two children. If moreover all leaves have the same height, the binary tree is complete and full.
The number l of leaves in a complete and full binary tree with n vertices is l = (n + 1) /2 = 2 h . Thus n = 2 h+1 − 1 is the number of vertices of such a tree.
Similarly to Example 1 we will consider two different cases. First, let us consider the case w (v) = h − h (v) + 1. Therefore the root r has the maximal weight w (r) = h + 1 and leaves u have the minimal weights w (u) = 1.
In the second case we assume that presented until now. At the moment t, 0 ≤ t ≤ m = n 2 , the random graph G n (t) has t edges and Let us consider the asymptotic case where n → ∞ and t = t (n). To simplify the notation, use the abbreviation a.a.s (asymptotic almost surely) instead of the term "with the probability tending to 1 when n → ∞". If k > 2 and t ≪ n but t = n 1−o(1) then a.a.s, G n (t) has no cycles, i.e. the set of edges forms an independent set (see Janson et al. [2000], p. 104). This means that the beginning of such the process is similar to the beginning of the process without dependence restrictions. Nevertheless the number t = n 1−o(1) of tested elements is too small to obtain a reasonable decision.
In order to change to the proper range of numbers of edges which give a sufficient information to obtain an optimal decision, we have to consider such a case, where the number t of tested edges is big enough and furthermore the number of edges which are not dependent tested as well as the number of rejected edges are also big enough. Such a situation is given by the following fundamental result, proved by Erdős and Rényi in their famous paper Erdős and Rényi [1960] (see Janson et al. [2000] and van der Hofstad [2016]).
where λ > 0, then the random graph a.a.s. has one giant component and N isolated vertices. The random variable N has Poisson distribution with the mean λ .
For the big λ we can obtain a better balance between a number of tested elements (given by Eq. (14)) and a number of edges possible to choose, i.e. edges which do not belong to the giant component. From Theorem 4, the giant component has a.a.s. n (ln n + ln λ ) elements (edges) and the rank n − N. Because every new edge a.a.s. joins an isolated vertex with the giant component then we can choose an optimal k elements set from N (n − N) elements.
From 3σ rule we have approximately Pr N − λ > 3 √ λ ≤ 0.005. To obtain ρ (T ) = n − λ we should a.a.s. test at least t 0 ∼ n (ln n + ln λ ) 2 − 3 √ λ elements plus perhaps an additional next 3 √ λ /2 elements. Example 2. In Table 2 there are shown the values of the necessary number t 0 of testing steps to achieve the set T of rank given before. Let ρ (T ) = λ . Note, that after rejecting approximately next λ edges after the moment t 0 , ρ (R) ∼ n, the process will be finished. If all values w e j are different for j = 1, 2, . . ., n 2 , then it is clear that the probability of choosing the optimal solution (the edge of maximal weight or the set of k edges with maximal sum of weights) rapidly tends to zero.

Linearly decreasing number of linearly ordered weights
Let us assume that there exist only n − 1 values of weights of edges in the nvertices graph. In this section we restrict ourselves to the case k = 1, i.e. to the choice of only one, the best element. Without the loss of generality one can assume that w (e) ∈ {1, 2, . . ., n − 1} for all edges of the graph K n . Similarly to Example 1 we consider the three completely different cases.

Prospective application: cloud computing
It is obvious that the simplest model closely related with the name Secretary Problem is very far from real applications. In this section we describe the simplified, but more realistic model of cloud computing, which can used as an example of an application to the computer networks 3 . Below we shortly describe the model.
Cloud computing is definitely one of the fastest developing technologies in IT sector.
Year by year this kind of solutions become more popular. This idea has actually its implementations in many different models. Regardless of the fact which of them is used the general idea is still the same: most of the duties related to IT infrastructure maintenance is moved from the user (customer) to the service provider. In other words we can say that the same classical element (i.e. server or software running on it) becomes just a service, available for the user by the computer network. The user, who has a task to be performed, just orders the resources needed for this particular time. This solution is very comfortable for the user as more efficient resources usage guarantees also economic benefits. Since in typical cloud computing service many different users share with each other limited hardware and software resources, optimisation of their utilisation is the key problem.
Let us consider the situation, where the user has same the computing task to be performed in the shortest possible time. To do this job, a virtual machine with required hardware resources (computing cores, RAM memory etc.) must be rented. Then there is a need to deliver a significant amount of data required for computing. This operation is strictly related to the transfer time. Some parameters of the virtual machine are simple to compare (results of popular benchmarks, user estimation based on declared hardware parameters). In the real environment also some other parameters, often difficult for forecasting, should also be considered. One of them is an actually available throughput of the computer network between the client host and the computing node. While the bandwidth can be considered constant, the throughput is directly connected with the current utilisation of the network. Due to the above, time of transfer can be approximated no sooner than after sending a few TCP datagrams and receiving acknowledgements. At the moment when the transmission speed would classified as unsatisfactory, it can be interrupted and the next localisation can be considered. However, what is very important at the time of the resignation of the given service provider, the re-sources can be assigned to other tasks, and they are not available anymore. What is more, there can be some relationship between individual service providers. Their hardware resources can be located in the same network segments. Therefore, the rejection of one or more of the service providers in the network should also result in the elimination of other nodes located in the same network location and depended of rejected nodes.
Assuming that the systems work in a such the way that at each step they try to choose the best node, then our model (matroid and more generally -greedoid) can be applied as a model of activities in the cloud. Certainly, the accurate choice needs deeper considerations and verifications with the real networks and their management.

Conclusion
We presented a model of optimal choice among objects which are connected by different dependencies. Our aim is to choose an object or a set object but in a such way so that the chosen objects were independent in some sense. The independence in the model is described in the term of greedoids and as special cases -matroids, antimatroids and more special cases, for example rooted trees and random graphs. As the first step we try to apply such models to a more realistic problem, namely to the problem of operations during the cloud computing.