private LocalSearchSolverPhaseScope createLocalSearchSolverPhaseScope() { DefaultSolverScope solverScope = new DefaultSolverScope(); LocalSearchSolverPhaseScope phaseScope = new LocalSearchSolverPhaseScope(solverScope); DroolsScoreDirectorFactory scoreDirectorFactory = new DroolsScoreDirectorFactory(); scoreDirectorFactory.setSolutionDescriptor(TestdataSolution.buildSolutionDescriptor()); scoreDirectorFactory.setScoreDefinition(new SimpleScoreDefinition()); solverScope.setScoreDirector(scoreDirectorFactory.buildScoreDirector()); solverScope.setWorkingRandom( new Random() { public double nextDouble() { return 0.2; } }); solverScope.setBestScore(DefaultSimpleScore.valueOf(-1000)); LocalSearchStepScope lastLocalSearchStepScope = new LocalSearchStepScope(phaseScope); lastLocalSearchStepScope.setScore(DefaultSimpleScore.valueOf(-1000)); phaseScope.setLastCompletedStepScope(lastLocalSearchStepScope); return phaseScope; }
public void constructCache(DefaultSolverScope solverScope) { // TODO FIXME extractAllPlanningValues filters out uninitialized entities of another variable Collection<?> planningValues = variableDescriptor.extractAllPlanningValues(solverScope.getWorkingSolution()); cachedValueList = new ArrayList<Object>(planningValues.size() + 1); cachedValueList.addAll(planningValues); if (variableDescriptor.isNullable()) { cachedValueList.add(null); } }
public void constructCache(DefaultSolverScope solverScope) { cachedEntityMap = new TreeMap<Double, Object>(); ScoreDirector scoreDirector = solverScope.getScoreDirector(); double probabilityWeightOffset = 0L; for (Object value : childValueSelector) { double probabilityWeight = valueProbabilityWeightFactory.createProbabilityWeight(scoreDirector, value); cachedEntityMap.put(probabilityWeightOffset, value); probabilityWeightOffset += probabilityWeight; } probabilityWeightTotal = probabilityWeightOffset; }