Skip to content

Feat: Setting Hard Score and Soft Score to different values in the Constraint Stream #1348

Description

@ln53491

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))

Activity

  1. changed the title [-]Feat: Setting Hard Score and Soft Score to different values based in the Constraint Stream[/-] [+]Feat: Setting Hard Score and Soft Score to different values in the Constraint Stream[/+] on Jan 23, 2025
  2. triceo commented on Jan 23, 2025

    @triceo
    Collaborator

    Hello @ln53491, and thanks for taking the time to report this!

    Please see a previously reported feature request #1172, where I believe we've already discussed this.
    I am going to close this one as a duplicate.

  3. added
    resolution/duplicateThis issue or pull request already exists
    and removed
    process/needs triageRequires initial assessment of validity, priority etc.
    on Jan 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    resolution/duplicateThis issue or pull request already exists

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions