3.4 Transitions Between Exercise States
3.4.2 Condition
An element condition represents conditions that have to be satisfied by the learner’s answer. The condition consists of one or more compare elements
60 CHAPTER 3. KNOWLEDGE REPRESENTATION that represent comparisons of the learner’s answer to the reference values. Comparisons can be simple and complex in structure.
Simple comparisons. Simple comparisons are represented using a compare predicate containing the reference value to be compared to the learner’s an- swer. The compare predicate can be extended with a context attribute that defines the mathematical evaluation context, as described in more detail in Section 3.4.4. There are three basic contexts defined for all domains of ex- ercises: syntactic, numeric and semantic. In case of a syntactic context, the learner’s answer is literally compared to the reference value. A numeric comparison is used for comparing real numbers modulo some epsilon, rep- resented as an attribute of the compare element. A semantic comparison is used to check whether the learner’s answer and the reference value are se- mantically equivalent. Such an equivalence can be validated by a Computer Algebra System, employed as the semantic evaluation by ActiveMath. If the context attribute is omitted, a syntactic context is used by default.
In case the learner has to submit multiple inputs to the system in one step, e.g. an answer to multiple choice questions or to fill in several blanks, a grouping element composite is used as a container of single comparison elements. A composite condition is considered satisfied if and only if all component comparisons are satisfied. In case it is not important to evalu- ate all components of a composite comparison but only some of them, the composite element can be annotated with a map attribute, containing a list of positions of single inputs that have to be evaluated. The rest of inputs will then not be evaluated by the system.
If the learner’s answer consists of several elements, they are compared to the list of reference values in the order of their occurrence. If the order is not important, the value of the attribute ordered of the element composite is set to ”false”. The default value of this attribute is ”true”, which is used by the system, if the attribute is omitted in the representation.
The order of transitions in the transition map is important when eval- uating the same expression successively in different contexts. For example, if the first transition contained a condition comparing the learner’s answer to the reference value semantically and the second transition contains a con- dition comparing the learner’s answer to the reference value syntactically, then the second transition would never be reached by the system. However, assume a syntactic comparison transition is followed by a semantic compar-
3.4. TRANSITIONS BETWEEN EXERCISE STATES 61 ison transition. Then the second transition fires with the learner’s answer only if the condition of the first transition is not satisfied. Therefore, if the second transition fires, we already know that the first transition did not fire, so the learner’s answer is not syntactically equal to the correct solution, but semantically equivalent.
Complex constraints. In case of more complex constraits upon the learner’s answer, the composite element can contain a single expression representing a complex constraint upon the learner’s answer. It is represented as a math- ematical formula (using the OpenMath format as for any mathematical expression in ActiveMath), possibly consisting of a Boolean combination of atomic predicates. An example of a complex constraint is shown in Fig- ure 3.22.
3.4.2.1 Evaluating Multiple Choice Questions
Conditions for evaluating multiple choice questions are represented by com- posite comparisons, containing as many elements, as there are choices in the selection. Each atomic comparison compares the learner’s answer for the current choice to 1 if the choice has to be selected and to 0 otherwise. Al- ternatively, it is possible to represent more complex constraints consisting of Boolean combination of atomic predicates, as it is shown in Section 3.4.2.4 for blanks.
Consider the example of a multiple choice from the Figure 3.7. The condition matching the correct answer is shown in the Figure 3.17. Here, the first and the third choice are selected, and the second choice is left unchecked.
< c o n d i t i o n> <c o m p o s i t e> <compare>1</ compare> <compare>0</ compare> <compare>1</ compare> </ c o m p o s i t e> </ c o n d i t i o n>
62 CHAPTER 3. KNOWLEDGE REPRESENTATION 3.4.2.2 Evaluating Mappings
Mappings can be modeled as two-dimentional selections. In case of a mapping with dimensions - m × n, the number of atomic comparisons will be m · n.
Consider the case of a mapping exercise from Figure 3.10. Figure 3.18 shows the matrix of values matching the learner’s answer in this mapping.
Figure 3.18: Evaluation matrix for a mapping
The corresponding composite comparison is shown in Figure 3.19. The matrix is entered as a flat list of zeros and ones.
< c o n d i t i o n> <c o m p o s i t e>
<compare>1</ compare><compare>0</ compare><compare>0</ compare> <compare>0</ compare><compare>1</ compare><compare>0</ compare> <compare>0</ compare><compare>0</ compare><compare>1</ compare> </ c o m p o s i t e>
</ c o n d i t i o n>
Figure 3.19: Condition matching a mapping answer
3.4.2.3 Evaluating Ordering
A special case of a mapping exercise is an ordering exercise. In such exercises the list of choices is mapped to itself. The correct answer to the ordering from the Figure 3.9 is to reorder the first and the second choices.
3.4. TRANSITIONS BETWEEN EXERCISE STATES 63 Therefore, we need a condition representing mapping of choices from the original order 1,2,3 into 2,1,3. In our representation of mapping comparisons, this transformation is represented by a matrix:
0 1 0 1 0 0 0 0 1
Figure 3.20 shows a representation of the corresponding condition.
< c o n d i t i o n> <c o m p o s i t e>
<compare>0</ compare><compare>1</ compare><compare>0</ compare> <compare>1</ compare><compare>0</ compare><compare>0</ compare> <compare>0</ compare><compare>0</ compare><compare>1</ compare> </ c o m p o s i t e>
</ c o n d i t i o n>
Figure 3.20: Condition for the correct answer in an ordering
3.4.2.4 Evaluating Blanks
In order to evaluate blanks, the compare element is used as well. This element can have a context attribute, specifying the type of comparison, as described in Section 3.4.4. If the learner has to fill in several blanks in one step, that have to be evaluated independently from each other, the corresponding condition element contains a composite grouping element that consists of a list of comparisons, each corresponding to the respective blank. A sample condition is shown in Figure 3.21.
< c o n d i t i o n> <c o m p o s i t e> <compare c o n t e x t=” s y n t a c t i c ”>1</ compare> <compare c o n t e x t=” s y n t a c t i c ”>2</ compare> <compare c o n t e x t=” s e m a n t i c ”>1 + 2</ compare> </ c o m p o s i t e> </ c o n d i t i o n>
64 CHAPTER 3. KNOWLEDGE REPRESENTATION In this condition, the first input of the learner is syntactically compared to number 1, the second input is syntactically compared to the number 2, and the third input is semantically compared to 1 + 2.
In order to allow for an arbitrarily complex evaluation of multiple free in- puts, any constraint involving the learner’s answers can be used. Figure 3.22 shows a sample condition, in which the first input of the learner can be ar- bitrary, but the second input must be twice the first one and the third input must be three times the first one.
< c o n d i t i o n> <c o m p o s i t e> <compare c o n t e x t=” s e m a n t i c ”> λx, y, z.(y = 2 · x)&(z = 3 · x), true </ compare> </ c o m p o s i t e> </ c o n d i t i o n>
Figure 3.22: Complex Boolean condition for multiple free inputs We use a lambda expression for representing this constraints, in which the bound variables x, y and z are automatically mapped by the system to the corresponding learner’s answers. The result of the expression which involves the learner’s answers is compared with the reference result. In our case, the result is Boolean and it is compared to true.