Uploaded image for project: 'OptaPlanner'
  1. OptaPlanner
  2. PLANNER-2905

Constraint Verifier doesn't treat BigDecimal penalties properly

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • Major
    • 8.35.0.Final
    • 8.34.0.Final
    • optaplanner-test
    • None
    • 2023 Week 06-08 (from Feb 6)
    • 3
    • NEW
    • NEW

    Description

      Assume this constraint verifier code:

      constraintVerifier.verifyThat(TennisConstraintProvider::fairAssignmentCountPerTeam)
              .given(assignment1, assignment2, assignment3)
              .penalizesBy(BigDecimal.valueOf(1.732));
      

      The test will pass regardless of whether the constraint actually impacts by 1.732, 1.73 or 1.7. This is because internally, the impacts are actually cast to long.

      Attachments

        Activity

          People

            lpetrovi@redhat.com Lukáš Petrovický (Inactive)
            lpetrovi@redhat.com Lukáš Petrovický (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: