• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java HardSoftScore类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.optaplanner.core.api.score.buildin.hardsoft.HardSoftScore的典型用法代码示例。如果您正苦于以下问题:Java HardSoftScore类的具体用法?Java HardSoftScore怎么用?Java HardSoftScore使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



HardSoftScore类属于org.optaplanner.core.api.score.buildin.hardsoft包,在下文中一共展示了HardSoftScore类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: calculateScore

import org.optaplanner.core.api.score.buildin.hardsoft.HardSoftScore; //导入依赖的package包/类
public Score calculateScore(ProblemDefinition problemDefinition, int initScore) {
       Set<Employee> employees = problemDefinition.getEmployees();
       Set<Task> tasks = problemDefinition.getTasks();
       Set<Task> assignedTasks = new HashSet<Task>();

       int hardScore = 0;
       int softScore = 0;

       for (Employee employee : employees) {
           if (employee.getTask() == null) {
               softScore++; //unassigned employee
           } else {
               assignedTasks.add(employee.getTask());
               if ((!employee.canDeliver(employee.getTask()))) {
                   softScore++; //skill mismatch
               }
           }
       }

       int unassignedTasks = tasks.size() - assignedTasks.size();
       hardScore += 5 * unassignedTasks; // tasks left unassigned

       HardSoftScore hardSoftScore = HardSoftScore.valueOf(initScore, -hardScore, -softScore);
       return hardSoftScore;
}
 
开发者ID:bibryam,项目名称:employee-task-assignment,代码行数:26,代码来源:ProblemScoreCalculator.java


示例2: validateIsAPlanningScore

import org.optaplanner.core.api.score.buildin.hardsoft.HardSoftScore; //导入依赖的package包/类
@Test
public void validateIsAPlanningScore() {
    DataObject dataObject = new DataObjectImpl("test",
                                               "PlanningSolution");
    dataObject.addAnnotation(new AnnotationImpl(DriverUtils.buildAnnotationDefinition(PlanningSolution.class)));

    ObjectProperty objectProperty = new ObjectPropertyImpl("score",
                                                           HardSoftScore.class.getName(),
                                                           false);
    objectProperty.addAnnotation(new AnnotationImpl(DriverUtils.buildAnnotationDefinition(PlanningScore.class)));
    objectProperty.addAnnotation(new AnnotationImpl(DriverUtils.buildAnnotationDefinition(Generated.class)));

    Collection<ValidationMessage> result = deleteValidator.validate(dataObject,
                                                                    objectProperty);
    assertEquals(1,
                 result.size());
    assertTrue(result.iterator().next() instanceof PlanningScoreToBeDeletedMessage);
}
 
开发者ID:kiegroup,项目名称:optaplanner-wb,代码行数:19,代码来源:PlanningScoreDeleteValidatorTest.java


示例3: scoreHolderTypeNotRecognized

import org.optaplanner.core.api.score.buildin.hardsoft.HardSoftScore; //导入依赖的package包/类
@Test
public void scoreHolderTypeNotRecognized() {
    Path dataObjectPath = PathFactory.newPath("Test.java",
                                              "file:///dataObjects");
    when(ioService.readAllString(Paths.convert(dataObjectPath))).thenReturn("testResult");

    DataObject originalDataObject = createDataObject(HardSoftScore.class);
    GenerationResult generationResult = new GenerationResult();
    generationResult.setDataObject(originalDataObject);
    when(dataModelerService.loadDataObject(any(),
                                           anyString(),
                                           any())).thenReturn(generationResult);
    when(scoreHolderUtils.extractScoreTypeFqn(originalDataObject)).thenReturn(HardSoftScore.class.getName());
    when(scoreHolderUtils.getScoreHolderTypeFqn(HardSoftScore.class.getName())).thenReturn(HardSoftScoreHolder.class.getName());

    when(assetsUsageService.getAssetUsages(HardSoftScoreHolder.class.getName(),
                                           ResourceType.JAVA, dataObjectPath)).thenReturn(Arrays.asList(mock(Path.class)));

    DataObject updatedDataObject = createDataObject(SimpleScore.class);
    when(scoreHolderUtils.extractScoreTypeFqn(updatedDataObject)).thenReturn("UnknownScoreClassName");
    when(scoreHolderUtils.getScoreHolderTypeFqn("UnknownScoreClassName")).thenReturn(null);
}
 
