@@ -490,10 +490,9 @@ void solvePinnedAndUnassignedWithListAndBasicVariables() {
490490 .withTerminationConfig (new TerminationConfig ().withStepCountLimit (16 )))
491491 .withEasyScoreCalculatorClass (TestdataUnassignedListMultiVarEasyScoreCalculator .class );
492492
493+ // Pin the entire first entity
493494 var problem = TestdataUnassignedListMultiVarSolution .generateUninitializedSolution (2 , 2 , 2 );
494- // Pin the first entity
495495 problem .getEntityList ().get (0 ).setPinned (true );
496- problem .getEntityList ().get (0 ).setPinnedIndex (0 );
497496 problem .getEntityList ().get (0 ).setBasicValue (problem .getOtherValueList ().get (0 ));
498497 problem .getEntityList ().get (0 ).setSecondBasicValue (problem .getOtherValueList ().get (0 ));
499498 problem .getEntityList ().get (0 ).setValueList (List .of (problem .getValueList ().get (0 )));
@@ -510,6 +509,29 @@ void solvePinnedAndUnassignedWithListAndBasicVariables() {
510509 assertThat (solution .getEntityList ().get (1 ).getBasicValue ()).isNull ();
511510 assertThat (solution .getEntityList ().get (1 ).getSecondBasicValue ()).isNotNull ();
512511 assertThat (solution .getEntityList ().get (1 ).getValueList ()).isEmpty ();
512+
513+ // Pin partially the first entity list
514+ problem = TestdataUnassignedListMultiVarSolution .generateUninitializedSolution (2 , 3 , 2 );
515+ problem .getEntityList ().get (0 ).setPinnedIndex (2 );
516+ problem .getEntityList ().get (0 ).setBasicValue (problem .getOtherValueList ().get (0 ));
517+ problem .getEntityList ().get (0 ).setSecondBasicValue (problem .getOtherValueList ().get (0 ));
518+ problem .getEntityList ().get (0 ).setValueList (problem .getValueList ().subList (1 , 3 ));
519+ // Block values and make the basic variable unassigned
520+ problem .getOtherValueList ().get (0 ).setBlocked (true );
521+ problem .getOtherValueList ().get (1 ).setBlocked (true );
522+ solution = PlannerTestUtils .solve (solverConfig , problem );
523+ // The basic value is set to null because the entire entity is not fixed.
524+ assertThat (solution .getEntityList ().get (0 ).getBasicValue ()).isNull ();
525+ assertThat (solution .getEntityList ().get (0 ).getSecondBasicValue ()).isNotNull ();
526+ assertThat (solution .getEntityList ().get (0 ).getValueList ()).hasSize (3 );
527+ // The pinning index fixed the values 1 and 2. The only remaining option is value 0.
528+ assertThat (solution .getEntityList ().get (0 ).getValueList ())
529+ .hasSameElementsAs (
530+ List .of (problem .getValueList ().get (1 ), problem .getValueList ().get (2 ), problem .getValueList ().get (0 )));
531+ assertThat (solution .getEntityList ().get (1 ).getBasicValue ()).isNull ();
532+ assertThat (solution .getEntityList ().get (1 ).getSecondBasicValue ()).isNotNull ();
533+ assertThat (solution .getEntityList ().get (1 ).getValueList ()).isEmpty ();
534+
513535 }
514536
515537 @ Test
0 commit comments