optaplanner-core/src/main/java/org/optaplanner/core/config/heuristic/selector/move/composite/UnionMoveSelectorConfig.java
@Override
    public MoveSelector buildBaseMoveSelector(HeuristicConfigPolicy configPolicy,
            SelectionCacheType minimumCacheType, boolean randomSelection) {
        List<MoveSelector> moveSelectorList = new ArrayList<>(moveSelectorConfigList.size());
        for (MoveSelectorConfig moveSelectorConfig : moveSelectorConfigList) {
            moveSelectorList.add(
                    moveSelectorConfig.buildMoveSelector(configPolicy,
                            minimumCacheType, SelectionOrder.fromRandomSelectionBoolean(randomSelection)));
        }

        SelectionProbabilityWeightFactory selectorProbabilityWeightFactory;
        if (selectorProbabilityWeightFactoryClass != null) {
            if (!randomSelection) {
                throw new IllegalArgumentException("The moveSelectorConfig (" + this
                        + ") with selectorProbabilityWeightFactoryClass (" + selectorProbabilityWeightFactoryClass
                        + ") has non-random randomSelection (" + randomSelection + ").");
            }
            selectorProbabilityWeightFactory = ConfigUtils.newInstance(this,
                    "selectorProbabilityWeightFactoryClass", selectorProbabilityWeightFactoryClass);
        } else if (randomSelection) {
            Map<MoveSelector, Double> fixedProbabilityWeightMap = new HashMap<>(
                    moveSelectorConfigList.size());
            for (int i = 0; i < moveSelectorConfigList.size(); i++) {
                MoveSelectorConfig moveSelectorConfig = moveSelectorConfigList.get(i);
                MoveSelector moveSelector = moveSelectorList.get(i);
                Double fixedProbabilityWeight = moveSelectorConfig.getFixedProbabilityWeight();
                if (fixedProbabilityWeight == null) {
                    // Default to equal probability for each move type => unequal probability for each move instance
                    fixedProbabilityWeight = 1.0;
                }
                fixedProbabilityWeightMap.put(moveSelector, fixedProbabilityWeight);
            }
            selectorProbabilityWeightFactory = new FixedSelectorProbabilityWeightFactory(fixedProbabilityWeightMap);
        } else {
            selectorProbabilityWeightFactory = null;
        }
        return new UnionMoveSelector(moveSelectorList, randomSelection,
                selectorProbabilityWeightFactory);
    }
@Override
    public MoveSelector buildBaseMoveSelector(HeuristicConfigPolicy configPolicy,
            SelectionCacheType minimumCacheType, boolean randomSelection) {
        List<MoveSelector> moveSelectorList = new ArrayList<>(moveSelectorConfigList.size());
        for (MoveSelectorConfig moveSelectorConfig : moveSelectorConfigList) {
            moveSelectorList.add(
                    moveSelectorConfig.buildMoveSelector(configPolicy,
                            minimumCacheType, SelectionOrder.fromRandomSelectionBoolean(randomSelection)));
        }

        SelectionProbabilityWeightFactory selectorProbabilityWeightFactory;
        if (selectorProbabilityWeightFactoryClass != null) {
            if (!randomSelection) {
                throw new IllegalArgumentException("The moveSelectorConfig (" + this
                        + ") with selectorProbabilityWeightFactoryClass (" + selectorProbabilityWeightFactoryClass
                        + ") has non-random randomSelection (" + randomSelection + ").");
            }
            selectorProbabilityWeightFactory = ConfigUtils.newInstance(this,
                    "selectorProbabilityWeightFactoryClass", selectorProbabilityWeightFactoryClass);
        } else if (randomSelection) {
            Map<MoveSelector, Double> fixedProbabilityWeightMap = new HashMap<>(
                    moveSelectorConfigList.size());
            for (int i = 0; i < moveSelectorConfigList.size(); i++) {
                MoveSelectorConfig moveSelectorConfig = moveSelectorConfigList.get(i);
                MoveSelector moveSelector = moveSelectorList.get(i);
                Double fixedProbabilityWeight = moveSelectorConfig.getFixedProbabilityWeight();
                if (fixedProbabilityWeight == null) {
                    // Default to equal probability for each move type => unequal probability for each move instance
                    fixedProbabilityWeight = 1.0;
                }
                fixedProbabilityWeightMap.put(moveSelector, fixedProbabilityWeight);
            }
            selectorProbabilityWeightFactory = new FixedSelectorProbabilityWeightFactory(fixedProbabilityWeightMap);
        } else {
            selectorProbabilityWeightFactory = null;
        }
        return new UnionMoveSelector(moveSelectorList, randomSelection,
                selectorProbabilityWeightFactory);
    }
@ Override public MoveSelector buildBaseMoveSelector ( HeuristicConfigPolicy configPolicy , SelectionCacheType minimumCacheType , boolean randomSelection ) { List < MoveSelector > moveSelectorList = new ArrayList <> ( moveSelectorConfigList . size ( ) ) ; for ( MoveSelectorConfig moveSelectorConfig : moveSelectorConfigList ) { moveSelectorList . add ( moveSelectorConfig . buildMoveSelector ( configPolicy , minimumCacheType , SelectionOrder . fromRandomSelectionBoolean ( randomSelection ) ) ) ; } SelectionProbabilityWeightFactory selectorProbabilityWeightFactory ; if ( selectorProbabilityWeightFactoryClass != null ) { if ( ! randomSelection ) { throw new IllegalArgumentException ( "The moveSelectorConfig (" + this + ") with selectorProbabilityWeightFactoryClass (" + selectorProbabilityWeightFactoryClass + ") has non-random randomSelection (" + randomSelection + ")." ) ; } selectorProbabilityWeightFactory = ConfigUtils . newInstance ( this , "selectorProbabilityWeightFactoryClass" , selectorProbabilityWeightFactoryClass ) ; } else if ( randomSelection ) { Map < MoveSelector , Double > fixedProbabilityWeightMap = new HashMap <> ( moveSelectorConfigList . size ( ) ) ; for ( int i = 0 ; i < moveSelectorConfigList . size ( ) ; i ++ ) { MoveSelectorConfig moveSelectorConfig = moveSelectorConfigList . get ( i ) ; MoveSelector moveSelector = moveSelectorList . get ( i ) ; Double fixedProbabilityWeight = moveSelectorConfig . getFixedProbabilityWeight ( ) ; if ( fixedProbabilityWeight == null ) { // Default to equal probability for each move type => unequal probability for each move instance fixedProbabilityWeight = 1.0 ; } fixedProbabilityWeightMap . put ( moveSelector , fixedProbabilityWeight ) ; } selectorProbabilityWeightFactory = new FixedSelectorProbabilityWeightFactory ( fixedProbabilityWeightMap ) ; } else { selectorProbabilityWeightFactory = null ; } return new UnionMoveSelector ( moveSelectorList , randomSelection , selectorProbabilityWeightFactory ) ; }
************************************************************************
************************************************************************