-2

I have been assigned a project that requests scheduling (construction of a timetable) about 30 resources on 2 shifts/day for a 6 months period with pretty complicated hard constraints like

  1. No consecutive days shifts
  2. for each resource: sum of total night(and day) shifts, fine distributed....SumShifts(Mondays)=SumShifts(Tuesdays)....
  3. for all resources: SumTotalDayShifts(and night shifts) distributed
  4. Various other constraints like resource_a cannot be assigned a shift on day_x with resource_y.

Initially, I decided to construct the mathematical model, coded it and solve it with GA. And then I discovered Drools which looks promising...but has a learning period.

Which way to choose? any ideas?

Geoffrey De Smet
  • 26,223
  • 11
  • 73
  • 120
ChrisV
  • 11
  • 1

2 Answers2

1

I did make a college timetable project in 1.5 months without knowing much java. It used simulated annealing and ran in 40 seconds(28 classes, ~1000 periods).

I had hard constraints and soft constraints on number of hours per day. The hard constraints added made the current state impossible. The soft constraint subtracted a few points per violation. I had specified it that the workload per day is more or less evenly spread.

The points were easily tunable as they were specified in the rules file. It was simple to specify the rules in its dialect, no need to compile anything to add/tune rules.

I could prevent teachers from teaching conflicted periods by specifying it declaratively in the problem state and the rules:

...p1 = new Period(class, day ,num)
...p2 = new Period(class, day ,num)
...periodConflict1 = new PeriodConflict( p1, p2)

and write a rule that handles a PeriodConflict if it exists. So I guess it addresses your 4 points.

Then the author Geoffrey De Smet personally handles queries and bugs.

So Drools planner is much better than writing your own algorithm and handling the rules of the domain.

I referred N Queens first (as its simplest) and then cloud balancing (second simplest), made a sudoku app and a bucket filling app (put 100 numbers in 10 buckets, so that their sums are close to each other) and built it from there.

Jesvin Jose
  • 22,498
  • 32
  • 109
  • 202
0

Those constraints sound very similar to the Nurse Rostering example in OptaPlanner (= Drools Planner). You might want to start from that example.

Geoffrey De Smet
  • 26,223
  • 11
  • 73
  • 120