Luka Bradeško
Luka Bradeško

Reputation: 532

UnsupportedOperationException in OptaPlanner when trying to use .penalizeLong

I am getting java.lang.UnsupportedOperationException: Impossible state: passing long into an int impacter.

When trying to use .penalizeLong function from ConstraintProvider class.

Upvotes: 1

Views: 181

Answers (1)

yurloc
yurloc

Reputation: 2358

You have an int based score type, for example HardSoftScore. You can't penalize that with a long match weight.

You have 2 options:

Option A. If your match weights fit into the int type size, simply replace penalizeLong() with penalize().

Option B. Otherwise, if you need to penalize with long match weight. Change the score type from HardSoftScore to HardSoftLongScore in your @PlanningSolution annotated class.

Upvotes: 6

Related Questions