开发者ID:kiegroup,项目名称:optaplanner-wb,代码行数:23,代码来源:PlanningSolutionScoreHolderSaveValidatorTest.java


示例4: recomputeScore

import org.optaplanner.core.api.score.buildin.hardsoft.HardSoftScore; //导入依赖的package包/类
@Override
public ScoreResult recomputeScore(String cluster, Result oldResult) {
    ClusterOptimizer clusterOptimizer;

    clusterOptimizer = clusterOptimizers.get(cluster);
    if (clusterOptimizer == null) {
        log.error(String.format("Cluster %s does not exist", cluster));
        return null;
    }

    ScoreResult scoreResult = new ScoreResult();
    HardSoftScore score = clusterOptimizer.computeScore(oldResult);
    scoreResult.setHardScore(score.getHardScore());
    scoreResult.setSoftScore(score.getSoftScore());
    return scoreResult;
}
 
开发者ID:oVirt,项目名称:ovirt-optimizer,代码行数:17,代码来源:OptimizerServiceBean.java


示例5: testStartPinnedVm

import org.optaplanner.core.api.score.buildin.hardsoft.HardSoftScore; //导入依赖的package包/类
/**
 * Test whether a pinned to host VM can be started
 */
@Test
public void testStartPinnedVm() {
    TestOptimizer optimizer = new TestOptimizer(EnumSet.noneOf(ClusterFeatures.class));

    Host host = optimizer.createHost("H1", 1000000000L);

    VM vm = optimizer.createVm("VM-A", 10000000L);
    vm.getPlacementPolicy().setHost(host);
    vm.getPlacementPolicy().setAffinity("pinned");

    HardSoftScore result = optimizer
            .startVm(vm)
            .addMigration(vm, host)
            .enablePolicyUnit(PolicyUnit.PIN_TO_HOST_FILTER)
            .score();

    assertEquals(0, result.getHardScore());
}
 
开发者ID:oVirt,项目名称:ovirt-optimizer,代码行数:22,代码来源:SituationTest.java


示例6: testStartPinnedVmOnWrongHost

import org.optaplanner.core.api.score.buildin.hardsoft.HardSoftScore; //导入依赖的package包/类
/**
 * Test whether a pinned to host VM can be started on different host
 */
@Test
public void testStartPinnedVmOnWrongHost() {
    TestOptimizer optimizer = new TestOptimizer(EnumSet.noneOf(ClusterFeatures.class));

    Host host = optimizer.createHost("H1", 1000000000L);
    Host host2 = optimizer.createHost("H2", 1000000000L);

    VM vm = optimizer.createVm("VM-A", 10000000L);
    vm.getPlacementPolicy().setHost(host);
    vm.getPlacementPolicy().setAffinity("pinned");

    HardSoftScore result = optimizer
            .startVm(vm)
            .addMigration(vm, host2)
            .enablePolicyUnit(PolicyUnit.PIN_TO_HOST_FILTER)
            .score();

    assertNotEquals(0, result.getHardScore());
}
 
开发者ID:oVirt,项目名称:ovirt-optimizer,代码行数:23,代码来源:SituationTest.java


示例7: testMigratePinnedVm

import org.optaplanner.core.api.score.buildin.hardsoft.HardSoftScore; //导入依赖的package包/类
/**
 * Test whether a pinned to host VM can't be migrated
 */
