Skip to content

Explanation Selection

Domain-specific preferences can be added to an explanation over cost functions. They are used to assign higher costs to certain rules and/or atoms, e.g., to prioritize changes over the input, or the removal of integrity constraints over facts.

Asplain comes out of the box with a range of predefined cost functions for common preferences. You can use these functions as-is, or write your own to fit your needs.

Usage

asplain [...] --costs-encoding=<YOUR-COST-ENCODING>

Multiple cost functions

You can provide multiple cost functions by repeating the --costs-encoding option multiple times.

Your cost encoding must obtain atoms using the cost/3 predicate.


cost(Name, Value, Level)

Represents a cost that will be optimized when finding foils.

Parameter Description
Name

A unique identifier for a cost that will be penalized. For example, if you want to penalize each added rule, you would create one cost/3 instance for each rule with the name of the rule as Name.

Value

A numeric value representing the cost to be penalized. Can be negative for rewards.

Level

A numeric value representing the priority of this cost. Higher levels are optimized first


Cost encodings

In this section we provide a few examples of cost encodings for common preferences. Browse the files in the left for more examples and the complete list of predefined cost encodings.

Adjust the Value and Level to prioritize certain explanations over others.