From the quickstarts, I was attempting to modify the hard-coded constraints in EmployeeSchedulingConstraintProvider
, but was not successful in doing so.
For example, I attempted modifying the atLeast10HoursBetweenTwoShifts
to accept other values e.g. 5.
Attempt 1:
Injecting a Repository into the EmployeeSchedulingConstraintProvider
, but it always returned null. It appears that I should not be mixing Quarkus and Timefold together.
Attempt 2:
Adding an additional parameter List<ConstraintCriteria> constraints
into the EmployeeSchedule
class, which is used in solve()
in EmployeeScheduleResource
. However, attempts to extract the constraints out in the EmployeeSchedulingConstraintProvider
was not successful.
Attempt 3: Tried to follow the guide in Timefold Docs, but I am unable to add @PlanningFactProperty and ConstraintPararameters to follow along the guide. I am not too sure if I am applying it correctly.
Cannot resolve symbol 'PlanningFactProperty'
Cannot resolve symbol 'ConstraintPararameters'
<version.io.quarkus>3.14.2</version.io.quarkus>
<version.ai.timefold.solver>1.13.0</version.ai.timefold.solver>
Noticed this guide being posted, which is similar to this problem, but it appears to use a Deprecated method: Making my soft constraint tunable in Timefold
Would appreciate some pointers, or guidance on how to proceed further, on easily modifying the constraint parameters
Chris' comment already explains what's wrong here.
PlanningFactProperty
should instead be called ProblemFactProperty
. We'll fix that.ConstraintParameters
is a user-defined class and it is not provided by Timefold Solver. You have to implement one, and you probably already have with ConstraintCriteria
.You refer to an older question, mentioning that it uses a deprecated method. That is true. What you see in our documentation now, overriding constraint weights, replaces constraint configuration.
Finally, our documentation also shows how to pass settings directly to constraints, avoiding any hard-coded values. Together, this should answer your question.