Meta-level ASP Definition of the Hypothesis Space


Since ILASP 3.5, the hypothesis space can be defined using ASP. This can be either completely defined from scratch, or in combination with mode declarations. This ASP program is passed to ILASP using the statement #bias("..."), where ... is replaced with the ASP program. Each answer set of this program is mapped to a rule in the hypothesis space. This mapping is defined in the rest of this section. Note that the ASP definition feature replaces the previous (experimental) bias constraints, which existed in various forms, from ILASP 3.1 to 3.4.

Normal rules and constraints


Normal rules and constraints are expressed by answer sets containing the following predicates: head/1 and body/1. For example, the answer set {head(p), body(q)} represents the rule p :- q. If the answer set contains no head atom, then the rule is a constraint.

Negation as failure is represented using the naf/1 function symbol; for example body(naf(p)) represents that not p is in the body. Variables are represented using the function symbol var__/1; for example var__(1) represents the variable V1. So, { head(p(var__(1)), body(q(var__(1), var__(2), a), body(q(var__(1), var__(3), b) } represents the rule p(V1) :- q(V1, V2, a), q(V1, V3, b).

Example.

Consider the following ASP definition of the hypothesis space:

#bias("
1 { head(p); head(q) } 1.
{ body(B) } :- possible_body(B).
possible_body(r).
possible_body(s).
possible_body(naf(s)).
:- body(naf(B)), body(B).
").

If run in ILASP, this will lead to the following hypothesis space being generated:

p.
p :- r.
p :- s.
p :- not s.
p :- r, s.
p :- r, not s.
q.
q :- r.
q :- s.
q :- not s.
q :- r, s.
q :- r, not s.

Choice rules


An answer set representing a choice rule will contain no head/1 atoms, but will instead contain (potentially multiple) in_head/1 atoms. It will also contain one lb/1 and one ub/1 atom, specifying the (integer) lower and upper bound for the choice rule, respectively. For example, the answer set { lb(0), ub(1), in_head(p), in_head(q), body(r) } represents the rule 0 { p; q } 1 :- r.

Disjunctive rules


From ILASP 3.6.0, disjunctive rules are supported. Similarly to the case of a choice rule, an answer set representing a disjunctive rule will contain no head/1 atoms, but will instead contain (potentially multiple) in_head/1 atoms. Unlike in the case of a choice rule, it will not contain the lb/1 and ub/1 atoms. For example, the answer set { in_head(p), in_head(q), body(r) } represents the rule p; q :- r.

In order to enable learning disjunctive rules with the default ASP definition of hypothesis spaces (see below), the user must add the following statement to the task:

#bias("allow_disjunction.").

Weak constraints


Weak constraints are represented by answer sets using the predicates weak_body/1, priority/1 and weight/1. For example, the answer set { weak_body(p(var__(V1))), weight(1), priority(2) } represents the weak constraint :~ p(V1).[1@2, V1].

Conditional literals


From ILASP 3.6.0, any of the above rules can also include conditional literals. To represent that a literal lit has a condition c, we use the atom condition(c, lit). For example, the answer set { in_head(p), in_head(q), body(r), condition(c_1, p), condition(c_2, p), condition(c_3, r) } represents the rule p : c_1, c_2; q :- r : c_3.

To specify which predicates can appear in the condition of a conditional literal using mode declarations, the new #modec declaration should be used. This is defined in exactly the same way as the #modeb declarations above.

Overriding default behaviour


If a single mode declaration is defined in a task then ILASP will assume that the default interpretation of mode declarations should be enabled. This will cause a default ASP program to be used to define the hypothesis space. You can extend this program by using #bias statements, but this will only add to the existing program. A common use of this feature would be to constrain the hypothesis space, for instance the bias statement #bias(":- body(p(_)), body(q(_)).") states that the predicates p/1 and q/1 cannot be used together in the body of a rule in the hypothesis space.

The ASP definition of the hypothesis space (including the representation of mode declarations) can be seen by running ILASP with the flags -s and -t together.

In some cases, you may wish to completely disable the default interpretation of mode declarations. If this is the case, you can add the flag --override-default-sm. In this case, the ASP definition of the hypothesis space will consist of the representation of the mode declarations and whatever ASP rules you have added using bias statements.