<!DOCTYPE article PUBLIC "-//NLM//DTD JATS (Z39.96) Journal Archiving and Interchange DTD v1.0 20120330//EN" "JATS-archivearticle1.dtd">
<article xmlns:xlink="http://www.w3.org/1999/xlink">
  <front>
    <journal-meta>
      <journal-title-group>
        <journal-title>Corresponding author.
$ otunuya@uni-potsdam.de (H. Otunuya)</journal-title>
      </journal-title-group>
    </journal-meta>
    <article-meta>
      <title-group>
        <article-title>Reasoning about Study Regulations in Answer Set Programming (Preliminary Report)</article-title>
      </title-group>
      <contrib-group>
        <contrib contrib-type="author">
          <string-name>Susana Hahn</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
          <xref ref-type="aff" rid="aff1">1</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Cedric Martens</string-name>
          <xref ref-type="aff" rid="aff1">1</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Amadé Nemes</string-name>
          <xref ref-type="aff" rid="aff1">1</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Henry Otunuya</string-name>
          <xref ref-type="aff" rid="aff1">1</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Javier Romero</string-name>
          <xref ref-type="aff" rid="aff1">1</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Torsten Schaub</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
          <xref ref-type="aff" rid="aff1">1</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Sebastian Schellhorn</string-name>
          <xref ref-type="aff" rid="aff1">1</xref>
        </contrib>
        <aff id="aff0">
          <label>0</label>
          <institution>Potassco Solutions</institution>
          ,
          <country country="DE">Germany</country>
        </aff>
        <aff id="aff1">
          <label>1</label>
          <institution>University of Potsdam</institution>
          ,
          <country country="DE">Germany</country>
        </aff>
      </contrib-group>
      <pub-date>
        <year>2023</year>
      </pub-date>
      <volume>000</volume>
      <fpage>0</fpage>
      <lpage>0002</lpage>
      <abstract>
        <p>We are interested in automatizing reasoning with and about study regulations, catering to various stakeholders, ranging from administrators, over faculty, to students at diferent stages. Our work builds on an extensive analysis of various study programs at the University of Potsdam. The conceptualization of the underlying principles provides us with a formal account of study regulations. In particular, the formalization reveals the properties of admissible study plans. With these at end, we propose an encoding of study regulations in Answer Set Programming that produces corresponding study plans. Finally, we show how this approach can be extended to a generic user interface for exploring study plans.</p>
      </abstract>
      <kwd-group>
        <kwd>eol&gt;Answer Set Programming</kwd>
        <kwd>Study regulations and plans</kwd>
      </kwd-group>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>1. Introduction</title>
      <sec id="sec-1-1">
        <title>Study regulations govern our teaching at universities. by specifying requirements to be met by</title>
        <p>students to earn a degree. This involves diferent stakeholders: faculty members designing study
programs, administrative and legal staf warranting criteria, like studyability, faculty members
teaching the corresponding programs as well as supervising their execution on examination
boards, study advisors consulting students, and of course, students studying accordingly.</p>
      </sec>
      <sec id="sec-1-2">
        <title>Given this impressive spectrum of use-cases, it is quite remarkable that study regulations</title>
        <p>are usually rather sparse and leave many aspects to the commonsense of the respective users.</p>
      </sec>
      <sec id="sec-1-3">
        <title>This is needed to cope with their inherent incomplete, inconsistent, and evolving nature. For</title>
        <p>instance, often study regulations leave open minor dependencies among modules. Sometimes
associated courses overlap and certain modules cannot be taken in the same semester. And
ifnally, studying happens over time, students’ perspectives may change and faculty may rotate.</p>
      </sec>
      <sec id="sec-1-4">
        <title>Often these phenomena are compensated by changes, preferences, recommendations, defaults, etc. In fact, this richness in issues and notions from Knowledge Representation and Reasoning</title>
        <p>(KRR) makes study regulations a prime candidate for a comprehensive benchmark for KRR
formalisms.</p>
      </sec>
      <sec id="sec-1-5">
        <title>This work is part of a project conducted at the University of Potsdam to assist diferent users</title>
        <p>by automatizing study regulations. These users range from study administrators, over faculty
in diferent functions, to prospective and advanced students. We started by analyzing more
than a dozen diferent study regulations in order to identify their underlying principles. The
conceptualization of the basic principles led us to a formal account of basic study regulations,
presented in Section 2. For illustration, we provide the formalization of the master program
Cognitive Systems. Further, more specialized concepts in other study regulations are presented
in Section 3. The formalization of study regulations reveals the properties of admissible study
plans. To automatize reasoning about study regulations and their study plans, we capture their
properties in Answer Set Programming (ASP; [1]), a declarative problem solving paradigm,
tailored for knowledge representation and reasoning. The ASP-based encoding of basic study
regulations is discussed in Section 4. Moreover, we show in Section 5 how this encoding can be
used together with an ASP-driven user interface to browse through study plans of given study
regulations. We conclude in Section 7.</p>
      </sec>
    </sec>
    <sec id="sec-2">
      <title>2. Conceptualizing study regulations</title>
      <sec id="sec-2-1">
        <title>The basic concept of our study regulations are modules. Accordingly, a semester is composed</title>
        <p>of a set of modules and a study plan is a finite sequence of semesters. More formally, given
a set  of modules, a study plan of  semesters is a sequence ()=1 where  ⊆  for</p>
        <sec id="sec-2-1-1">
          <title>1 ≤  ≤ . Study regulations specify legal study plans. To capture this, we propose an abstract</title>
          <p>characterization of study regulations and show how they induce legal study plans.</p>
          <p>A basic study regulation is a tuple (, , , , , , , ), where
