# Slot Assignment Algorithm

If you've chosen **Algorithm-based** as your event's slot assignment type, you're likely wondering how the algorithm assigns slots to DJs. This page explains the process behind the scenes, detailing how the system evaluates and assigns slots based on various conditions.

***

### Overview

The slot assignment algorithm is designed to fill all open event slots in an optimal and fair manner. It takes into account:

* **Global optimization:** Using the [Hungarian algorithm](https://en.wikipedia.org/wiki/Hungarian_algorithm), the system considers all DJ–slot pairings simultaneously to generate an overall optimal assignment.
* **DJ performance metrics:** Each DJ is scored based on their historical activity—rewarding those who have played fewer times and longer ago. More info about how scores are calculated can be found [here](/functionalities/slot-assignment-algorithm/dj-scoring-calculation.md).
* **Role-based bonuses:** DJs with higher roles can receive an additional bonus that influences their overall score.
* **Preferred slots:** Although the primary assignment is made via the cost matrix, a post-processing step attempts to honor DJs’ indicated preferred slots, provided it does not compromise the overall coverage.

In summary, the algorithm first builds a cost matrix for all available open slots using a dedicated scoring function, then finds the optimal assignment that maximizes total DJ suitability. Finally, it post-processes the results to try and honor any preferred slot choices without reducing overall coverage. If there aren’t enough DJs to cover every slot, the algorithm gracefully returns a ["notEnoughDJs"](/functionalities/slot-assignment-algorithm/not-enough-djs.md) flag.

***

### Conclusion

The slot assignment algorithm leverages the Hungarian algorithm for the global optimization of DJ-slot assignments while using the[ DJ Scoring function](/functionalities/slot-assignment-algorithm/dj-scoring-calculation.md) as its core for evaluating DJ performance. This dual-layered approach ensures that:

* All open slots are optimally filled.
* DJs with less performance metrics (playing less often and less recently) receive higher priority.
* Role-based nuances are integrated fairly.
* Preferred slot choices can be honored in a post-processing step without compromising the overall global assignment.

For further details on the Hungarian algorithm itself, users are encouraged to explore [additional resources](https://en.wikipedia.org/wiki/Hungarian_algorithm); this documentation focuses on the technical underpinnings of the DJ scoring function.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.vrave.app/functionalities/slot-assignment-algorithm.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