@Test
public void testMigratePinnedVm() {
    TestOptimizer optimizer = new TestOptimizer(EnumSet.noneOf(ClusterFeatures.class));

    Host host1 = optimizer.createHost("H1", 1000000000L);
    Host host2 = optimizer.createHost("H2", 1000000000L);

    VM vm = optimizer.createVm("VM-A", 10000000L);
    vm.getPlacementPolicy().setHost(host1);
    vm.getPlacementPolicy().setAffinity("pinned");
    vm.setHost(host1);

    HardSoftScore result = optimizer
            .addMigration(vm, host2)
            .enablePolicyUnit(PolicyUnit.PIN_TO_HOST_FILTER)
            .score();

    assertNotEquals(0, result.getHardScore());
}
 
开发者ID:oVirt,项目名称:ovirt-optimizer,代码行数:23,代码来源:SituationTest.java


示例8: testStartHugeVm

import org.optaplanner.core.api.score.buildin.hardsoft.HardSoftScore; //导入依赖的package包/类
/**
 * Test whether a VM can't be started when it does not fit
 */
@Test
public void testStartHugeVm() {
    TestOptimizer optimizer = new TestOptimizer(EnumSet.noneOf(ClusterFeatures.class));

    Host host = optimizer.createHost("H1", 1000L);
    VM vm = optimizer.createVm("VM-A", 10000000L);

    HardSoftScore result = optimizer
            .startVm(vm)
            .addMigration(vm, host)
            .enablePolicyUnit(PolicyUnit.MEMORY_FILTER)
            .score();

    assertNotEquals(0, result.getHardScore());
}
 
开发者ID:oVirt,项目名称:ovirt-optimizer,代码行数:19,代码来源:SituationTest.java


示例9: testUnexpectedStart

import org.optaplanner.core.api.score.buildin.hardsoft.HardSoftScore; //导入依赖的package包/类
/**
 * Test whether a VM in Down state can't be started without user's request
 */
@Test
public void testUnexpectedStart() {
    TestOptimizer optimizer = new TestOptimizer(EnumSet.noneOf(ClusterFeatures.class));

    Host host1 = optimizer.createHost("H1", 1000000000L);
    Host host2 = optimizer.createHost("H2", 1000000000L);

    VM vm1 = optimizer.createVm("VM-A", 10000000L);
    vm1.setHost(host1);
    vm1.setStatus(new Status());
    vm1.getStatus().setState("UP");

    VM vm2 = optimizer.createVm("VM-B", 10000000L);
    vm2.setStatus(new Status());
    vm2.getStatus().setState("DOWN");

    HardSoftScore result = optimizer
            .addMigration(vm2, host2)
            .score();

    assertNotEquals(0, result.getHardScore());
}
 
开发者ID:oVirt,项目名称:ovirt-optimizer,代码行数:26,代码来源:SituationTest.java


示例10: testHERulesWithoutHE

import org.optaplanner.core.api.score.buildin.hardsoft.HardSoftScore; //导入依赖的package包/类
/**
 * Test HE rules for NPEs.
 */
@Test
public void testHERulesWithoutHE() {
    TestOptimizer optimizer = new TestOptimizer(EnumSet.noneOf(ClusterFeatures.class));

    Host host1 = optimizer.createHost("H1", 1000000000L);
    Host host2 = optimizer.createHost("H2", 1000000000L);

    VM vm1 = optimizer.createVm("VM-A", 10000000L);
    vm1.setHost(host1);
    vm1.setStatus(new Status());
    vm1.getStatus().setState("UP");
    vm1.setOrigin("hostedEngine");

    HardSoftScore result = optimizer
            .enablePolicyUnit(PolicyUnit.HOSTED_ENGINE_FILTER)
            .enablePolicyUnit(PolicyUnit.HOSTED_ENGINE_WEIGHT)
            .addMigration(vm1, host2)
            .score();

    // destination host is not HE enabled
    assertNotEquals(0, result.getHardScore());
    // -1 for a single performed migration
    assertEquals(-1, result.getSoftScore());
}
 
