@Override
    public ConstructionHeuristicPhase buildPhase(int phaseIndex, HeuristicConfigPolicy solverConfigPolicy,
            BestSolutionRecaller bestSolutionRecaller, Termination solverTermination) {
        HeuristicConfigPolicy phaseConfigPolicy = solverConfigPolicy.createPhaseConfigPolicy();
        phaseConfigPolicy.setReinitializeVariableFilterEnabled(true);
        phaseConfigPolicy.setInitializedChainedValueFilterEnabled(true);
        DefaultConstructionHeuristicPhase phase = new DefaultConstructionHeuristicPhase(
                phaseIndex, solverConfigPolicy.getLogIndentation(), bestSolutionRecaller,
                buildPhaseTermination(phaseConfigPolicy, solverTermination));
        phase.setDecider(buildDecider(phaseConfigPolicy, phase.getTermination()));
        ConstructionHeuristicType constructionHeuristicType_ = defaultIfNull(
                constructionHeuristicType, ConstructionHeuristicType.ALLOCATE_ENTITY_FROM_QUEUE);
        phaseConfigPolicy.setEntitySorterManner(entitySorterManner != null ? entitySorterManner
                : constructionHeuristicType_.getDefaultEntitySorterManner());
        phaseConfigPolicy.setValueSorterManner(valueSorterManner != null ? valueSorterManner
                : constructionHeuristicType_.getDefaultValueSorterManner());
        EntityPlacerConfig entityPlacerConfig;
        if (ConfigUtils.isEmptyCollection(entityPlacerConfigList)) {
            entityPlacerConfig = buildUnfoldedEntityPlacerConfig(phaseConfigPolicy, constructionHeuristicType_);
        } else if (entityPlacerConfigList.size() == 1) {
            entityPlacerConfig = entityPlacerConfigList.get(0);
            if (constructionHeuristicType != null) {
                throw new IllegalArgumentException("The constructionHeuristicType (" + constructionHeuristicType
                        + ") must not be configured if the entityPlacerConfig (" + entityPlacerConfig
                        + ") is explicitly configured.");
            }
            if (moveSelectorConfigList != null) {
                throw new IllegalArgumentException("The moveSelectorConfigList (" + moveSelectorConfigList
                        + ") can not be configured if the entityPlacerConfig (" + entityPlacerConfig
                        + ") is explicitly configured.");
            }
        } else {
            // TODO entityPlacerConfigList is only a List because of XStream limitations.
            throw new IllegalArgumentException("The entityPlacerConfigList (" + entityPlacerConfigList
                    + ") must be a singleton or empty. Use multiple " + ConstructionHeuristicPhaseConfig.class
                    + " elements to initialize multiple entity classes.");
        }
        EntityPlacer entityPlacer = entityPlacerConfig.buildEntityPlacer(phaseConfigPolicy);
        phase.setEntityPlacer(entityPlacer);
        EnvironmentMode environmentMode = phaseConfigPolicy.getEnvironmentMode();
        if (environmentMode.isNonIntrusiveFullAsserted()) {
            phase.setAssertStepScoreFromScratch(true);
        }
        if (environmentMode.isIntrusiveFastAsserted()) {
            phase.setAssertExpectedStepScore(true);
            phase.setAssertShadowVariablesAreNotStaleAfterStep(true);
        }
        return phase;
    }
@Override
    public ConstructionHeuristicPhase buildPhase(int phaseIndex, HeuristicConfigPolicy solverConfigPolicy,
            BestSolutionRecaller bestSolutionRecaller, Termination solverTermination) {
        HeuristicConfigPolicy phaseConfigPolicy = solverConfigPolicy.createPhaseConfigPolicy();
        phaseConfigPolicy.setReinitializeVariableFilterEnabled(true);
        phaseConfigPolicy.setInitializedChainedValueFilterEnabled(true);
        DefaultConstructionHeuristicPhase phase = new DefaultConstructionHeuristicPhase(
                phaseIndex, solverConfigPolicy.getLogIndentation(), bestSolutionRecaller,
                buildPhaseTermination(phaseConfigPolicy, solverTermination));
        phase.setDecider(buildDecider(phaseConfigPolicy, phase.getTermination()));
        ConstructionHeuristicType constructionHeuristicType_ = defaultIfNull(
                constructionHeuristicType, ConstructionHeuristicType.ALLOCATE_ENTITY_FROM_QUEUE);
        phaseConfigPolicy.setEntitySorterManner(entitySorterManner != null ? entitySorterManner
                : constructionHeuristicType_.getDefaultEntitySorterManner());
        phaseConfigPolicy.setValueSorterManner(valueSorterManner != null ? valueSorterManner
                : constructionHeuristicType_.getDefaultValueSorterManner());
        EntityPlacerConfig entityPlacerConfig;
        if (ConfigUtils.isEmptyCollection(entityPlacerConfigList)) {
            entityPlacerConfig = buildUnfoldedEntityPlacerConfig(phaseConfigPolicy, constructionHeuristicType_);
        } else if (entityPlacerConfigList.size() == 1) {
            entityPlacerConfig = entityPlacerConfigList.get(0);
            if (constructionHeuristicType != null) {
                throw new IllegalArgumentException("The constructionHeuristicType (" + constructionHeuristicType
                        + ") must not be configured if the entityPlacerConfig (" + entityPlacerConfig
                        + ") is explicitly configured.");
            }
            if (moveSelectorConfigList != null) {
                throw new IllegalArgumentException("The moveSelectorConfigList (" + moveSelectorConfigList
                        + ") can not be configured if the entityPlacerConfig (" + entityPlacerConfig
                        + ") is explicitly configured.");
            }
        } else {
            
            throw new IllegalArgumentException("The entityPlacerConfigList (" + entityPlacerConfigList
                    + ") must be a singleton or empty. Use multiple " + ConstructionHeuristicPhaseConfig.class
                    + " elements to initialize multiple entity classes.");
        }
        EntityPlacer entityPlacer = entityPlacerConfig.buildEntityPlacer(phaseConfigPolicy);
        phase.setEntityPlacer(entityPlacer);
        EnvironmentMode environmentMode = phaseConfigPolicy.getEnvironmentMode();
        if (environmentMode.isNonIntrusiveFullAsserted()) {
            phase.setAssertStepScoreFromScratch(true);
        }
        if (environmentMode.isIntrusiveFastAsserted()) {
            phase.setAssertExpectedStepScore(true);
            phase.setAssertShadowVariablesAreNotStaleAfterStep(true);
        }
        return phase;
    }