1.  is a set of modules,
2.  ⊆ 2 distinguishes certain groups of modules,</p>
        </sec>
        <sec id="sec-2-1-2">
          <title>3.  :  → N gives the credits of each module,</title>
          <p>4.  :  → {, , } assigns a regular semester to a module,</p>
        </sec>
        <sec id="sec-2-1-3">
          <title>5.  :  → N returns the lower-bound of the credits of a module group,</title>
        </sec>
        <sec id="sec-2-1-4">
          <title>6.  :  → N returns the upper-bound of the credits of a module group,</title>
          <p>7.  ⊆ 2(2 ) is a set of global constraints expressing study regulations, and
8.  ⊆ 2(2 ) is a set of temporal constraints expressing study regulations.
The module groups in  allow us to structure the modules and to express group-wise regulations.
Functions  and  give the credit points of a module and its turnus,1 viz. in winter, summer, or
each semester (indicated by w, s, e), respectively. The elements  and  are partial functions
delineating the number of credits obtained per module group; a specific number of credits is
captured by an equal lower and upper bound. The regulation constraints in  and  are
represented extensionally: each constraint  in  ∪  is represented by the sequences of sets
of modules  ⊆ (2 ) satisfying it. While the sets of constraints  and  share the same</p>
        </sec>
      </sec>
      <sec id="sec-2-2">
        <title>1Winter and summer semesters are associated with odd and even positions in a sequence, respectively (see below).</title>
        <p>mathematical structure, they difer in purpose and are therefore separated for clarity’s sake. 
expresses temporal constraints over the sequence of semesters, while  does not make use of
this sequential structure, and rather expresses global constraints over the entire set of modules.</p>
      </sec>
      <sec id="sec-2-3">
        <title>A study plan for a basic study regulation is a finite sequence of sets of modules satisfying</title>
        <p>all regulation constraints. More precisely, a sequence ()=1 of modules of length  such that
 ⊆  for 1 ≤  ≤  is a study plan for (, , , , , , , ) if ()=1 ∈ ⋂︀∈∪ .</p>
      </sec>
      <sec id="sec-2-4">
        <title>Finally, we call modules exogenous if they are imposed by external means, eg. by an examination board. The specific choice of these modules is determined case by case.</title>
        <p>Example 1 (Cognitive systems). As an example, consider the study regulations of the master
program Cognitive Systems ofered at the University of Potsdam. 2 This program ofers a
combination of modules in Natural language processing, Machine learning, and Knowledge representation
and reasoning.</p>
        <p>
          These subjects are reflected by the three mandatory base modules, joined in  in (
          <xref ref-type="bibr" rid="ref3">3</xref>
          ). Since each
module yields 9 credits, their obligation is achieved by requiring that the modules stemming from 
must account for 27 credits.3 While the amount is specified in (12) and (13), the actual constraint is
imposed in (15). The same constraint is used for choosing two among three possible project modules
from  . The optional modules in group  are handled similarly, just that only 24 credits from 36
possible credits are admissible. That is, four out of nine modules must be taken. The freedom of
which four the student may choose is restricted by the examination board by imposing the study of
up to two foundational modules  ⊆  , which must be the only modules taken from module group
 , as formalized in constraint (14). The total number of credits over all modules must equal 120.
        </p>
        <p>Finally, an internship, im, and a thesis, msc, are imposed in (16). This brings us to the temporal
regulation in (20) requiring that at least 90 credits are accumulated before conducting a thesis.
The temporal regulations in (18) and (19) ensure that modules are taken in the right season. And
ifnally (17) makes sure that modules are chosen at most once.</p>
        <p>Let  ⊆  be some exogenous set of modules in the following example; and let  stand for
⋃︀</p>
        <p>=1 , and  = { ∈  | () = } and  = { ∈  | () = }. Then, the study
regulations of the master program Cognitive Systems with respect to  can be formalized as
follows.</p>
        <p>
          =  ∪  ∪  ∪  ∪ {im, msc}
 = {, , , , ,  }
 = {bm |  = 1..3}
 = {fm |  = 1..3}
 = {am, |  = 1..3,  = 1, 2}
 =  ∪ 
 = {pm |  = 1..3}
 = {bm ↦→ 9 |  = 1..3} ∪ {am, ↦→ 6 |  = 1..3,  = 1, 2} ∪
(
          <xref ref-type="bibr" rid="ref1">1</xref>
          )
(
          <xref ref-type="bibr" rid="ref2">2</xref>
          )
(
          <xref ref-type="bibr" rid="ref3">3</xref>
          )
(
          <xref ref-type="bibr" rid="ref4">4</xref>
          )
(
          <xref ref-type="bibr" rid="ref5">5</xref>
          )
(
          <xref ref-type="bibr" rid="ref6">6</xref>
          )
(
          <xref ref-type="bibr" rid="ref7">7</xref>
          )
