Implementing your scheduling algorithm
Studying the scheduling algorithm of your dreams in Batsim involves different things.
Implementing the scheduling algorithm itself.
Allowing the algorithm to communicate with Batsim through the Protocol.
Analyzing the algorithm behavior.
This tutorial focuses on the first two parts — as the third is done in Analyzing Batsim results.
Gaining insight on the Batsim protocol
The Batsim Protocol defines the interactions between Batsim and the scheduling algorithm. Reading the protocol description is strongly recommended, as it defines the following.
The events the algorithm can react to.
The actions that the algorithm can take.
Add your algorithm in a project already compatible with Batsim
This is the easiest way to implement your algorithm. Several projects gather collections of scheduling algorithms and implement the Batsim Protocol to communicate with the Batsim simulator.
Project |
Language |
Pros |
Cons |
---|---|---|---|
C++ |
Kept up-to-date with most Batsim changes (used by Batsim tests). |
C++: Error-prone, painful to write and maintain. |
|
Python |
Python: Great for prototyping. |
Code lacks consistency. Python: Painful for robustness? |
|
D |
D: Great (dev productivity, code maintenability) tradeoff. |
Uses old protocol (1.4.0). Just a prototype for now. |
|
Rust |
Rust: Safe and fast. |
Uses old protocol (1.4.0). |
Todo
Hacking guidelines are not written yet about these projects.
Do not hesitate to Contact us about it.
Create a new project from scratch
This can be needed if you want to use another programming language, or it may be justified if the design decisions of existing implementations does not match what you want to do.
In this case, your best bet is to refer to the Protocol and to have a look at existing implementations.