Examples of BendableScore


Examples of org.optaplanner.core.api.score.buildin.bendable.BendableScore

        XStreamBendableScoreConverterTestObject input = new XStreamBendableScoreConverterTestObject(
                BendableScore.valueOf(new int[]{-5}, new int[]{-300, -4000}));
        SerializationTestUtils.serializeAndDeserializeWithAll(input,
                new SerializationTestUtils.OutputAsserter<XStreamBendableScoreConverterTestObject>() {
                    public void assertOutput(XStreamBendableScoreConverterTestObject output) {
                        BendableScore score = output.getScore();
                        assertEquals(1, score.getHardLevelsSize());
                        assertEquals(-5, score.getHardScore(0));
                        assertEquals(2, score.getSoftLevelsSize());
                        assertEquals(-300, score.getSoftScore(0));
                        assertEquals(-4000, score.getSoftScore(1));
                    }
                }
        );
    }
View Full Code Here

Examples of org.optaplanner.core.api.score.buildin.bendable.BendableScore

        int[] scores = new int [levelSize];
        for (int i = 0; i < levelSize; i++) {
            scores[i] = i;
        }
        BendableScoreDefinition bendableScoreDefinition = new BendableScoreDefinition(hardLevelSize, softLevelSize);
        BendableScore bendableScore = bendableScoreDefinition.createScore(scores);
        assertEquals(hardLevelSize, bendableScore.getHardLevelsSize());
        assertEquals(softLevelSize, bendableScore.getSoftLevelsSize());
        for (int i = 0; i < levelSize; i++) {
            if (i < hardLevelSize) {
                assertEquals(scores[i], bendableScore.getHardScore(i));
            } else {
                assertEquals(scores[i], bendableScore.getSoftScore(i - hardLevelSize));
            }
        }
    }
View Full Code Here

Examples of org.optaplanner.core.api.score.buildin.bendable.BendableScore

    }

    @Test
    public void buildOptimisticBoundOnlyUp() {
        BendableScoreDefinition scoreDefinition = new BendableScoreDefinition(2, 3);
        BendableScore optimisticBound = scoreDefinition.buildOptimisticBound(
                InitializingScoreTrend.buildUniformTrend(InitializingScoreTrendLevel.ONLY_UP, 5),
                scoreDefinition.createScore(-1, -2, -3, -4, -5));
        assertEquals(Integer.MAX_VALUE, optimisticBound.getHardScore(0));
        assertEquals(Integer.MAX_VALUE, optimisticBound.getHardScore(1));
        assertEquals(Integer.MAX_VALUE, optimisticBound.getSoftScore(0));
        assertEquals(Integer.MAX_VALUE, optimisticBound.getSoftScore(1));
        assertEquals(Integer.MAX_VALUE, optimisticBound.getSoftScore(2));
    }
View Full Code Here

Examples of org.optaplanner.core.api.score.buildin.bendable.BendableScore

    }

    @Test
    public void buildOptimisticBoundOnlyDown() {
        BendableScoreDefinition scoreDefinition = new BendableScoreDefinition(2, 3);
        BendableScore optimisticBound = scoreDefinition.buildOptimisticBound(
                InitializingScoreTrend.buildUniformTrend(InitializingScoreTrendLevel.ONLY_DOWN, 5),
                scoreDefinition.createScore(-1, -2, -3, -4, -5));
        assertEquals(-1, optimisticBound.getHardScore(0));
        assertEquals(-2, optimisticBound.getHardScore(1));
        assertEquals(-3, optimisticBound.getSoftScore(0));
        assertEquals(-4, optimisticBound.getSoftScore(1));
        assertEquals(-5, optimisticBound.getSoftScore(2));
    }
View Full Code Here

Examples of org.optaplanner.core.api.score.buildin.bendable.BendableScore

    }

    @Test
    public void buildPessimisticBoundOnlyUp() {
        BendableScoreDefinition scoreDefinition = new BendableScoreDefinition(2, 3);
        BendableScore pessimisticBound = scoreDefinition.buildPessimisticBound(
                InitializingScoreTrend.buildUniformTrend(InitializingScoreTrendLevel.ONLY_UP, 5),
                scoreDefinition.createScore(-1, -2, -3, -4, -5));
        assertEquals(-1, pessimisticBound.getHardScore(0));
        assertEquals(-2, pessimisticBound.getHardScore(1));
        assertEquals(-3, pessimisticBound.getSoftScore(0));
        assertEquals(-4, pessimisticBound.getSoftScore(1));
        assertEquals(-5, pessimisticBound.getSoftScore(2));
    }
View Full Code Here

Examples of org.optaplanner.core.api.score.buildin.bendable.BendableScore

    }

    @Test
    public void buildPessimisticBoundOnlyDown() {
        BendableScoreDefinition scoreDefinition = new BendableScoreDefinition(2, 3);
        BendableScore pessimisticBound = scoreDefinition.buildPessimisticBound(
                InitializingScoreTrend.buildUniformTrend(InitializingScoreTrendLevel.ONLY_DOWN, 5),
                scoreDefinition.createScore(-1, -2, -3, -4, -5));
        assertEquals(Integer.MIN_VALUE, pessimisticBound.getHardScore(0));
        assertEquals(Integer.MIN_VALUE, pessimisticBound.getHardScore(1));
        assertEquals(Integer.MIN_VALUE, pessimisticBound.getSoftScore(0));
        assertEquals(Integer.MIN_VALUE, pessimisticBound.getSoftScore(1));
        assertEquals(Integer.MIN_VALUE, pessimisticBound.getSoftScore(2));
    }
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.