(8)
2Available at https://www.uni-potsdam.de/fileadmin/projects/studium/docs/03_studium_
konkret/07_rechtsgrundlagen/studienordnungen/StO_CogSys_EN.pdf
3This is not our way of modeling mandatory courses but rather reflects the actual regulation.
        </p>
        <p>{fm ↦→ 6 |  = 1..3} ∪ {pm ↦→ 12 |  = 1..3} ∪ {im ↦→ 15, msc ↦→ 30}
 = {bm1 ↦→ , bm2 ↦→ , bm3 ↦→ } ∪ {am, ↦→  |  = 1..3,  = 1, 2} ∪
{fm ↦→  |  = 1..3} ∪ {pm ↦→  |  = 1..3} ∪ {im ↦→ , msc ↦→ }
 = { ↦→ 27,  ↦→ 24,  ↦→ 24,  ↦→ 120}
 = { ↦→ 27,  ↦→ 24,  ↦→ 24,  ↦→ 120}
 = { {()=1 ⊆   | || ≤ 2,  ∩  = }, (14)
{()=1 ⊆   | () ≤ ∑︀∈∩ () ≤ ()} for all  ∈ {, , ,  }, (15)
{()=1 ⊆   | {im, msc} ⊆ } } (16)
 = { {()=1 ⊆   |  ∩  = ∅, 1 ≤  &lt;  ≤ } (17)
{()=1 ⊆   |  ∩ 2 = ∅, 1 ≤ 2 ≤ ,  ∈ N} (18)
{()=1 ⊆   |  ∩ 2− 1 = ∅, 1 ≤ 2 − 1 ≤ ,  ∈ N} (19)
{()=1 ⊆   | msc ∈  implies ∑︀1≤ &lt; ∑︀∈ () ≥ 90,  ∈ N} } (20)
If the set of exogenous modules given by the examination board is, for example,  = {fm1}, one
admissible study plan spanning four semesters is  = ()4=1, where
This plan comprises 120 credits, although the load per semester varies.</p>
        <p>For illustration, let us verify that our study plan belongs to the ones in (14) and (15) for  = .
Indeed constraint (14) is satisfied as we have  ∩  = {fm1} = , and thus  is an element of
constraint (14). With regards to (15), we have</p>
        <p>∩  = {fm1, am1,2, am2,1, am3,1}
which makes us check whether our study plan satisfies</p>
        <p>() = 24 ≤ ∑︀∈{fm1,am1,2,am2,1,am3,1} () ≤ 24 = ()
This is indeed the case since (fm1) + (am1,2) + (am2,1) + (am3,1) = 24. Hence, our study
plan is an element of constraint (15).</p>
      </sec>
      <sec id="sec-2-5">
        <title>Although the above specification reflects the legal study regulation, it leaves lots of ambiguities</title>
        <p>behind. For instance, the number of credits per semester is left open, as is the order of the
modules. The guideline is usually to take around 30 credits per semesters but this is not enforced.
Similarly, basic modules in  should be taken before advances ones in , again this is neither
enforced nor always possible. Since these constraints are usually soft, they are left to the
students and/or their study advisors.</p>
      </sec>
    </sec>
    <sec id="sec-3">
      <title>3. Refinements</title>
      <p>3.1. Specialization</p>
      <sec id="sec-3-1">
        <title>This section presents some concepts of interest that go beyond basic study regulations.</title>
      </sec>
      <sec id="sec-3-2">
        <title>Some study regulations allow for specializations. This provides students the opportunity to</title>
        <p>specialize in some area within their field of study. For example, in a biology program, one may
specialize in ecology, genetics, or zoology. Each focus may contain diferent groups of modules.</p>
      </sec>
      <sec id="sec-3-3">
        <title>To govern such specializations, which we refer to as focuses, we augment our formalization</title>
        <p>of study regulations by the following concepts:
•  ⊆ 22 is a set of focuses, and
• () and () are sets of global and temporal constraints parametrized by some
focus  ∈  .</p>
      </sec>
      <sec id="sec-3-4">
        <title>The parametrized constraints allow for formalizing focus-specific regulations. For instance, a</title>
        <p>constraint on the credit points for a given focus  ∈  can be formalized as follows.
{()=1 ⊆   | for all  ∈  : ( ) ≤

∑︀∈( ∩) () ≤ ( )}
3.2. Modules dependency</p>
      </sec>
      <sec id="sec-3-5">
        <title>Some module descriptions have a prerequisite section which details what modules or com</title>
        <p>petences are required or recommended before participating in that particular module. These
prerequisites are represented as hard or soft constraints, respectively. For example, the module
“Introduction to Computer Science” may be required before “Data Structures”. For capturing this
concept in terms of hard constraints between modules, we extend our formalization as follows:
•  ⊆  ×  relates pairs of dependent modules.</p>
        <p>For each (1, 2) ∈  (read as 2 depends on 1), if 1 and 2 are in a study plan, the
semester of 1 must be before that of 2.</p>
      </sec>
      <sec id="sec-3-6">
        <title>We formalize the constraint as:</title>
        <p>{()=1 ⊆   | for all (1, 2) ∈  : 2 ∈  implies 1 ∈  ,  &lt; }

3.3. Blocking modules</p>
      </sec>
      <sec id="sec-3-7">
        <title>Another concept are blocking modules. A study regulation may define a set of elective modules</title>
        <p>that block each other. For example, either version A or B of a module can be chosen, i.e. selecting
the module version A blocks the choice of module version B and vice versa. For capturing this
concept, we extend our formalization by the following:</p>
        <p>•  ⊆  ×  relates pairs of modules blocking each other.</p>
        <sec id="sec-3-7-1">
          <title>For each pair of modules (1, 2) ∈ , either module 1 or 2 can be part of a valid study</title>
          <p>plan but not both. We formalize the corresponding constraint by:
{()=1 ⊆   | for all (1, 2) ∈  : |{1, 2} ∩ | ≤ 1}

3.4. Examination</p>
        </sec>
      </sec>
      <sec id="sec-3-8">
        <title>In order to address achievements and completion of a module, we depend on examinations.</title>
      </sec>
      <sec id="sec-3-9">
        <title>Examinations are bound to a module and each has an unique identifier. We distinguish between</title>
        <p>primary examinations (e.g. passing oral exams) and secondary examinations (e.g. passing 50% of
exercises). Formally:
• () contains sets of possible combinations of primary examinations needed to
accomplish module  ∈  , and
• () contains secondary examinations needed to accomplish module  ∈  .
Let ()=1 be a sequence of examinations of length  such that
 ⊆
⋃︀ ∈
∈()</p>
        <p>∪ ⋃︀∈ () for 1 ≤  ≤ .</p>
        <p>Each  is a set of examinations achieved at semester .</p>
      </sec>
      <sec id="sec-3-10">
        <title>Finishing a secondary examination is a requirement of a module to either be allowed to</title>
        <p>apply for a primary examination of the same module or to complete the module itself. Once a
secondary examination is accomplished it persists. Finishing some primary examination is a
requirement of a module to get completed. A module is accomplished as soon as all required
examinations are satisfied.</p>
        <sec id="sec-3-10-1">
          <title>For capturing the dependency among examinations of a given module  ∈  , we extend</title>
          <p>our formalization by the following:</p>
          <p>• () ⊆ () × () relates pairs of dependent examinations.</p>
          <p>We formalize dependencies among examinations and completion of a module, respectively, by:
{()=1 ⊆   | for each  ∈  and each (, ) ∈ () :

 ⊆
⋃︀
=  implies ⋃︀(′,)∈(){′} ⊆
⋃︀
=1  , 1 ≤  ≤ }
{()=1 ⊆   | for each  ∈  there exists an  ∈ () : () ∪  ⊆

⋃︀
=1  }</p>
          <p>The formalization of the following refinements is left to the future and needed to link
examinations to courses. A module defines at least one eligible teaching format for each
secondary examination, e.g. exercise, lecture, seminar, tutorial, project, internship, colloquia,
etc. In practice, one or more examinations of at least one module is linked to a course with a
corresponding teaching format. Each student has three attempts to pass primary examination
of a module. If all three attempts are failed, the module cannot be completed.</p>
        </sec>
      </sec>
    </sec>
    <sec id="sec-4">
      <title>4. Encoding study regulations</title>
      <sec id="sec-4-1">
        <title>This section presents an ASP approach to represent study regulations and generate valid study</title>
        <p>plans. As usual, this is divided into two parts: a specific instance and a general encoding.</p>
      </sec>
      <sec id="sec-4-2">
        <title>An instance represents the elements of a specific study regulation by a set of facts, while the encoding provides the semantics associated with study regulations. Given an instance that represents one study regulation, the answer sets of the encoding together with the instance correspond to the study plans for that study regulation.</title>
      </sec>
      <sec id="sec-4-3">
        <title>We try to keep the notation as close as possible to the formalization of Section 2. The program</title>
        <p>uses the same symbols as before for sets and functions, but always in lowercase, to adapt to the
conventions of ASP. For example, the sets ,  and  are denoted by the terms s, s(i) and
m(w), respectively. In what follows, we often use the logic programming notation to refer to
those sets and functions.</p>
        <p>Listing 1 shows the first part of the instance cogsys.lp for the Cognitive Systems
master, that specifies the sets and functions of the study plan. Sets are defined using atoms of
the form in(e,a) that represent that the element e belongs to the set a. For example, the
atom in(bm1,b) expresses that bm1 ∈ b. Functions are defined similarly, using atoms of the
form map(f,e,v) that represent that the value of the function f applied to the element e
is v. For example, map(c,bm1,9) expresses that c(bm1) = 9. To define the facts more
compactly, we make extensive use of pooling using the operator ‘;’. For example, the three facts
in(bm1,b)., in(bm2,b)., and in(bm3,b). defining the set b are captured by the single
rule in((bm1;bm2;bm3),b). in Line 2.
1 % b, f, a, o and p
2 in (( bm1 ; bm2 ; bm3 ) ,b ).
3 in (( fm1 ; fm2 ; fm3 ) ,f ).
4 in (( am11 ; am12 ; am21 ) ,a ).
5 in (( am22 ; am31 ; am32 ) ,a ).
6 in ( E,o ) :- in ( E, ( f ; a )).
7 in (( pm1 ; pm2 ; pm3 ) ,p ).
8
10 % m
11 in ( E,m ) :- in ( E, ( b ; f ; a ; p )).
12 in (( im ; msc ) ,m ).
13
14
15 % e
16 in ( fm1,e ).</p>
        <p>The definitions of the constraints in (14)-(20) provide the conditions that every study plan
()=1 ⊆   must satisfy. These conditions usually refer to operations over sets, that we
represent in ASP using prefix notation. For example, the condition of (14) refers to the
intersection of the sets  and  , that is denoted in the logic program by the term int(s,f). Other
terms can be used to denote the union, substraction and complement of sets. The regulation
constraints could in principle be very diverse, but in our investigation of various study
regulations we have found that they can be captured by a few types of general constraints, that we
represent in ASP by diferent predicates. The general encoding gives their semantics, while
the specific instance of each study regulation provides facts over those predicates to represent
the corresponding constraints. Listing 2 shows the second part of our example instance, that
specifies the constraints of the Cognitive Systems master. It uses atoms of the following form,
with the associated meaning (where A and B denote sets, F denotes a function, and L and U are
integers):
• empty(A) means that A = ∅,
• equal(A,B) means that A = B,
• subseteq(A,B) means that A ⊆ B,
• card(A,leq,U) means that |A| ≤ U,
• sum(A,F,bw,(L,U)) means that L≤ ∑︀∈AF() ≤ U, and
• sum(A,F,geq,L) means that L≤ ∑︀∈AF().</p>
        <p>The general encoding includes more predicates to represent other relations among sets, like
proper subset or superset, and it also allows other types of comparisons within atoms of the
predicates card/3 and sum/4. Using these predicates, the global constraints (14)-(16) are
captured in Lines 23-25. The first constraint consists of two conditions, and this is accordingly
represented by two facts. Line 24 uses pooling to refer to all the sets in {b, o, p, m}, and atoms
over map/3 to capture the values L and U of the functions l and u applied to those sets. The
last rule of the block defines a new set gc3 that consists of im and msc, and compares it via
subseteq with s. Temporal constraints are represented in Lines 28 to 31. The first three use
atoms of the predicate empty/1 that refer to m(w), m(s), and the specific sets of modules s(i)
of each semester i. The last one defines the set tc4 that consists of msc, applies to it a new kind
of temporal operator called before, and uses the resulting term in an atom of predicate sum/4.</p>
      </sec>
      <sec id="sec-4-4">
        <title>The term before(tc4) denotes the set of modules that occur in the study plan before some</title>
        <p>element of tc4; in this case, before the module msc. Using our previous mathematical notation,
the set before(tc4) is { ∈  |  ∈  and there is some ′ ∈ tc4 ∩  such that  &lt; }.</p>
        <p>The general encoding includes other similar operators like after or between.
22 % global constraints
23 card ( e,leq,2 ). equal ( int ( s,f ) ,e ).
24 sum ( int ( H,s ) ,c,bw, ( L,U )) :- H = ( b ; o ; p ; m ) , map ( l,H,L ) , map ( u,H,U ).
25 in ( im,gc3 ). in ( msc,gc3 ). subseteq ( gc3,s ).
27 % temporal constraints
28 empty ( int ( s ( I ) ,s ( J ))) :- I = 1.. n, J = 1.. n, I &lt; J .
29 empty ( int ( m ( w ) ,s (2* K ))) :- K = 1.. n, 1 &lt;= 2* K, 2* K &lt;= n .
30 empty ( int ( m ( s ) ,s (2* K -1))) :- K = 1.. n, 1 &lt;= 2* K -1 , 2* K -1 &lt;= n .
31 in ( msc,tc4 ). sum ( before ( tc4 ) ,c,geq,90 ).</p>
      </sec>
      <sec id="sec-4-5">
        <title>Listing 2: Second part of the instance of the Cognitive Systems master in cogsys.lp.</title>
        <p>
          Listing 3 shows the general encoding in encoding.lp. It takes as input the constant n that
gives the length of the study plan. This constant is used by the choice rule in Line 2 to generate
the possible study plans, represented by the sets s(i) for i between 1 and n. Then, Line 5 defines
the set s as the union of all s(i)’s, and Line 8 defines the sets m(w) and m(s). After this, Lines
1120 handle the additional sets that may occur in the constraints. The first block of rules identifies
the sets that occur as arguments in the constraints. Then, the rules in Lines 16 and 17 recursively
look for the sets occurring inside the operators int and before. The encoding contains other
similar rules for the other operators, but we do not show them here. Once all the new sets have
been identified, additional rules provide their definition. Line 19 defines the intersection of two
sets, and Line 20 defines the modules occurring before some module of another set. The complete
encoding includes further rules for the other operators. The next part of the encoding, in Lines
2333, enforces the constraints. The first ones about empty/1, subseteq/2 and equal/2, use the
predicate in/2 to eliminate the cases that are not consistent with the constraints, while those
about card/3 and sum/4 rely on cardinality and aggregate atoms for that task. For example, the
condition |A| ≤ U for card(A,leq,U) is captured by the cardinality atom { in(E,A) } U,
and the condition L≤ ∑︀∈AF() ≤ U for sum(A,F,bw,(L,U)) is captured by the aggregate
atom L #sum{ V,E : in(E,A), map(F,E,V) } U. Finally, the last block of statements in
Lines 36 and 37 displays the sets s(i).
1 % generate
2 { in ( E,s ( I )) } :- in ( E,m ) , I =1.. n .
4 % s = s (
          <xref ref-type="bibr" rid="ref1">1</xref>
          ) U ... U s ( n )
5 in ( E,s ) :- in ( E,s ( I )).
7 % m ( w ) and m ( s )
8 in ( E,m ( X )) :- X = ( s ; w ) , in ( E,m ) , map ( s,E,X ).
10 % additional sets
11 set ( A ) :- empty ( A ).
12 set ( A ) :- subseteq ( A,B ). set ( A ) :- equal ( A,B ).
13 set ( B ) :- subseteq ( A,B ). set ( B ) :- equal ( A,B ).
14 set ( A ) :- card ( A,R,L ). set ( A ) :- sum ( A,M,R,L ).
15 %
16 set ( A ) :- set ( int ( A,B )). set ( B ) :- set ( int ( A,B )).
17 set ( A ) :- set ( before ( A )).
18 %
19 in ( E, int ( A,B )) :- set ( int ( A,B )) , in ( E,A ) , in ( E,B ).
20 in ( E1,before ( A )) :- set ( before ( A )) , in ( E1,s ( I )) , in ( E2,A ) , in ( E2,s ( J )) , I &lt; J .
        </p>
      </sec>
      <sec id="sec-4-6">
        <title>Listing 3: Meta-encoding for all study regulations in encoding.lp.</title>
        <p>We can now run the ASP solver clingo with the instance for the Cognitive Systems master
