Drools Planner
Drools Planner does automated planning.
It solves a planning problem while respecting the constraints as much as possible.
Drools Planner can be used on all kinds of planning problems.
Let's take a look at some use cases.
Whether you are filling shipping containers, a moving truck
or even just your suitcase, you are doing bin packaging.
Some of the constraints can include:
- Each container type has a maximum weight.
- The weight in a container should be spread as evenly as possible.
- Different container types have different prices: minimize the overall cost.
- Not all items are added or removed from the container at the same time: minimize loading and unloading times.
Ensuring continuous customer service in a hospital, a store or a call center isn't easy.
Some of the constraints can include:
- Each shift has for each specialism a minimal staff size.
- Labor regulations: Minimal 11 hours rest between shifts, minimal 35 hours rest each week, ...
- Shift preferences: Young nurses dislike Saturday night shifts, mothers dislike Wednesday afternoon shifts, ...
Drools Planner improves the quality of service, minimizes staff size and maximizes staff contentment.
When you create a timetable for lessons, courses, exams, meetings or even conference presentations,
you 'll not only pick a time, but also a room.
Some of the constraints can include:
- Each room has a maximum seating capacity.
- No student can have 2 exams at the same time.
- No student likes 2 exams on the same day.
- Large exams should be scheduled early.
Drools Planner creates a better timetable then a human planner, in less time,
while considering more constraints (especially individual teacher or student preferences).
Whether you are scheduling the olympics, major league baseball or a regional soccer competition,
you 'll want an efficient and competitive schedule that respects all stakeholders,
such as stadium owners, players, coaches, sponsors and of course the fans.
Some of the constraints can include:
- No team must have more than 3 consecutive home or 3 consecutive away matches.
- No repeaters: no 2 consecutive matches of the same 2 opposing teams.
- Minimize the total distance traveled by all teams.
Other planning problems include:
- Vehicle routing and freight routing
- The traveling salesman problem
- Appointment and resource scheduling
- Storage organizing
- Machine queue planning
- ...
-
Constraints are defined as score rules in DRL (see Drools Expert). For example:
// If a hospital patient prefers specific equipment, try to assign him/her a hospital room with such equipment.
rule "preferredPatientEquipment"
when
// If a patient prefers specific equipment
PreferredPatientEquipment($patient : patient, $equipment : equipment);
// and that patient is assigned a room
BedDesignation(patient == $patient, $room : room);
// and that room doesn't have that equipment
not RoomEquipment(room == $room, equipment == $equipment);
then
... // lower the score with a certain weight
end
Advantages include:
- Adding more constraints is easy and scalable.
- The DRL syntax allows for powerful pattern matching.
- Delta based score calculation and other performance optimizations come for free. No extra code needed.
- Each constraint is defined separately and independently.
- Little or no changes to your domain objects: compatible with JPA, Bean Validation, ...
- Constraints can be weighted. The weight can even depend on the domain objects involved.
- You can use an out of the box Score implementation (SimpleScore, HardAndSoftScore) or implement a custom Score.
-
The planner algorithm is configured.
It searches through the solutions within a given amount of time and returns the best solution found.
- The tabu search implementation supports solution tabu, move tabu and property tabu.
- Other implemented metaheuristic algorithms include plain local search (hill climbing), simulated annealing and great deluge.
- It is easy to switch the planner algorithm, by simply changing the configuration.
- The Benchmarker class allows you to play out several configurations against each other and pick the best one.
-
Drools Planner is part of the Drools community.
- Drools Planner, like Drools, is (business friendly) open source software under the Apache Software License.
- There are many examples included in the download, ranging from easy to advanced.
- The reference manual explains everything in detail.
Continue to learn more about Drools Planner: