How can you switch between the algorithms of Timefold Solver in Spring Boot?

74 views Asked by At

In the Timefold Solver documentation it is mentioned that several types of algorithms can be used to solve a certain problem. How can this be configured in Spring Boot to be able to compare the performances of the algorithms or to perform various tests?

2

There are 2 answers

1
Geoffrey De Smet On

One way is to create a src/main/resources/solverConfig.xml (the default location of timefold.solver.solver-config-xml) and configure it like this:

<?xml version="1.0" encoding="UTF-8"?>
<solver xmlns="https://timefold.ai/xsd/solver" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="https://timefold.ai/xsd/solver https://timefold.ai/xsd/solver/solver.xsd">

    <constructionHeuristic/>
    <localSearch/>
</solver>

No need to specify the entityClass elements etc, the Timefold Spring Boot starter will take care of that for you.


That being said, the best way to benchmark different algorithms, is to use the timefold-solver-benchmark module (see docs).

0
Lukáš Petrovický On

The documentation describes a property called timefold.solver.solver-config-xml. It allows you to specify a full solver config XML in which you can configure every aspect of the solver. You can also build the SolverConfig as a POJO and build the solver from it yourself.