开发者ID:oVirt,项目名称:ovirt-optimizer,代码行数:28,代码来源:SituationTest.java


示例11: testNotEnoughCores

import org.optaplanner.core.api.score.buildin.hardsoft.HardSoftScore; //导入依赖的package包/类
/**
 * Test whether VM can be run on host with enough cores and
 * cannot be run on host with not enough cores
 */
@Test
public void testNotEnoughCores(){
    TestOptimizer optimizer = new TestOptimizer();

    Host host = optimizer.createHost("H1", 1000000000L);
    host.getCpu().getTopology().setSockets(1);
    host.getCpu().getTopology().setCores(2);

    VM vm = optimizer.createVm("VM-A", 10000000L);
    vm.getCpu().getTopology().setSockets(1);
    vm.getCpu().getTopology().setCores(2);

    optimizer.enablePolicyUnit(PolicyUnit.CPU_FILTER)
            .startVm(vm)
            .addMigration(vm,host);

    HardSoftScore r1 = optimizer.score();

    vm.getCpu().getTopology().setCores(4);
    HardSoftScore r2 = optimizer.score();

    assertEquals(0, r1.getHardScore());
    assertNotEquals(0, r2.getHardScore());
}
 
开发者ID:oVirt,项目名称:ovirt-optimizer,代码行数:29,代码来源:SituationTest.java


示例12: plan

import org.optaplanner.core.api.score.buildin.hardsoft.HardSoftScore; //导入依赖的package包/类
public List<ShiftAssignment> plan() {
    SolverFactory<Solution> solverFactory = SolverFactory.createFromXmlResource("planner/EmployeeRosteringSolverConfig.xml");
    Solver solver = solverFactory.buildSolver();

    EmployeeRoster employeeRoster = new EmployeeRoster();
    employeeRoster.setCode("TEST");
    employeeRoster.setSkillList(employeeRepository.listSkills());
    employeeRoster.setShiftTypeList(shiftRepository.listShiftTypes());
    employeeRoster.setShiftTypeSkillRequirementList(generateShiftTypeSkillRequirements());
    employeeRoster.setPatternList(patternsRepository.listAll());
    employeeRoster.setContractList(contractRepository.listAll());
    employeeRoster.setContractLineList(generateContractLines());
    employeeRoster.setPatternContractLineList(generateContractPatternList());
    employeeRoster.setEmployeeList(employeeRepository.listAll());
    employeeRoster.setSkillProficiencyList(generateSkillProficiency());
    employeeRoster.setShiftDateList(shiftRepository.listShiftDates());
    employeeRoster.setShiftList(shiftRepository.listShifts());
    employeeRoster.setDayOffRequestList(employeeRepository.listDayOffRequests());
    employeeRoster.setDayOnRequestList(employeeRepository.listDayOnRequests());
    employeeRoster.setShiftOffRequestList(employeeRepository.listShiftOffRequests());
    employeeRoster.setShiftOnRequestList(employeeRepository.listShiftOnRequests());
    employeeRoster.setEmployeeRosterParametrization(generateEmployeeRosterInfo());
    employeeRoster.setShiftAssignmentList(generateAssigments());

    employeeRoster = (EmployeeRoster) solver.solve(employeeRoster);
    final HardSoftScore score = employeeRoster.getScore();
    for (ShiftAssignment shiftAssignment : employeeRoster.getShiftAssignmentList()) {
        shiftRepository.createShiftAssignment(shiftAssignment.getShift(), shiftAssignment.getEmployee());
    }
    messageService.informUser(String.format("'%s' score ", score.toString()));

    return shiftRepository.listShiftAssignments();
}
 
开发者ID:bibryam,项目名称:rotabuilder,代码行数:34,代码来源:ShiftService.java


