Main Content

Drools Planner

What is Drools Planner?

Drools Planner optimizes automated planning. This JavaTM open source framework can deal with NP hard planning problems by using meta-heuristic algorithms such as tabu search and simulated annealing.

Drools Planner works on all kinds of planning problems. Just take a look at some use cases:

Use cases

Bin packing
Bin packaging use case

Whether you are filling shipping containers, a moving truck or even just your suitcase, you are doing bin packing. 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.
Employee shift rostering
Employee shift rostering use case

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.

Educational timetabling
Examination timetabling use case

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).

Sport scheduling
Traveling tournament use case

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 travelled by all teams.
Other use cases

Other planning problems include:

  • Vehicle routing and freight routing
  • The traveling salesman problem
  • Appointment and resource scheduling
  • Storage organizing
  • Machine queue planning
  • ...

Features

  • 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


  • Planning constraints are written as declarative score rules.

    • Adding many constraints is easy and logical, but not mathematical. Even your domain experts can write the constraints themselves with Drools Guvnor.
    • Each constraint is defined separately and independently.
    • Highly scalable, even when adding many constraints and/or solving big problems.
    • The DRL syntax allows for powerful pattern matching.
    • Delta based score calculation and other performance optimizations come for free - without a single line of code.
    • Support for simple scoring, hard and soft constraint scoring or a custom scoring.
    • Little or no changes to your domain objects (POJOs): compatible with JPA, Bean Validation, ...
    • Constraints can be weighted. The weight can even depend on the domain objects involved.
  • The planner algorithm is configured. It searches through the solutions within a given amount of time and returns the best solution found.

    • All algorithms follow the configuration by exception principle, even though they are highly configurable.
    • The tabu search implementations supports solution tabu, move tabu, undo move tabu and property tabu.
    • Other implemented meta-heuristic algorithms include simulated annealing, great deluge and even plain local search (hill climbing).
    • It is easy to switch the planner algorithm, by simply changing the configuration.
    • The Benchmarker class plays out several planner configurations against each other, outputs result graphs and point out the best configuration for production use.
  • Drools Planner is production software, following production standards.

    • It 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.

Learn more

Continue to learn more about Drools Planner: