gpt4 book ai didi

java - OptaPlanner 计划实体,即使没有可用的移动

转载 作者:行者123 更新时间:2023-11-30 06:50:54 24 4
gpt4 key购买 nike

我正在尝试使用 MoveSelectionFilter 将某些计划实体实例排除在计划之外。

但是,即使我拒绝所有移动,根据调试输出,实例仍然在构造启发阶段得到最初规划。我使用的是 WEAKEST_FIT 启发式,两个自定义 MoveListFactory(目前根本不生成任何移动)并且没有默认的 MoveListFactory。

如何阻止 OptaPlanner 规划这些实体?我已经查看了护士排类示例,如果您提前日期但无法重现该行为,它正是我想做的。

编辑:肯定正在应用过滤器。我检查了 MoveList 的大小,它们都是空的。

我的过滤器如下所示:

public boolean accept(PatientAdmissionSchedule patientAdmissionSchedule, BedDesignation bedDesignation) {
return false;
}

应用方式如下:

if (filter.accept(patientAdmissionSchedule, bedDesignation)) {
for (Bed bed : bedList) {
moveList.add(new BedChangeMove(bedDesignation, bed));
}
}

for (ListIterator<BedDesignation> it = bedDesignationList.listIterator(); it.hasNext();) {
BedDesignation bedDesignation = it.next();
if (!filter.accept(patientAdmissionSchedule, bedDesignation)) {
it.remove();
}
}

在调试中,我有以下几行

2017-03-14 19:40:59,305 [SwingWorker-pool-4-thread-1] DEBUG     CH step (31), time spent (173), score (0hard/0medium/0soft), selected move count (7), picked move (Patient6(Night(7),null) {null -> 15(0)}).
2017-03-14 19:40:59,306 [SwingWorker-pool-4-thread-1] INFO Construction Heuristic phase (0) ended: step total (32), time spent (174), best score (0hard/0medium/0soft).
2017-03-14 19:40:59,313 [SwingWorker-pool-4-thread-1] WARN No doable selected move at step index (0), time spent (181). Terminating phase early.

我认为这进一步表明没有可供选择的 Action 。

规划实体本质上与患者入院安排示例中的实体相同:

@PlanningEntity(difficultyWeightFactoryClass = BedDesignationDifficultyWeightFactory.class)
@XStreamAlias("BedDesignation")
public class BedDesignation extends AbstractPersistable {

private Admission admission;
private Bed bed;
private Night night;

@PlanningVariable(nullable = true, valueRangeProviderRefs = {"bedRange"},
strengthComparatorClass = BedStrengthComparator.class)
public Bed getBed() {
return bed;
}

我还尝试仅使用一个 MoveListFactory,它返回一个空的 MoveList。但还是有这样的举动

2017-03-14 19:40:59,305 [SwingWorker-pool-4-thread-1] DEBUG     CH step (31), time spent (173), score (0hard/0medium/0soft), selected move count (7), picked move (Patient6(Night(7),null) {null -> 15(0)})

在构造启发阶段被挑选。

最佳答案

您缺少 @PlanningEntity 中的 movableEntitySelectionFilter 属性

@PlanningEntity(movableEntitySelectionFilter = MovableLectureSelectionFilter.class, ...)
public class Lecture ...

关于java - OptaPlanner 计划实体,即使没有可用的移动,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42793848/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com