示例13: configure

import org.optaplanner.core.api.score.buildin.hardsoft.HardSoftScore; //导入依赖的package包/类
@Override
protected void configure() {
    type(LocalDate.class).serializer(LocalDateJsonSerializer.class).deserializer(LocalDateJsonDeserializer.class);
    type(LocalDateTime.class).serializer(LocalDateTimeJsonSerializer.class).deserializer(
            LocalDateTimeJsonDeserializer.class);
    type(HardSoftScore.class).serializer(HardSoftScoreJsonSerializer.class).deserializer(
            HardSoftScoreJsonDeserializer.class);
}
 
开发者ID:kiegroup,项目名称:optashift-employee-rostering,代码行数:9,代码来源:OptaShiftRosteringGwtJacksonConfiguration.java


示例14: planningSolutionSettings

import org.optaplanner.core.api.score.buildin.hardsoft.HardSoftScore; //导入依赖的package包/类
@Test
public void planningSolutionSettings() {

    PlannerDataObjectFieldEditor fieldEditor = createFieldEditor();

    //first configure the DataObject as a PlanningSolution
    DataObject dataObject = context.getDataObject();
    dataObject.addAnnotation(new AnnotationImpl(context.getAnnotationDefinition(PlanningSolution.class.getName())));
    dataObject.addProperty("score",
                           HardSoftScore.class.getName());

    ObjectProperty field1 = dataObject.getProperty("field1");
    //emulates the selection of field1
    context.setObjectProperty(field1);

    //The domain editors typically reacts upon DataModelerContext changes.
    //when the context changes the editor will typically be reloaded.
    fieldEditor.onContextChange(context);

    when(view.getValueRangeProviderValue()).thenReturn(true);
    when(view.getValueRangeProviderIdValue()).thenReturn("valueRangeProviderIdValue");

    //emulate the user input
    fieldEditor.onValueRangeProviderChange();
    fieldEditor.onValueRangeProviderIdChange();

    assertNotNull(field1.getAnnotation(ValueRangeProvider.class.getName()));
    assertEquals("valueRangeProviderIdValue",
                 AnnotationValueHandler.getStringValue(field1,
                                                       ValueRangeProvider.class.getName(),
                                                       "id"));
}
 
开发者ID:kiegroup,项目名称:optaplanner-wb,代码行数:33,代码来源:PlannerDataObjectFieldEditorTest.java


示例15: getFieldMetadataMatchingField

import org.optaplanner.core.api.score.buildin.hardsoft.HardSoftScore; //导入依赖的package包/类
@Test
public void getFieldMetadataMatchingField() {
    Annotation planningScoreAnnotation = new AnnotationImpl(DriverUtils.buildAnnotationDefinition(PlanningScore.class));
    ObjectProperty matchingField = new ObjectPropertyImpl("matchingField",
                                                          HardSoftScore.class.getName(),
                                                          false);
    matchingField.addAnnotation(planningScoreAnnotation);

    Optional<FieldMetadata> fieldMetadata = fieldMetadataProvider.getFieldMetadata(matchingField);

    assertTrue(fieldMetadata.isPresent());
}
 
开发者ID:kiegroup,项目名称:optaplanner-wb,代码行数:13,代码来源:PlannerFieldMetadataProviderTest.java


示例16: getScoreHolderTypeFqn

