Search code examples
javaoptaplannertimefold

Timefold Over Constrained Planning Initializing Score Trend


I have a single entity and a sing planning value. The planning value is nullable. Hard/Medium/Soft score configuration.

All of the constraints are penalties/negative.

I'm trying to figure out if InitializingScoreTrend is applicable to over-constrained planning, and if it is, how I should configure it.

Upon startSolving, the Medium score will be very negative, hard score is 0, soft score is 0. As values are assigned, the medium score will move closer to 0. The soft score will generally move more negative, but can fluctuate. If one value is assigned, and another gets assigned, the soft score can move closer to zero.


Solution

  • Initializing score trend isn't really related to over-constrained planning. The only thing that matters for the trend is the score.

    There is no way for me to answer your question in a specific manner - I do not have insight on your scoring function. That said, if you say that hard score is always zero and therefore only the medium score matters, I'd argue you have to use InitializingScoreTrend.ANY (the default).

    However, I question what would such a scoring function be for. Why even have a hard score, if it's always zero? (And if it's sometimes not zero, than hard score is the key factor for the trend, not the medium score.)

    Even if I disregard that aspect, I would be very curious about the reasons why you're worried about InitializingScoreTrend at all. Yes, it can bring some performance benefits, but if you're running into such large construction heuristics performance issues, you'd be better off writing a custom initializer anyway.