Skip to content

Model Difference

Will penalize the differences in the reference and foil models, prioritizing foils that are as similar as possible to the reference model. This is useful when you want to find a foil that is as close as possible to the reference model, for instance, one that takes the same choices when multiple options are available.

model-difference.lp
Source
% In the reference model but not in the foil
cost(model_diff(R), 1, 2) :- model(R, ref), not model(R, foil).

% In the foil model but not in the reference
cost(model_diff(R), 1, 2) :- not model(R, ref), model(R, foil).

Encoding

In the reference model but not in the foil

cost(model_diff(R), 1, 2) :- model(R, ref), not model(R, foil).

In the foil model but not in the reference

cost(model_diff(R), 1, 2) :- not model(R, ref), model(R, foil).