0

我想在两个计划实体之间同步计划值。在这种情况下,我想让两个SubjecTeacherPeriod选择周期彼此“重合”,即使它们可能的值范围是不相交的。

STP s1: period-N/A periodList->[1,2,3,4,5,6]
STP s2: period-N/A periodList->[106,107,108,109,110,111]
SyncConstraint(leftSTP = s1,rightSTP = s2)
<A rule for SyncConstraint that checks if s1.period and s2.period are compatible>

例如Periods1106是兼容的,因为它们都是“星期一的第一个小时”。对于2和 也是如此107

s2我确实设置了在之后分配的计划实体难度s1(我看到了日志)。但是它们被分配了不兼容的值。并且系统永远不会在求解器操作结束时从此类错误中恢复。

我怎样才能让它们同步?


在我提到“兼容”和“重合”的地方,我的意思是Periods 有两个字段(星期几和星期顺序)相等。每个类(以及该类SubjectTeacherPeriod中每个可能的句点)都有单独Period的 s。

4

1 回答 1

0

在 classPeriod上,创建一个 getter getPeriodType()(例如,它返回“星期一的第一个小时”),然后添加一个分数规则,如下所示:

when
    MyEntity($leftType: period.periodType, $leftId : id, ...)
    MyEntity(period.periodType != $leftType, id < $leftId, ...)

或者,如果 aPeriod可以有多种类型,则不要创建该 getter,而是创建一个关系类PeriodToPeriodTypeLink

when
    MyEntity($leftP : period, $leftId : id, ...)
    MyEntity($rightP : period, id != $leftId, ...)
    PeriodToPeriodTypeLink(period == $leftP, $t : type)
    not PeriodToPeriodTypeLink(period == $rightP, type == $t)
于 2012-04-03T10:01:00.330 回答