and the general encoding. For n=4 we obtain, among others, an answer set that corresponds to
the admissible study plan  of Example 1:
clingo -c n=4 cogsys.lp encoding.lp
...</p>
        <p>Answer: 1
(bm1,1) (bm3,1) (fm1,1) (am12,1) (bm2,2) (am21,2) (pm1,2)
(im,3) (am31,3) (pm3,3) (msc,4)</p>
      </sec>
    </sec>
    <sec id="sec-5">
      <title>5. ASP-driven user interface</title>
      <sec id="sec-5-1">
        <title>In this section, we present our interactive prototype User Interface (UI) for creating study plans</title>
        <p>in accordance with study regulations. The UI allows users to add or remove modules within a
semester and iterate through diferent study plan configurations based on the selected modules.</p>
      </sec>
      <sec id="sec-5-2">
        <title>As the user makes module selections, the system automatically displays the consequences of those choices and limits the available options accordingly.</title>
        <p>This prototype was built using the system clinguin 4 that defines the UI by a logic program
that interacts continuously with clingo. Clinguin employs a Client-Server architecture, where
communication occurs via an HTTP protocol using JSON. In essence, the server is responsible
for executing clingo and computing the information required to define the UI, namely a
uistate. This process occurs in two distinct steps. Firstly, the domain-state is computed using the
domain-specific encodings (domain files) described in Section 4. This domain-state is made out
of facts that diferentiate between user-selected atoms, potential selections, and inferred atoms.</p>
      </sec>
      <sec id="sec-5-3">
        <title>In the second step, the server utilizes an encoding to generate atoms that define the layout,</title>
        <p>style, and functionality of the interface, collectively referred to as the ui-state.</p>
      </sec>
      <sec id="sec-5-4">
        <title>The workflow of our study regulations UI is shown in Figure 2 and can be summarized as</title>
        <p>follows. The server is started by providing the domain files cogsys.lp and encoding.lp, as
well as the UI file ui.lp (Listing 4) as command-line arguments:</p>
        <p>clinguin server --domain-files cogsys.lp encoding.lp --ui-files ui.lp -c n=4
When the client is launched, it requests the ui-state from the server. Upon receiving the ui-state
the client utilizes tkinter 5 to render the corresponding UI. Subsequent user interactions with
the UI generate new requests to the server, providing information about the selected policy.</p>
      </sec>
      <sec id="sec-5-5">
        <title>The available policies are defined by the server, for instance, adding a user selection or getting</title>
        <p>the next solution. Once the server has completed the policy, it returns the updated ui-state to
the client to be rendered.</p>
        <p>The detailed workflow of the server is as follows: it begins by creating a clingo control object
using the given domain files ( cogsys.lp and encoding.lp) and grounding the program. It
then performs three diferent solve calls to find the brave consequences (atoms considered as
"possible"), cautious consequences (atoms considered as "required"), and the first model. These
outputs are combined to represent the domain-state, with the brave and cautious consequences
appearing in predicates _b and _c, respectively. To achieve interactivity and handle changes
4https://github.com/potassco/clinguin
5https://docs.python.org/3/library/tkinter.html
efectively, this control object utilizes multi-shot solving [ 2], which allows for the continuous
solving of logic programs that undergo frequent changes. In clingo, this capability is facilitated
through its API, enabling the implementation of reactive procedures involving grounding and
solving. In the context of interactivity, this allows us to represent the user’s selections as
assumptions which are interactively modified. These assumptions are passed to the solving
procedure without the need for re-grounding, and amount semantically to the addition of
integrity constraints. Each assumption A is represented in the domain-state through a fact
_clinguin_assume(A).</p>
        <p>Subsequently, a separate control object is employed to generate the ui-state. By using the
domain-state as input, the UI encoding (ui.lp) produces a single stable model that encompasses
the atoms of the ui-state. For this, predicates element/3, attribute/3 and callback/3 are
used to define the layout, style and functionality of the UI, respectively. An element X of type T
inside element X’ is defined by atom element(X,T,X’). The attributes of an element, such as
position and style, are specified by attribute(X,K,V), where K and V denote the name and
value of the attribute, respectively. The reactive part of the UI is defined by callback(X,A,P),
where performing action A on element X triggers the policy P on the server. These atoms are
mapped into Python classes using clorm6, a Python library that provides an Object Relational
Mapping (ORM) interface to clingo.</p>
      </sec>
      <sec id="sec-5-6">
        <title>In Figure 1, we present three UI snapshots of the study plan creation process. The window is</title>
        <p>
          created using the fact in Line 1 from Listing 4. For each semester I, Line 2 generates a container
for the semester column. Line 3 creates a container for the column header, header(I), which
serves as the parent for the label (Line 4) and dropdown menu (Line 5). The dropdown menu
items are defined in Lines 6 to 8. The body in these rules is activated if the atom in(E,s(I))
is part of the brave consequences, indicating that the module E could be added to semester I.
Furthermore, not _c(in(E,s(I))) ensures that the module has not been already added. This
behavior can be observed in the first image of Figure 1, where the dropdown menu for available
modules in the third semester does not include bm2 because in(bm2,s(
          <xref ref-type="bibr" rid="ref3">3</xref>
          )) is not part of the
