Interface ConstructiveHeuristic<T extends Copyable<T>>

    • Method Summary

      All Methods Instance Methods Abstract Methods Default Methods 
      Modifier and Type Method Description
      int completeLength()
      Gets the required length of complete solutions to the problem instance for which this constructive heuristic is configured.
      default IncrementalEvaluation<T> createIncrementalEvaluation()
      Creates an IncrementalEvaluation object corresponding to an initially empty Partial for use in incrementally constructing a solution to the problem for which this heuristic is designed.
      Partial<T> createPartial​(int n)
      Creates an empty Partial solution, which will be incrementally transformed into a complete solution of a specified length.
      Problem<T> getProblem()
      Gets a reference to the instance of the optimization problem that is the subject of this heuristic.
      double h​(Partial<T> p, int element, IncrementalEvaluation<T> incEval)
      Heuristically evaluates the possible addition of an element to the end of a Partial.
    • Method Detail

      • h

        double h​(Partial<T> p,
                 int element,
                 IncrementalEvaluation<T> incEval)
        Heuristically evaluates the possible addition of an element to the end of a Partial. Higher evaluations imply that the element is a better choice for the next element to add. For example, if you evaluate two elements, x and y, with h, and h returns a higher value for y than for x, then this means that y is believed to be the better choice according to the heuristic. Implementations of this interface must ensure that h always returns a positive result. This is because stochastic sampling algorithms such as HBSS and VBSS assume that the constructive heuristic returns only positive values.
        Parameters:
        p - The current state of the Partial
        element - The element under consideration for adding to the Partial
        incEval - An IncrementalEvaluation of p. This method assumes that incEval is of the same runtime type as the object returned by createIncrementalEvaluation().
        Returns:
        The heuristic evaluation of the hypothetical addition of element to the end of p. The higher the evaluation, the more important the heuristic believes that element should be added next. The intention is to compare the value returned with the heuristic evaluations of other elements. Individual results in isolation are not necessarily meaningful.
        Throws:
        ClassCastException - if incEval is not of the same runtime type as the objects returned by the createIncrementalEvaluation() method of the class implementing this interface
      • createPartial

        Partial<T> createPartial​(int n)
        Creates an empty Partial solution, which will be incrementally transformed into a complete solution of a specified length.
        Parameters:
        n - the desired length of the final complete solution.
        Returns:
        an empty Partial solution
      • completeLength

        int completeLength()
        Gets the required length of complete solutions to the problem instance for which this constructive heuristic is configured.
        Returns:
        length of solutions to the problem instance for which this heuristic is configured
      • getProblem

        Problem<T> getProblem()
        Gets a reference to the instance of the optimization problem that is the subject of this heuristic.
        Returns:
        the instance of the optimization problem that is the subject of this heuristic.