Interface CostModel<D>

  • Type Parameters:
    D - type of node data on which the cost model is defined.
    All Known Implementing Classes:
    PerEditOperationStringNodeDataCostModel, StringUnitCostModel

    public interface CostModel<D>
    This interface specifies the methods to implement for a custom cost model. The methods represent the costs of edit operations (delete, insert, rename).

    If the cost function is a metric, the tree edit distance is a metric too.

    However, the cost function does not have to be a metric - the costs of deletion, insertion and rename can be arbitrary.

    IMPORTANT: Mind the float type use for costs.

    • Method Detail

      • del

        float del​(AptedNode<D> n)
        Calculates the cost of deleting a node.
        Parameters:
        n - the node considered to be deleted.
        Returns:
        the cost of deleting node n.
      • ins

        float ins​(AptedNode<D> n)
        Calculates the cost of inserting a node.
        Parameters:
        n - the node considered to be inserted.
        Returns:
        the cost of inserting node n.
      • ren

        float ren​(AptedNode<D> n1,
                  AptedNode<D> n2)
        Calculates the cost of renaming (mapping) two nodes.
        Parameters:
        n1 - the source node of rename.
        n2 - the destination node of rename.
        Returns:
        the cost of renaming (mapping) node n1 to n2.