0

我在土耳其的阿塔图尔克大学使用 Optaplanner 开发了一个自动时间表软件。Optalanner 已满足所有要求。但除此之外还有一些要求。其中之一:->当我想把课程放在时间表上时,我怎么能把它安排在两个连续的时间里。并且不应该是连续三个时期的讲座。例如三个小时考虑数学课:

                      IN MONDAY
      -----------------------------------------------

      0.P     Math              Math           Math

      1.P     Math              Math           Another

      2.P     Another           Math           Another

      3.P     Another           Another        Math

      4.P     Math              Another        Another
         (or another day)
      5.P     Another           Another        Another

      6.P     Another           Another        Math
              -----             -----          ----- 
             CORRECT            WRONG          WRONG

我想让我的时间表看起来像第一列,我需要防止其他情况。

4

1 回答 1

0

像这样的东西应该工作:

rule "twoInARowIsgood"
when
    CourseSequentialRequirement($c : course)
    Lecture (course == $c, $firstP : period)
    Lecture (course == $c, period.isImmediatlyAfter($firstP))
then
    scoreHolder.add...(kcontext, 100); // Positive constraint
end

rule "threeInARowIsBad"
when
    CourseSequentialRequirement($c : course)
    Lecture (course == $c, $firstP : period)
    Lecture (course == $c, period.isImmediatlyAfter($firstP), $secondP : period)
    Lecture (course == $c, period.isImmediatlyAfter($secondP))
then
    scoreHolder.add...(kcontext, -500); // Negative constraint and higher than twice the positive one
end
于 2014-11-26T07:48:29.973 回答