brave consequences. Line 7 defines the label attribute for the element ddmi(E,I) generated
in Line 6. Line 8 adds a callback when the element is clicked, triggering the add_assumption
policy in the server. In the example interaction from Figure 1, when the user clicks on the
dropdown menu item im, the server adds in(im,s(
          <xref ref-type="bibr" rid="ref2">2</xref>
          )) as an assumption and generates the
domain-state. These facts are enriched with _clinguin_assume(in(im,s(
          <xref ref-type="bibr" rid="ref2">2</xref>
          ))) and are
used to generate the ui-state corresponding to the second image. In that image, we can see
that module im has been added to the third semester. Additionally, the msc module has been
automatically included for the fourth semester because in(msc,x(
          <xref ref-type="bibr" rid="ref4">4</xref>
          )) is now part of all stable
models. Line 9 creates the container to hold the modules assigned to each semester. Lines 10 and
11 define an auxiliary predicate to determine when a module should be displayed. The first line
is applicable when it is part of all stable models or selected by the user. The second line shows
the stable model only when the _clinguin_browsing atom is present in the domain-state.
This atom is added by the system when the user clicks the Next button from the menu bar,
triggering the transition from the second to the third image of Figure 1. This menu bar allows
users to browse through stable models, select the current model for further editing, and clear all
6https://github.com/potassco/clorm
selections 7. Line 12 generates the gray module container m(E,I) for each displayed module E.
Within this container, Line 13 adds the label, while Lines 14 and 15 include a remove button
exclusively for modules selected by the user.
1 element(window, window, root).
2 element(s(I), container, window):- I=1..n.
3 element(header(I), container, s(I)):- I=1..n.
4 element(slabel(I), label, header(I)):- I=1..n.
5 element(sdd(I), dropdown_menu, header(I)):- I=1..n.
6 element(ddmi(E,I), dropdown_menu_item, sdd(I)):- _b(in(E,s(I))), not _c(in(E,s(I))).
7 attribute(ddmi(E,I), label, E):- _b(in(E,s(I))), not _c(in(E,s(I))).
8 callback(ddmi(E,I), click, add_assumption(in(E,s(I)))):- _b(in(E,s(I))), not _c(in(E,s(I))).
9 element(sm(I), container, s(I)):- I=1..n.
10 display_m(in(E,s(I))):- _c(in(E,s(I))).
11 display_m(in(E,s(I))):- _clinguin_browsing, in(E,s(I)).
12 element(m(E,I), container, sm(I)):- display_m(in(E,s(I))).
13 element(mlabel(E,I), label, m(E,I)):- display_m(in(E,s(I))).
14 element(mbutton(E,I), button, m(E,I)):- _clinguin_assume(in(E,s(I))).
15 callback(mbutton(E,I), click, remove_assumption(in(E,s(I)))):- _clinguin_assume(in(E,s(I))).
        </p>
      </sec>
      <sec id="sec-5-7">
        <title>Listing 4: Selected lines from the UI encoding ui.lp.</title>
      </sec>
      <sec id="sec-5-8">
        <title>The complete code can be</title>
        <p>found in https://github.com/potassco/clinguin/tree/dev/examples/
clingo/study_regulations.</p>
      </sec>
    </sec>
    <sec id="sec-6">
      <title>6. Related work</title>
      <sec id="sec-6-1">
        <title>ASP, event calculus and process mining techniques were already used in [3] for solving study</title>
        <p>regulation problems. However, [3] presents an overview of the AIStudyBuddy project, and
contains neither a formalization of study regulations nor any implementation details. Unlike
this, [4] presents a web-based Decision Support System for a degree planning problem along</p>
      </sec>
      <sec id="sec-6-2">
        <title>7The menu bar can be automatically added to the UI by including the --include-menu-bar parameter in the</title>
        <p>server’s command-line.
domain-state</p>
        <p>domain-control
brave consequences
cautious consequences
model
clinguin assume/1
clinguin browsing</p>
        <p>ui-control
ui files
domain files
assumptions
externals</p>
        <p>∗(multi-shot)
ui-state
element/3
attribute/3
callback/3
s
e
i
c
i
l
o
p
JSON</p>
        <p>POST</p>
        <p>Get policy action</p>
        <p>USER
Render UI</p>
        <p>UI
with a mathematical formalization. Degree requirements are mentioned but not formalized.</p>
      </sec>
      <sec id="sec-6-3">
        <title>Also, [5] considers educational planning problems. This includes stress and learning efects on</title>
        <p>students in a personalized study plan generation. It aims at reducing the duration of student
plans and is implemented via integer linear programming. Finally, [6] present a data-driven
approach for implementing a course recommendation algorithm. A traditional collaborative
ifltering algorithm is extended to consider additional course path data.</p>
      </sec>
    </sec>
    <sec id="sec-7">
      <title>7. Summary</title>
      <sec id="sec-7-1">
        <title>We have introduced a conceptualization of study regulations based on set-based constraints.</title>
        <p>This formalization is both simple and general to capture a wide range of study regulations. We
indicated how the basic formulation easily extends to more complex constructions. This will be
further elaborated in future work. The identification of basic principles in study regulations
also allowed us to obtain a very general ASP encoding. The building blocks of each study
regulation are captured in terms of facts so that the actual encoding is also applicable to a
large range of study programs. Finally, we have described an ASP-driven user interface for
interactive elaboration of study plans. Again, the interface is designed in a generic way and
broadly applicable. Moreover, this case study serves as a nice illustration of clinguin and how it
can be used for interactive ASP applications.</p>
      </sec>
      <sec id="sec-7-2">
        <title>Finally, study regulations ofer a very rich playground for applications of knowledge repre</title>
        <p>sentation and reasoning techniques. Study plans have a light temporal flavor and resemble finite