import org.optaplanner.core.api.score.buildin.hardsoft.HardSoftScore; //导入依赖的package包/类
public String getScoreHolderTypeFqn(final String scoreTypeFqn) {
    if (BendableScore.class.getName().equals(scoreTypeFqn)) {
        return BendableScoreHolder.class.getName();
    } else if (BendableBigDecimalScore.class.getName().equals(scoreTypeFqn)) {
        return BendableBigDecimalScoreHolder.class.getName();
    } else if (BendableLongScore.class.getName().equals(scoreTypeFqn)) {
        return BendableLongScoreHolder.class.getName();
    } else if (HardMediumSoftScore.class.getName().equals(scoreTypeFqn)) {
        return HardMediumSoftScoreHolder.class.getName();
    } else if (HardMediumSoftBigDecimalScore.class.getName().equals(scoreTypeFqn)) {
        return HardMediumSoftBigDecimalScoreHolder.class.getName();
    } else if (HardMediumSoftLongScore.class.getName().equals(scoreTypeFqn)) {
        return HardMediumSoftLongScoreHolder.class.getName();
    } else if (HardSoftScore.class.getName().equals(scoreTypeFqn)) {
        return HardSoftScoreHolder.class.getName();
    } else if (HardSoftBigDecimalScore.class.getName().equals(scoreTypeFqn)) {
        return HardSoftBigDecimalScoreHolder.class.getName();
    } else if (HardSoftDoubleScore.class.getName().equals(scoreTypeFqn)) {
        return HardSoftDoubleScoreHolder.class.getName();
    } else if (HardSoftLongScore.class.getName().equals(scoreTypeFqn)) {
        return HardSoftLongScoreHolder.class.getName();
    } else if (SimpleScore.class.getName().equals(scoreTypeFqn)) {
        return SimpleScoreHolder.class.getName();
    } else if (SimpleBigDecimalScore.class.getName().equals(scoreTypeFqn)) {
        return SimpleBigDecimalScoreHolder.class.getName();
    } else if (SimpleDoubleScore.class.getName().equals(scoreTypeFqn)) {
        return SimpleDoubleScoreHolder.class.getName();
    } else if (SimpleLongScore.class.getName().equals(scoreTypeFqn)) {
        return SimpleLongScoreHolder.class.getName();
    }
    return null;
}
 
开发者ID:kiegroup,项目名称:optaplanner-wb,代码行数:33,代码来源:ScoreHolderUtils.java


示例17: extractScoreTypeFqn

import org.optaplanner.core.api.score.buildin.hardsoft.HardSoftScore; //导入依赖的package包/类
@Test
public void extractScoreTypeFqn() {
    DataObject dataObject = new DataObjectImpl("test",
                                               "Test");
    dataObject.addAnnotation(new AnnotationImpl(DriverUtils.buildAnnotationDefinition(PlanningSolution.class)));
    dataObject.addProperty("score",
                           HardSoftScore.class.getName());

    String result = scoreHolderUtils.extractScoreTypeFqn(dataObject);

    assertEquals(HardSoftScore.class.getName(),
                 result);
}
 
开发者ID:kiegroup,项目名称:optaplanner-wb,代码行数:14,代码来源:ScoreHolderUtilsTest.java


示例18: scoreTypeChanged

import org.optaplanner.core.api.score.buildin.hardsoft.HardSoftScore; //导入依赖的package包/类
@Test
public void scoreTypeChanged() {
    Path dataObjectPath = PathFactory.newPath("Test.java",
                                              "file:///dataObjects");
    when(ioService.readAllString(Paths.convert(dataObjectPath))).thenReturn("testResult");

    DataObject originalDataObject = createDataObject(HardSoftScore.class);
    GenerationResult generationResult = new GenerationResult();
    generationResult.setDataObject(originalDataObject);
    when(dataModelerService.loadDataObject(any(),
                                           anyString(),
                                           any())).thenReturn(generationResult);
    when(scoreHolderUtils.extractScoreTypeFqn(originalDataObject)).thenReturn(HardSoftScore.class.getName());
    when(scoreHolderUtils.getScoreHolderTypeFqn(HardSoftScore.class.getName())).thenReturn(HardSoftScoreHolder.class.getName());

    when(assetsUsageService.getAssetUsages(HardSoftScoreHolder.class.getName(),
                                            ResourceType.JAVA, dataObjectPath)).thenReturn(Arrays.asList(mock(Path.class)));

    DataObject updatedDataObject = createDataObject(SimpleScore.class);
    when(scoreHolderUtils.extractScoreTypeFqn(updatedDataObject)).thenReturn(SimpleScore.class.getName());
    when(scoreHolderUtils.getScoreHolderTypeFqn(SimpleScore.class.getName())).thenReturn(SimpleScoreHolder.class.getName());

    Collection<ValidationMessage> result = validator.validate(dataObjectPath,
                                                              updatedDataObject);
    assertEquals(1,
                 result.size());

    ValidationMessage message = result.iterator().next();
    assertTrue(message instanceof ScoreHolderGlobalTypeToBeChangedMessage);
}
 
