Interface EvolutionInterceptor<G extends Gene<?,​G>,​C extends Comparable<? super C>>

    • Method Detail

      • before

        default EvolutionStart<G,​Cbefore​(EvolutionStart<G,​C> start)
        This method is called right before the evaluation of a generation is started.
        Parameters:
        start - the evolution start object
        Returns:
        the possible update evolution start object
        Throws:
        NullPointerException - if the evolution start object is null
      • after

        default EvolutionResult<G,​Cafter​(EvolutionResult<G,​C> result)
        This method is called after the evaluation of a generation. If this method alters the evolution result object, the population within this result object is re-evaluated.
        Parameters:
        result - the evolution result object to update
        Returns:
        the possible updated evolution result object
        Throws:
        NullPointerException - if the evolution result object is null
      • of

        static <G extends Gene<?,​G>,​C extends Comparable<? super C>> EvolutionInterceptor<G,​C> of​(Function<? super EvolutionStart<G,​C>,​EvolutionStart<G,​C>> before,
                                                                                                                    Function<? super EvolutionResult<G,​C>,​EvolutionResult<G,​C>> after)
        Create a new interceptor instance with the given before and after functions.
        Type Parameters:
        G - the gene type
        C - the fitness result type
        Parameters:
        before - the function executed before each evolution step
        after - the function executed after each evolution step
        Returns:
        a new interceptor instance with the given interceptor functions
        Throws:
        NullPointerException - if one of the functions is null
      • ofBefore

        static <G extends Gene<?,​G>,​C extends Comparable<? super C>> EvolutionInterceptor<G,​C> ofBefore​(Function<? super EvolutionStart<G,​C>,​EvolutionStart<G,​C>> before)
        Create a new interceptor instance with the given before function.
        Type Parameters:
        G - the gene type
        C - the fitness result type
        Parameters:
        before - the function executed before each evolution step
        Returns:
        a new interceptor instance with the given interceptor function
        Throws:
        NullPointerException - if the function is null
      • ofAfter

        static <G extends Gene<?,​G>,​C extends Comparable<? super C>> EvolutionInterceptor<G,​C> ofAfter​(Function<? super EvolutionResult<G,​C>,​EvolutionResult<G,​C>> after)
        Create a new interceptor instance with the given after function.
        Type Parameters:
        G - the gene type
        C - the fitness result type
        Parameters:
        after - the function executed after each evolution step
        Returns:
        a new interceptor instance with the given interceptor function
        Throws:
        NullPointerException - if the function is null
      • identity

        static <G extends Gene<?,​G>,​C extends Comparable<? super C>> EvolutionInterceptor<G,​C> identity()
        Return an interceptor object which does nothing.
        Type Parameters:
        G - the gene type
        C - the fitness result type
        Returns:
        a new identity interceptor