Closed
Description
Main goal is to avoid having two separate constraint streams which compute the same value used for both scores.
The desired result for one of the use cases:
.forEach(Entity.class)
.groupBy(Function.identity(), sum(Entity::getValue))
.map((entity, value) -> value)
.penalize(HardSoftScore.of(value > 100 ? value : 0, value))
Or perhaps using lambda function directly in the penalize/reward like this:
.forEach(Entity.class)
.groupBy(Function.identity(), sum(Entity::getValue))
.penalize((entity, value) -> HardSoftScore.of(value > 100 ? value : 0, value))