traces in linear temporal logic [7]. The creation of a study plans amounts to a configuration
task, which also brings about interaction and explainability. Finally, we have so far only been
concerned with the hard constraints emerging from study regulations but there is so much
commonsense knowledge involved, like defaults, preferences, deontic laws, updates, etc.</p>
      </sec>
      <sec id="sec-7-3">
        <title>Acknowledgments. This work was partly funded by DFG grant SCHA 550/11 15 and BMBF</title>
        <p>project CAVAS+ (16DHBKI024).</p>
      </sec>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          [1]
          <string-name>
            <given-names>V.</given-names>
            <surname>Lifschitz</surname>
          </string-name>
          ,
          <article-title>Answer set programming and plan generation</article-title>
          ,
          <source>Artificial Intelligence</source>
          <volume>138</volume>
          (
          <year>2002</year>
          )
          <fpage>39</fpage>
          -
          <lpage>54</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          [2]
          <string-name>
            <given-names>R.</given-names>
            <surname>Kaminski</surname>
          </string-name>
          ,
          <string-name>
            <given-names>J.</given-names>
            <surname>Romero</surname>
          </string-name>
          ,
          <string-name>
            <given-names>T.</given-names>
            <surname>Schaub</surname>
          </string-name>
          ,
          <string-name>
            <given-names>P.</given-names>
            <surname>Wanko</surname>
          </string-name>
          ,
          <article-title>How to build your own asp-based system?!</article-title>
          ,
          <source>Theory and Practice of Logic Programming</source>
          <volume>23</volume>
          (
          <year>2023</year>
          )
          <fpage>299</fpage>
          -
          <lpage>361</lpage>
          . doi:
          <volume>10</volume>
          .1017/ S1471068421000508.
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          [3]
          <string-name>
            <given-names>M.</given-names>
            <surname>Wagner</surname>
          </string-name>
          ,
          <string-name>
            <given-names>H.</given-names>
            <surname>Helal</surname>
          </string-name>
          ,
          <string-name>
            <given-names>R.</given-names>
            <surname>Roepke</surname>
          </string-name>
          ,
          <string-name>
            <given-names>S.</given-names>
            <surname>Judel</surname>
          </string-name>
          ,
          <string-name>
            <given-names>J.</given-names>
            <surname>Doveren</surname>
          </string-name>
          ,
          <string-name>
            <given-names>S.</given-names>
            <surname>Goerzen</surname>
          </string-name>
          ,
          <string-name>
            <given-names>P.</given-names>
            <surname>Soudmand</surname>
          </string-name>
          , G. Lakemeyer,
          <string-name>
            <given-names>U.</given-names>
            <surname>Schroeder</surname>
          </string-name>
          , W. van der Aalst,
          <article-title>A combined approach of process mining and rule-based ai for study planning and monitoring in higher education</article-title>
          ,
          <source>in: Proceedings of the International Conference on Process Mining (ICPM'22): Process Mining Workshops</source>
          , Springer-Verlag,
          <year>2023</year>
          , pp.
          <fpage>513</fpage>
          -
          <lpage>525</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          [4]
          <string-name>
            <given-names>S.</given-names>
            <surname>Samaranayake</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A.</given-names>
            <surname>Gunawardena</surname>
          </string-name>
          , R. Meyer,
          <article-title>An interactive decision support system for college degree planning</article-title>
          ,
          <source>Athens Journal of Education</source>
          <volume>10</volume>
          (
          <year>2023</year>
          )
          <fpage>101</fpage>
          -
          <lpage>116</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          [5]
          <string-name>
            <given-names>J.</given-names>
            <surname>Baldazo</surname>
          </string-name>
          ,
          <string-name>
            <given-names>R.</given-names>
            <surname>Yasmín</surname>
          </string-name>
          ,
          <string-name>
            <given-names>R.</given-names>
            <surname>Nigenda</surname>
          </string-name>
          ,
          <article-title>Scheduling personalized study plans considering the stress factor, Interactive Learning Environments (</article-title>
          <year>2023</year>
          )
          <fpage>1</fpage>
          -
          <lpage>20</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref6">
        <mixed-citation>
          [6]
          <string-name>
            <given-names>Y.</given-names>
            <surname>Shen</surname>
          </string-name>
          ,
          <string-name>
            <given-names>H.</given-names>
            <surname>Li</surname>
          </string-name>
          ,
          <string-name>
            <given-names>Z.</given-names>
            <surname>Liao</surname>
          </string-name>
          ,
          <article-title>Online education course recommendation algorithm based on path factors</article-title>
          ,
          <source>in: Proceedings of the Fifth International Conference on Information Systems and Computer Aided Education (ICISCAE'22)</source>
          , IEEE Computer Society Press,
          <year>2022</year>
          , pp.
          <fpage>257</fpage>
          -
          <lpage>260</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref7">
        <mixed-citation>
          [7]
          <string-name>
            <given-names>G.</given-names>
            <surname>De Giacomo</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            <surname>Vardi</surname>
          </string-name>
          ,
          <article-title>Linear temporal logic and linear dynamic logic on finite traces</article-title>
          , in: F. Rossi (Ed.),
          <source>Proceedings of the Twenty-third International Joint Conference on Artificial Intelligence (IJCAI'13)</source>
          , IJCAI/AAAI Press,
          <year>2013</year>
          , pp.
          <fpage>854</fpage>
          -
          <lpage>860</lpage>
          .
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>