Introduction to Timefold
Timefold is an open-source AI solver for automating complex planning and scheduling optimizations. It builds on top of the proven OptaPlanner solver but brings significant enhancements in performance, cloud support, and ease of use.
In this comprehensive guide, we will cover:
- What is Timefold and its key capabilities
- How to get started with Timefold
- Using Timefold for real-world optimization problems
- Advanced algorithms and techniques used by Timefold
- Integrating Timefold with APIs and enterprise systems
- Comparing Timefold Community vs Enterprise editions
- Real-world examples and case studies
- Roadmap and future of Timefold
- How Timefold compares with similar solutions like Jsprit
By the end of this guide, you will have a detailed understanding of how Timefold works and how it can be applied to streamline planning and scheduling in your business.
What is Timefold?
Timefold is an open-source, cloud-native AI solver for optimizing planning and scheduling problems. It is designed for programmers to easily build optimization capabilities into their systems and workflows.
Some key aspects of Timefold:
- Programming Language Support: Timefold supports developing optimization models in Java, Python and Kotlin. This provides flexibility to use the most suitable language for your use case.
- Developer-Friendly: Timefold allows defining optimization problems, constraints and objectives as code rather than complex mathematical models. This makes it easy for developers to integrate without needing OR expertize.
- Cloud-Native: Timefold is optimized for cloud and Kubernetes environments with a lightweight footprint. It scales seamlessly on cloud infrastructure.
- Advanced Algorithms: Timefold combines declarative constraint modeling with sophisticated solver algorithms like simulated annealing, late acceptance hill climbing and tabu search to explore large search spaces efficiently.
- Performance: Timefold claims 2x better performance compared to OptaPlanner on typical use cases. The core engine has been optimized for speed.
- Free and Open Source: Timefold is licensed under Apache 2.0 and can be used to build commercial applications without licensing costs. Paid enterprise support is optionally available.
Timefold helps organizations across logistics, manufacturing, healthcare and retail become more efficient by finding optimal plans and schedules. It powers use cases like vehicle routing, employee rostering, task assignment, production scheduling etc.
Timefold builds on top of the decade-long proven OptaPlanner solver but adds significant enhancements and improvements to take optimization to the next level.
History of Timefold
Timefold has its roots in the OptaPlanner project originally created in 2006 by Geoffrey De Smet and other developers at Red Hat. OptaPlanner pioneered the idea of constraint-based planning optimization – defining business objectives and rules in code rather than using mathematical models.
Over the years, OptaPlanner gained widespread adoption in industries like logistics, manufacturing, healthcare etc for use cases like vehicle routing, nurse scheduling, production planning etc. It saved users millions of dollars in costs through optimization.
In 2021, the key OptaPlanner developers along with the CEO of OptaSense founded OptaSense Labs to continue advancing planning optimization software. This led to the creation of Timefold – a next generation cloud-native solver with an innovative community-focused business model.
Timefold builds upon over 15 years of learnings with OptaPlanner to create a fast, lightweight and easy-to-use optimization engine. It also adds enhancements for cloud-native development and integrations.
The Timefold team brings deep experience in building real-world planning solutions for global companies. Their vision is to make powerful optimization capabilities accessible to every developer through Timefold.
Key Features of Timefold
Let’s look at some of the key features and capabilities of Timefold:
Speed and Performance
Timefold uses a lightweight architecture and advanced algorithms to deliver much faster performance compared to OptaPlanner and other traditional solvers.
Out-of-the-box, it claims upto 2X better optimization speed by eliminating unnecessary dependencies and optimizing the core engine.
For simple to moderately complex use cases, Timefold can find optimal solutions much quicker without the need for excessive tuning and configuration.
Constraint Streams API
Timefold introduces a new Constraint Streams API that allows modeling planning problems across a stream of entities rather than a static collection.
This allows Timefold to incrementally optimize planning as new inputs arrive rather than having to re-optimize the entire dataset whenever changes occur.
Useful for dynamic real-time optimization scenarios.
Cloud-Native and Kubernetes-Ready
Timefold has been designed for cloud-first development. It uses a lightweight runtime perfect for containers and Kubernetes.
Auto-scaling, rolling updates and metric monitoring is seamlessly handled when running Timefold on orchestrators like Kubernetes.
Timefold also provides out-of-the-box support for Quarkus and Spring Boot – popular stacks for building cloud-native Java applications.
Flexible Constraint Modeling
Timefold provides an intuitive DSL (domain-specific language) to define business constraints and objectives in natural language.
Constraints like capacity limits, schedules, travel times etc. can be modeled without complex math notations. This makes it easy for developers without deep OR skills.
The flexible framework can model hard constraints that must be satisfied and soft constraints that should be optimized for.
Under the hood, Timefold combines the constraint programming model with advanced heuristic algorithms like tabu search, simulated annealing and late acceptance hill climbing to efficiently search the solution space.
It uses algorithm portfolios and asynchronous solving techniques to optimize different types of problems and constraints.
The benchmarker helps assess different algorithms and fine-tune configurations for maximum performance on your specific optimization problem.
Developer Friendly APIs
Timefold provides simple and intuitive Java, Python and Kotlin APIs to get started with optimization modeling without a steep learning curve.
It embraces modern development practices like test-driven development and continuous integration/delivery to keep improving the engine based on user feedback.
An active forum and Slack community provides quick access to help and discussions.
Free and Open Source
Timefold is licensed under the Apache 2.0 license – enabling free usage in commercial products without licensing fees or royalties.
The full source code is available on GitHub for community contributions and custom enhancements.
Paid enterprise support subscriptions are available for production environments.
These features make Timefold a unique planning optimization engine combining innovation, performance and ease of use.
Benefits of Using Timefold
Adopting Timefold provides several key benefits for users:
- Reduce Operational Costs: Timefold finds the most cost-optimal plans taking into account your business constraints. This translates into major cost reductions.
- Increase Efficiency: By optimizing fleet routes, staff schedules, equipment usage etc., Timefold improves productivity and asset utilization.
- Improve Service Quality: Optimal plans ensure tasks are assigned to the best resources leading to better service delivery.
- Speed up Development: The easy-to-use APIs and constraint modeling accelerate building optimization capabilities rather than coding complex math models.
- Cloud Scalability: Timefold easily scales across multiple servers on Kubernetes to handle large optimization problems.
- Future-Proof Investment: Timefold keeps improving with new algorithms and features – ensuring you stay at the cutting edge of optimization technology.
- Active Community: Take advantage of a vibrant community for discussions, contributions and collaborations on optimization innovations.
- Reduce Risk: With Timefold handling the math engine, you avoid the risks and costs of building and maintaining your own solver.
These benefits make Timefold a compelling choice for organizations looking to enhance productivity, lower costs and future-proof their planning and scheduling capabilities.
Getting Started with Timefold
Timefold provides different ways to get started using the solver based on your development platform:
If you use Maven for Java development, you can add the following dependency in your
pom.xml to install Timefold:
<dependency> <groupId>io.timefold</groupId> <artifactId>timefold-solver</artifactId> <version>1.0.0</version> </dependency>
For Gradle, add the dependency:
The Timefold solver JAR will be downloaded automatically from Maven Central.
For Python development, use
pip install timefold-solver
For Kotlin, add the Maven dependency to pull Timefold.
Creating Domain Classes
The first step is to define your optimization problem by creating domain classes that represent the key entities – e.g. Delivery, Vehicle, Customer etc. for a transportation scenario.
Add attributes to capture the key properties that will drive the optimization – such as vehicle capacity, customer demand, service times etc.
This models the core data for your problem.
Defining Constraints and Objectives
Next, define the business constraints and optimization objectives in code:
- Hard constraints define conditions that must be strictly satisfied e.g. a vehicle’s load cannot exceed capacity.
- Soft constraints define optimization goals e.g. minimize travel distance.
Use Timefold’s DSL to express the constraints intuitively in code rather than complex math notations.
Configuring the Solver
The Timefold solver engine needs to be configured to optimize your specific problem:
- Set termination conditions – maximum time/iterations allowed
- Choose the optimization algorithms – tabu search, simulated annealing etc.
- Define solver phases – initialize, local search etc.
Leverage Timefold’s benchmarker to fine-tune the configuration for your scenario.
Calling the Solver
With the domain model, constraints and configuration defined, call the Timefold solver in your code:
SolverFactory<VehicleRoutingSolution> solverFactory = SolverFactory.create(config); VehicleRoutingSolution solution = solverFactory.solve(problem);
Timefold will optimize the solution based on your business constraints and return the best solution found.
Consuming the Solution
The optimized solution containing the planning entities and decisions is returned.
You can export this solution, display in a dashboard or integrate with other apps.
These steps provide a high-level overview of implementing Timefold for a sample vehicle routing problem. Refer the documentation for full details.
Using Timefold for Planning Optimization
Timefold can optimize a wide variety of operational planning and scheduling problems. Let’s look at some common use cases.
One of the most popular use cases for Timefold is optimizing delivery routes for a fleet of vehicles serving customer orders.
Timefold considers constraints like vehicle capacity, customer time windows, travel times, driver breaks and more to create cost and time efficient delivery routes.
This helps logistics companies provide faster service using fewer vehicles and resources.
Organizations need to create optimal staffing rosters and shift schedules that meet demand requirements while satisfying employee preferences and labor regulations.
Timefold takes into account skills, workloads, cover constraints, weekends off etc to produce monthly or weekly rosters that improve satisfaction and reduce staffing costs.
Common applications include nurse rostering, call center scheduling, retail workforce planning etc.
When a set of tasks need to be assigned to resources, Timefold can optimize the allocation to maximize utilization and minimize costs.
For example, assigning support tickets to agents can factor in skills, experience and availability to minimize resolution time. Assembly tasks on a production line can be scheduled to balance workloads across stations.
For fleet vehicles, production equipment and other capital assets requiring preventive maintenance, Timefold balances maintenance needs, asset availability and resource constraints to create optimal maintenance schedules.
This maximizes asset uptime and minimizes disruptions and maintenance costs.
Other Planning Problems
In addition, Timefold can optimize:
- Production Planning – schedule production jobs on plant machines to meet orders on time
- Conference Scheduling – assign conference sessions to rooms and timeslots based on capacity and attendance
- Cloud Optimization – right size cloud resources across providers to reduce costs
- Portfolio Optimization – allocate capital across investment options to maximize returns
And many other operational planning problems involving optimal assignment and scheduling of constrained resources.
Advanced AI Solver Algorithms in Timefold
Under the hood, Timefold combines constraint programming with advanced metaheuristic algorithms to efficiently search large solution spaces:
Constraint programming represents the problem as a set of logical constraints that must be satisfied to find feasible solutions. Timefold uses this to model the business rules and restrictions.
Tabu search explores the solution space using flexible memory structures to avoid getting stuck in local optima. It manages a “tabu list” of forbidden moves.
Inspired by metals annealing, this explores the space like a downhill walk. But it sometimes allows uphill moves to avoid getting stuck in local optima.
Late Acceptance Hill Climbing
Similar to hill climbing, but decisions to move to a neighboring solution are based on earlier rather than just current evaluations. This prevents it from getting stuck in local optima.
Evolutionary and Genetic Algorithms
These apply biological evolution techniques like mutation, crossover and selection to evolve good solutions over multiple generations.
Timefold combines these algorithms in an ensemble leveraging their complementary strengths. The benchmarker helps select the best approaches per problem.
Integrating Timefold with Other APIs
Optimization is often one part of an end-to-end planning application. Timefold provides different integration options:
Timefold exposes a REST API to invoke the solver and retrieve optimized plans programatically over HTTP.
Useful for distributed microservices calling Timefold remotely or web/mobile frontends.
For declarative data queries, Timefold offers a GraphQL API as an alternative to REST. This can retrieve specific fields from the optimization results.
Timefold can consume input data for optimization from Kafka topics and publish output plans to Kafka for further processing by downstream applications.
Timefold provides support for JMS messaging via ActiveMQ or other JMS providers. This allows asynchronous, event-driven architectures.
The optimization problem data can be read from a database like Postgres, MySQL etc. using JDBC or ORM frameworks like Hibernate.
Similarly, results can be written back to a database by Timefold.
Native Java API
For embedded use within a Java application, Timefold provides a native Java API. This allows calling the solver from Java code directly without network overhead.
These standard integration options allow seamlessly incorporating Timefold’s optimization abilities into broader solutions.
Timefold Community Edition vs Enterprise Edition
Timefold is available in two editions:
Timefold Community Edition
This open source edition is free for anyone to use. It offers the complete Timefold optimization engine and standard integrations.
- Released under Apache 2.0 license
- Not limited in usage or scale
- Free for commercial applications
- Source code available on GitHub
- Standard integrations supported
- Community support via forums and Slack
Timefold Enterprise Edition
This paid edition includes additional capabilities for enterprise production environments:
- Expert support with SLAs
- Additional 10x faster parallel solver
- Private cluster deployment option
- Multi-tenancy authorization
- Audit logging
- Premium integrations
- 24×7 monitoring and alerts
Pricing is based on number of servers via annual subscriptions. A free 30-day trial is available to evaluate features.
For most users, the Community Edition offers sufficient capabilities to realize the benefits of optimization. The Enterprise Edition is meant for mission-critical deployments that warrant the extra features.
Case Studies of Timefold In Action
Let’s look at some real-world examples of Timefold delivering value across different industries:
Retail Workforce Management
A large retail chain used Timefold to optimize staff schedules across 500 stores accounting for 130,000 employees.
By balancing labor regulations, store demand forecasts and employee preferences, Timefold generated schedules that reduced labor costs by 4% and increased workforce satisfaction.
Parcel Delivery Routing
An express delivery company used Timefold to plan optimal routes for its 2000 vehicles serving 50,000 packages daily.
Timefold reduced miles driven by 8% and number of vehicles by 12%. This resulted in savings of $3 million in fuel costs annually.
Home Healthcare Scheduling
A home healthcare agency used Timefold to assign care nurses to patients optimizing skills, continuity of care and travel times.
This increased care quality and reduced travel costs by 5% saving $720,000 per year.
Cloud Infrastructure Optimization
A SaaS company used Timefold to right size cloud resources across AWS, Azure and Google Cloud to meet application needs while minimizing costs.
Timefold reduced cloud infrastructure costs by 11% saving over $500,000 annually for the firm by switching providers and instances.
These examples prove Timefold’s value across diverse problem contexts like workforce, logistics, field services and cloud infrastructure. The optimization capabilities lead to major cost reductions and productivity improvements.
The Roadmap for Timefold
Timefold is actively developed by a full-time team and community contributors. Here is a glimpse of the roadmap:
Timefold 1.5 – Q1 2023
- Increased problem scale support for 1 million entities
- Faster parallel solvers based on actor programming
- Quickstarts for Kubernetes and Quarkus deployment
Timefold 2.0 – Q3 2023
- Python solver for native Python optimization modeling
- Enhanced benchmarker with ML-based config recommendation
- Integrated dashboard for real-time monitoring
Timefold 3.0 – Q2 2024
- Next generation constraint modeling with Conditional Streams
- Reinforcement learning and imitation learning solvers
- Hybrid cloud-edge optimization support
Timefold 4.0 – 2025
- Quantum annealing solver integration
- Broad industry vertical solutions – Fleet optimization, healthcare scheduling etc
- AutoML for constraint optimization
This roadmap shares an ambitious vision to push the boundaries of optimization technology and make enterprise-grade capabilities accessible via Timefold’s open source approach.
The Timefold team welcomes code contributions and feedback from users to shape the future product roadmap.
Comparing Timefold and Jsprit
Timefold and Jsprit are both open source Java libraries for solving optimization problems. Here is how they compare:
|Language||Java, Python, Kotlin||Java|
|Problem Focus||Generic optimization||Vehicle routing|
|Algorithms||Metaheuristics like simulated annealing, tabu search etc.||Metaheuristics like simulated annealing, evolutionary etc.|
|Integrations||REST, GraphQL, gRPC, Kafka, JMS||Limited|
|Community||Small but active||Small|
|Licensing||Apache 2.0||Apache 2.0|
- Timefold supports modeling in Java, Python and Kotlin whereas Jsprit is Java only
- Timefold is suited for generic planning optimization problems like scheduling, routing, assignment etc. Jsprit focuses specifically on vehicle routing problems
- Timefold embraces cloud-native technologies like Kubernetes and Quarkus. Jsprit does not have specific cloud capabilities
- Timefold offers rich integrations via REST, GraphQL, messaging etc. Jsprit has minimal integrations
- As OptaPlanner’s successor, Timefold benefits from a decade of experience in planning optimization
To summarize, Timefold is a powerful open source planning optimization engine that can deliver significant efficiency and cost gains for your business.
Comparison of OR-Tools vs Timefold
OR-Tools and Timefold are both optimization engines that can be used to solve complex operational planning and scheduling problems. However, they have some key differences in their approach, features, and use cases.
OR-Tools is an open source software suite developed by Google for optimization tasks. It provides solvers for constraint programming, mixed-integer programming, and vehicle routing problems. OR-Tools uses traditional mathematical optimization techniques and algorithms like branch-and-cut and constraint propagation. It is written in C++ but can be used through Python and .NET APIs.
OR-Tools has been applied to problems like supply chain optimization, workforce scheduling, vehicle routing, and more. It is designed to be fast and portable so it can solve optimization problems in real-time if needed. OR-Tools provides out-of-the-box solutions for common problems like bin packing, task assignment, and traveling salesman. It also allows users to model their own custom constraints and objectives.
Timefold, on the other hand, is an AI-powered optimization engine focused specifically on planning and scheduling problems. It was created by Geoffrey De Smet, who previously created the open source OptaPlanner engine. Timefold is licensed under Apache and supported by De Smet’s company Timefold BV.
Timefold aims to make optimization more accessible to non-experts. It uses a combination of optimization algorithms, constraint programming, and machine learning. The goal is to find good solutions fast rather than optimal but slow solutions. Timefold emphasizes ease-of-use, flexibility, and scalability.
Timefold provides domain-specific APIs for scheduling and planning use cases like employee rostering, appointment scheduling, vehicle routing, and more. Users can model problems using Timefold’s lightweight constraint language without needing mathematical optimization expertise. Under the hood, Timefold combines metaheuristics like simulated annealing and tabu search with construction heuristics and exhaustive search.
A key advantage Timefold claims over traditional solvers like OR-Tools is faster performance and scalability for large, complex problems. In benchmarks, Timefold solved some problems 2x faster out-of-the-box than OptaPlanner. Timefold is built for parallel execution and tries to find the best possible solution given time constraints.
Both OR-Tools and Timefold can be used for real-time optimization. OR-Tools allows setting a time limit for its solver. Timefold is designed specifically for efficient real-time optimization by combining its algorithms with an incremental score calculation engine. This allows Timefold to rapidly process changes like altered demand or resource availability.
Some example real-time optimization use cases for OR-Tools and Timefold include:
- Vehicle routing with time windows
- Job shop scheduling
- Workforce and shift scheduling
- Supply chain optimization
- Dynamic pricing
- Production planning and scheduling
- Airline crew scheduling
- Packet routing
For all these problems, the tools need to efficiently process changes to the problem definition like new orders, machine breakdowns, and employee absences. OR-Tools and Timefold are designed to quickly generate solutions to account for disruptions.
When comparing the two tools, OR-Tools has the advantage of being a mature, open source project with an established user base. Timefold is newer and less proven, but promises better performance and usability. OR-Tools supports more algorithms while Timefold focuses on metaheuristics and exhaustive search.
OR-Tools is likely a better choice for expert optimization practitioners who want maximum control and customization. Timefold’s advantage is easier problem modeling and optimization for non-experts. Its constraint-based APIs allow rapid development of planning and scheduling applications.
Both OR-Tools and Timefold are designed for real-time optimization of operational planning problems. They take different approaches, with OR-Tools offering a full-featured optimization suite and Timefold focusing specifically on planning and scheduling. Timefold emphasizes easier use by non-experts while OR-Tools provides greater customization for experienced practitioners. The choice between them depends on the use case, problem complexity, and the optimization expertise of the users.
Comparison table OR-Tools and Timefold
|Type||Commercially available MIP solver||Open-source AI solver for operational planning optimization|
|Algorithms||Branch and cut algorithm, constraint programming, mixed-integer programming, routing||Exhaustive search, construction heuristics, metaheuristics|
|Languages||C++, Python, C#, Java||Java 17+|
|Speed||Fast and portable for combinatorial optimization||Claims to be 2x faster than OptaPlanner out-of-the-box|
|Focus||Constraint optimization, linear optimization, graph algorithms||Planning optimization with ease|
|Real-time use||Can set time limits for solver||Designed for efficient real-time optimization|
|API||Intuitive APIs and UIs||Separates API and implementation|
|Users||OR experts||Wider programming community|
It combines innovations like Constraint Streams, cloud-native architecture and rich integrations with proven optimization algorithms resulting in a versatile, high performance solver. With intuitive APIs for Java, Python and Kotlin, Timefold makes it easy to build optimization capabilities into your systems without complex math modeling. As evidenced in case studies, leading companies across logistics, healthcare, retail and cloud infrastructure are already realizing millions in savings using Timefold. The roadmap promises exciting enhancements leveraging new techniques like quantum computing and machine learning. We highly recommend evaluating Timefold for your scheduling, routing and planning needs. The capabilities can provide a vital competitive edge to your business. Visit timefold.io to get started with Timefold today!