开发者ID:kiegroup,项目名称:optaplanner-wb,代码行数:31,代码来源:PlanningSolutionScoreHolderSaveValidatorTest.java


示例19: planningSolution

import org.optaplanner.core.api.score.buildin.hardsoft.HardSoftScore; //导入依赖的package包/类
@Test
public void planningSolution() {
    Path dataObjectPath = PathFactory.newPath("Test.java",
                                              "file:///dataObjects");
    when(ioService.readAllString(Paths.convert(dataObjectPath))).thenReturn("testResult");

    DataObject originalDataObject = new DataObjectImpl("test",
                                                       "Test");
    originalDataObject.addAnnotation(new AnnotationImpl(DriverUtils.buildAnnotationDefinition(PlanningSolution.class)));

    GenerationResult generationResult = new GenerationResult();
    generationResult.setDataObject(originalDataObject);
    when(dataModelerService.loadDataObject(any(),
                                           anyString(),
                                           any())).thenReturn(generationResult);

    when(scoreHolderUtils.extractScoreTypeFqn(originalDataObject)).thenReturn(HardSoftScore.class.getName());
    when(scoreHolderUtils.getScoreHolderTypeFqn(HardSoftScore.class.getName())).thenReturn(HardSoftScoreHolder.class.getName());

    when(assetsUsageService.getAssetUsages(HardSoftScoreHolder.class.getName(),
                                           ResourceType.JAVA,
                                           dataObjectPath)).thenReturn(Arrays.asList(mock(Path.class)));

    DataObject updatedDataObject = new DataObjectImpl("test",
                                                      "Test");
    updatedDataObject.addAnnotation(new AnnotationImpl(DriverUtils.buildAnnotationDefinition(PlanningSolution.class)));

    Collection<ValidationMessage> result = validator.validate(dataObjectPath,
                                                              updatedDataObject);
    assertEquals(1,
                 result.size());

    ValidationMessage message = result.iterator().next();
    assertTrue(message instanceof ScoreHolderGlobalToBeRemovedMessage);
}
 
开发者ID:kiegroup,项目名称:optaplanner-wb,代码行数:36,代码来源:PlanningSolutionScoreHolderDeleteValidatorTest.java


示例20: computeScore

import org.optaplanner.core.api.score.buildin.hardsoft.HardSoftScore; //导入依赖的package包/类
/**
 * Use the state in the current best solution to recompute score of
 * provided migrations.
 *
 * This method creates a new solver with disabled construction heuristics
 * and local search.
 *
 * @param oldResult
 * @return HardSoftScore of the migrations
 */
public HardSoftScore computeScore(Result oldResult) {
    OptimalDistributionStepsSolution sourceSolution = null;

    sourceSolution = bestSolution.get();

    return SolverUtils.computeScore(sourceSolution,
            oldResult,
            Collections.emptySet(),
            customDrlFiles);
}
 
开发者ID:oVirt,项目名称:ovirt-optimizer,代码行数:21,代码来源:ClusterOptimizer.java



注:本文中的org.optaplanner.core.api.score.buildin.hardsoft.HardSoftScore类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java LevelRangeFilter类代码示例发布时间:2022-05-22
下一篇:
Java ProjectManagerAdapter类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap