-
Bug
-
Resolution: Done
-
Critical
-
None
-
None
-
2020 Week 13-15 (from Mar 23)
-
8
-
NEW
-
NEW
To reproduce on NQueens, add a dummy matchWeigher:
NQueensConstraintProvider.java
public class NQueensConstraintProvider implements ConstraintProvider { Constraint horizontalConflict(ConstraintFactory factory) { return factory .fromUniquePair(Queen.class, equal(Queen::getRowIndex)) // ------------------------------------------------------------------v .penalize("Horizontal conflict", SimpleScore.ONE, (queen, queen2) -> 2); } }
Update test:
NQueensConstraintProviderTest.java
public class NQueensConstraintProviderTest { @Test public void horizontalConflictWithTwoQueens() { Queen queen1 = new Queen(0, row1, column1); Queen queen2 = new Queen(1, row1, column2); constraintVerifier.verifyThat(constraintProvider::horizontalConflict) .given(queen1, queen2) .penalizesBy(2); // ------------------^ } }
The test should pass but it fails:
java.lang.AssertionError: Broken expectation. Constraint: org.optaplanner.examples.nqueens.domain/Horizontal conflict Expected penalty: 2 (class java.lang.Integer) Actual penalty: 1 (class java.lang.Integer)
- blocks
-
PLANNER-1801 Use Constraint Streams in OptaWeb Vehicle Routing
- Resolved