Given a list of resources that each agent needs, I describe an algorithm to minimize the total time agents must wait between using resources.
Finding the optimal schedule of resources such that the total time agents must wait between using the resources is minimized turns out to be a linear programming problem that uses elements of graph theory. In this article, I describe agents as students and resources as classes that they must take, but the model can be generalized to include many other situations.
There are courses, , and students at a school. The set of all courses is denoted . The school is open for time.
Each student has a set of courses that they would like to take, denoted as . The number of courses that each student can take is less than . Hence, the set is a strict subset of , i.e. . The duration of each course is time.
The school manager chooses the starting and ending times of each course such that . Let the starting and ending times of each course be ordered by the sequence of intervals .
Suppose is the set of students that are taking a course . A course can occur at the same time as another course if no student in is taking , i.e. .
Let be defined to be the Lebesgue measure. For each student , set of courses , and the starting and ending times of each course ordered by the sequence of intervals, , define the time interval that the student spends in class as the union of disjoint time intervals . Let the total time student spends at school be the interval . For each student , the time lost function is the length of the complement of the time interval that the student spends in class defined as
Starting and ending times of courses is optimal if
for every student (the sequence of time intervals is feasible) and
for any and and (no feasible alternative sequence of time intervals is strictly less than the optimal schedule).
I now describe an algorithm to find the optimal schedule, if it exists. The optimal schedule may not exist depending on how long the school is open, , and the duration of each course . As you will see, the solution depends on a linear programming problem, which may or may not have a solution.
First, I provide some important definitions that the algorithm will use. Most of these definitions can be found in graph theory textbooks such as (Balakrishnan & Ranganathan, 2012).
Let be a family of sets. The intersection graph of consists of vertices for each set and a set of edges . If is an interval, then the intersection graph is called an interval graph.
A graph is a subgraph of a graph if and . A subgraph of a graph is generated if (i.e. includes all edges in whose vertices are in ).
A graph is complete if, for any two vertices, there is an edge. A clique in a graph is a complete subgraph. A clique is dominant if it is not contained in any larger clique. An ordering of dominant cliques is called consecutive if for any three indices such that , if a vertex belongs to both and , then belongs to .
Consider the algorithm as follows.
Create an undirected graph denoted by which consists of , a set of vertices representing courses, and , a set of edges such that an edge connects course with if and only if course can occur at the same time as another course .
For each generated subgraph of that is an interval graph, , and ordering of dominant cliques of that is consecutive, let a length of time of be denoted as and let be constructed using and the ordering of dominant cliques. Then solve the linear program by selecting to such that and the time of each course is in .
Note that for step 2, there are theorems that simplify the search space. For example, a graph is an interval graph if and only if it is a rigid circuit graph and it has no asteroidal triple, see (Lekkeikerker & Boland, 1962).
If the number of courses, , is large, the second step of the algorithm may not be feasible. In such a case, a solution might be to first use the algorithm above to generate optimal starting and ending times of courses (given example lists of courses that are small and is small) and then create a neural network to learn the underlying pattern to predict optimal schedules for larger . This might be a potential path to research further.
Suppose that there are six courses and five students. The list of courses that each student would like to take is , and . Suppose the school is open for 3 hours, and each course requires one hour.
An iteration of the algorithm might result in the following computation. First, the undirected graph is constructed as follows.
Next, a generated subgraph that is an interval graph might remove the edge connecting to . An ordering of dominant cliques of the generated subgraph that is consecutive is , and . The linear programming problem is then constructed as
such that , and and for all . The solution to the minimization problem for this generated subgraph is , and . The interval graph representing the starting and ending times of each course would be as follows.
Under this schedule, the only person who must wait is student 3, who would like to take and .