@ Override public ConstructionHeuristicPhase buildPhase ( int phaseIndex , HeuristicConfigPolicy solverConfigPolicy , BestSolutionRecaller bestSolutionRecaller , Termination solverTermination ) { HeuristicConfigPolicy phaseConfigPolicy = solverConfigPolicy . createPhaseConfigPolicy ( ) ; phaseConfigPolicy . setReinitializeVariableFilterEnabled ( true ) ; phaseConfigPolicy . setInitializedChainedValueFilterEnabled ( true ) ; DefaultConstructionHeuristicPhase phase = new DefaultConstructionHeuristicPhase ( phaseIndex , solverConfigPolicy . getLogIndentation ( ) , bestSolutionRecaller , buildPhaseTermination ( phaseConfigPolicy , solverTermination ) ) ; phase . setDecider ( buildDecider ( phaseConfigPolicy , phase . getTermination ( ) ) ) ; ConstructionHeuristicType constructionHeuristicType_ = defaultIfNull ( constructionHeuristicType , ConstructionHeuristicType . ALLOCATE_ENTITY_FROM_QUEUE ) ; phaseConfigPolicy . setEntitySorterManner ( entitySorterManner != null ? entitySorterManner : constructionHeuristicType_ . getDefaultEntitySorterManner ( ) ) ; phaseConfigPolicy . setValueSorterManner ( valueSorterManner != null ? valueSorterManner : constructionHeuristicType_ . getDefaultValueSorterManner ( ) ) ; EntityPlacerConfig entityPlacerConfig ; if ( ConfigUtils . isEmptyCollection ( entityPlacerConfigList ) ) { entityPlacerConfig = buildUnfoldedEntityPlacerConfig ( phaseConfigPolicy , constructionHeuristicType_ ) ; } else if ( entityPlacerConfigList . size ( ) == 1 ) { entityPlacerConfig = entityPlacerConfigList . get ( 0 ) ; if ( constructionHeuristicType != null ) { throw new IllegalArgumentException ( "The constructionHeuristicType (" + constructionHeuristicType + ") must not be configured if the entityPlacerConfig (" + entityPlacerConfig + ") is explicitly configured." ) ; } if ( moveSelectorConfigList != null ) { throw new IllegalArgumentException ( "The moveSelectorConfigList (" + moveSelectorConfigList + ") can not be configured if the entityPlacerConfig (" + entityPlacerConfig + ") is explicitly configured." ) ; } } else { // TODO entityPlacerConfigList is only a List because of XStream limitations. throw new IllegalArgumentException ( "The entityPlacerConfigList (" + entityPlacerConfigList + ") must be a singleton or empty. Use multiple " + ConstructionHeuristicPhaseConfig . class + " elements to initialize multiple entity classes." ) ; } EntityPlacer entityPlacer = entityPlacerConfig . buildEntityPlacer ( phaseConfigPolicy ) ; phase . setEntityPlacer ( entityPlacer ) ; EnvironmentMode environmentMode = phaseConfigPolicy . getEnvironmentMode ( ) ; if ( environmentMode . isNonIntrusiveFullAsserted ( ) ) { phase . setAssertStepScoreFromScratch ( true ) ; } if ( environmentMode . isIntrusiveFastAsserted ( ) ) { phase . setAssertExpectedStepScore ( true ) ; phase . setAssertShadowVariablesAreNotStaleAfterStep ( true ) ; } return phase ; }
************************************************************************
************************************************************************