org.eclipse.viatra.query.runtime.localsearch.planner.cost.impl

## Class StatisticsBasedConstraintCostFunction

- java.lang.Object
- - org.eclipse.viatra.query.runtime.localsearch.planner.cost.impl.StatisticsBasedConstraintCostFunction

- All Implemented Interfaces:
    ICostFunction
  Direct Known Subclasses:
    IndexerBasedConstraintCostFunction

      public abstract class StatisticsBasedConstraintCostFunction
      extends java.lang.Object
      implements ICostFunction

  Cost function which calculates cost based on the cardinality of items in the runtime model
  Since:
    1.4

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected static double` | `DEFAULT_COST`
    `protected static double` | `MAX_COST`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `StatisticsBasedConstraintCostFunction()`

  - ### Method Summary

    All Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected double` | `_calculateCost(ConstantValue constant, IConstraintEvaluationContext input)`
    `protected double` | `_calculateCost(ExportedParameter exportedParam, IConstraintEvaluationContext input)`
    `protected double` | `_calculateCost(PConstraint constraint, IConstraintEvaluationContext input)` Default cost calculation strategy
    `protected double` | `_calculateCost(PositivePatternCall patternCall, IConstraintEvaluationContext input)`
    `protected double` | `_calculateCost(TypeConstraint constraint, IConstraintEvaluationContext input)`
    `protected double` | `_calculateCost(TypeFilterConstraint exportedParam, IConstraintEvaluationContext input)`
    `double` | `apply(IConstraintEvaluationContext input)`
    `protected double` | `calculateBinaryExtendCost(IInputKey supplierKey, PVariable srcVariable, PVariable dstVariable, boolean isInverse, long edgeCount, IConstraintEvaluationContext input)`
    `double` | `calculateCost(PConstraint exportedParam, IConstraintEvaluationContext input)`
    `protected double` | `calculateUnaryConstraintCost(TypeConstraint constraint, IConstraintEvaluationContext input)`
    `abstract long` | `countTuples(IConstraintEvaluationContext input, IInputKey supplierKey)`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### MAX_COST

          protected static double MAX_COST

    - #### DEFAULT_COST

          protected static double DEFAULT_COST

  - ### Constructor Detail

    - #### StatisticsBasedConstraintCostFunction

          public StatisticsBasedConstraintCostFunction()

  - ### Method Detail

    - #### countTuples

          public abstract long countTuples(IConstraintEvaluationContext input,
                                           IInputKey supplierKey)

    - #### apply

          public double apply(IConstraintEvaluationContext input)

      Specified by:
        `apply` in interface `ICostFunction`

    - #### _calculateCost

          protected double _calculateCost(ConstantValue constant,
                                          IConstraintEvaluationContext input)

    - #### _calculateCost

          protected double _calculateCost(TypeConstraint constraint,
                                          IConstraintEvaluationContext input)

    - #### calculateBinaryExtendCost

          protected double calculateBinaryExtendCost(IInputKey supplierKey,
                                                     PVariable srcVariable,
                                                     PVariable dstVariable,
                                                     boolean isInverse,
                                                     long edgeCount,
                                                     IConstraintEvaluationContext input)

    - #### calculateUnaryConstraintCost

          protected double calculateUnaryConstraintCost(TypeConstraint constraint,
                                                        IConstraintEvaluationContext input)

    - #### _calculateCost

          protected double _calculateCost(ExportedParameter exportedParam,
                                          IConstraintEvaluationContext input)

    - #### _calculateCost

          protected double _calculateCost(TypeFilterConstraint exportedParam,
                                          IConstraintEvaluationContext input)

    - #### _calculateCost

          protected double _calculateCost(PositivePatternCall patternCall,
                                          IConstraintEvaluationContext input)

    - #### _calculateCost

          protected double _calculateCost(PConstraint constraint,
                                          IConstraintEvaluationContext input)

      Default cost calculation strategy

    - #### calculateCost

          public double calculateCost(PConstraint exportedParam,
                                      IConstraintEvaluationContext input)