10.15.4.3 Writing Legend Printers

When you write your own visualizers, you might not be satisfied with the default format of the legend. Therefore you might want to write your own legend printer, replacing fdbg_legend/[1,2]. This should be quite straightforward based on the variable list returned by fdbg_annotate/[3,4]. Processing the rest of the action list and writing conclusions about the constraint behavior is not that easy though. To help your work, FDBG provides a predicate to transform the raw action list to a more readable form:

fdbg_transform_actions(+Actions, +Vars, -TransformedActions)

This will do the following transformations to Actions, returning the result in TransformedActions:

  1. remove all actions concerning variables in Vars (the list returned by fdbg_annotate/[3,4]);
  2. remove multiple exit and/or fail commands;
  3. remove all ground actions, translating those that will cause failure into fail(Action);
  4. substitute all other narrowings with an fdvar/3 compound term per variable.

The transformed action list may contain the following terms:

exit

the constraint exits

fail

the constraint fails due to a fail action

fail(Action)

the constraint fails because of Action

call(Goal)

Actions originally contained this action. FDBG cannot do anything with that but to inform the user about it.

fdvar(Name, Var, FDSet)

Actions also narrowed some variables that did not appear in the Vars list, this is one of them. The meaning of the arguments is the usual, described in FDBG Writing Visualizers. This should normally not happen.

AnythingElse

Actions contained unrecognized actions too, these are copied unmodified. This should not happen!



Send feedback on this subject.