Skip to content
Cultrarius edited this page Dec 3, 2014 · 1 revision

Getting started

This framework was developed with the intention to make common use-cases easy to implement and rare use-cases possible. The whole purpose of the framework is to schedule some items. Here are some examples of items that can be scheduled:

  • builds on a build server
  • craftsmen during house constructions
  • patient assignments in a hospital
  • jobs on different machines

Even a single item can be very complex in each of these scenarios. For example, a single job may require access to multiple machines and may have varying execution times on them. But to keep it simple, let's say that for now one item has exactly one place where it needs to be scheduled. This place is called a lane. Why? Because, in a drawn schedule, the corresponding part looks like a swim lane.

Lane and ItemToSchedule

In the framework these two things are represented by the classes ItemToSchedule and Lane . So, to stay within the example, we create the following two classes:

public class Job : ItemToSchedule
{
	public int JobId { get; private set; }
	public Machine RequiredMachine { get; private set; }
	public int DurationOnMachine { get; private set; }
		
	// constructor etc.
}

public class Machine : Lane
{
	public int SerialNumber { get; private set; }

	// constructor etc.
}

In the next step, we create some instances of our new classes:

Machine myMachine = new Machine(42);
Job job1 = new Job(1, myMachine, 50);
Job job2 = new Job(2, myMachine, 150);
IList<ItemToSchedule> jobs = new List<ItemToSchedule>() { job1, job2 };

The final step (aside from looking at the result) involves scheduling these jobs:

Scheduler scheduler = new Scheduler();
SchedulePlan schedule = scheduler.Schedule(jobs);

Lo and behold! The resulting schedule shows that the scheduler actually managed to schedule our two jobs one after another. I might complicate the task by creating more machines or more jobs or making jobs require to run on multiple machines simultaneously and so on. But I think you get the point.

Clone this wiki locally