Package org.drools.planner.core.domain.entity

Examples of org.drools.planner.core.domain.entity.PlanningEntityDescriptor.extractEntities()


    public void runOriginalAndCacheType(SelectionCacheType cacheType, int timesCalled) {
        TestdataSolution workingSolution = new TestdataSolution();
        final List<Object> entityList = Arrays.<Object>asList(
                new TestdataEntity("e1"), new TestdataEntity("e2"), new TestdataEntity("e3"));
        PlanningEntityDescriptor entityDescriptor = mock(PlanningEntityDescriptor.class);
        when(entityDescriptor.extractEntities(workingSolution)).thenReturn(entityList);
        FromSolutionEntitySelector entitySelector = new FromSolutionEntitySelector(entityDescriptor, cacheType, false);

        DefaultSolverScope solverScope = mock(DefaultSolverScope.class);
        when(solverScope.getWorkingSolution()).thenReturn(workingSolution);
        entitySelector.solvingStarted(solverScope);
View Full Code Here


    public void runRandomAndCacheType(SelectionCacheType cacheType, int timesCalled) {
        TestdataSolution workingSolution = new TestdataSolution();
        final List<Object> entityList = Arrays.<Object>asList(
                new TestdataEntity("e1"), new TestdataEntity("e2"), new TestdataEntity("e3"));
        PlanningEntityDescriptor entityDescriptor = mock(PlanningEntityDescriptor.class);
        when(entityDescriptor.extractEntities(workingSolution)).thenReturn(entityList);
        FromSolutionEntitySelector entitySelector = new FromSolutionEntitySelector(entityDescriptor, cacheType, true);

        Random workingRandom = mock(Random.class);
        when(workingRandom.nextInt(3)).thenReturn(1, 0, 0, 2, 1, 2, 2, 1, 0);
View Full Code Here

    }

    private Object findTrailingEntity(Object planningEntity) {
        Object trailingEntity = null;
        PlanningEntityDescriptor entityDescriptor = planningVariableDescriptor.getPlanningEntityDescriptor();
        for (Object suspectedTrailingEntity : entityDescriptor.extractEntities(scoreDirector.getWorkingSolution())) {
            if (planningVariableDescriptor.getValue(suspectedTrailingEntity) == planningEntity) {
                if (trailingEntity != null) {
                    throw new IllegalStateException("The planningEntity (" + planningEntity
                            + ") has multiple trailing entities (" + trailingEntity + ") ("
                            + suspectedTrailingEntity + ") pointing to it for chained planningVariable ("
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.