Class ParallelOracleBuilders


  • public final class ParallelOracleBuilders
    extends Object
    Builders for (static and dynamic) parallel oracles.

    Using the methods defined in this class is the preferred way of instantiating parallel oracles.

    Usage examples

    Creating a static parallel oracle with a minimum batch size of 20 and a fixed thread pool, using two membership oracles (running in two separate threads):

     ParallelOracleBuilders.newStaticParallelOracle(oracle1, oracle2)
          .withMinBatchSize(20)
          .create();
     

    Creating a dynamic parallel oracle with a custom executor, and a batch size of 5, using a shared membership oracle:

     ParallelOracleBuilders.newDynamicParallelOracle(() -> membershipOracle)
          .withBatchSize(5)
          .withCustomExecutor(myExecutor)
          .create();
     
    Note: This requires the shared membership oracle to be thread-safe.

    Creating a dynamic parallel oracle with a cached thread pool of maximum size 4, a batch size of 5, using a (forkabel) SUL:

     ParallelOracleBuilders.newDynamicParallelOracle(sul)
          .withBatchSize(5)
          .withPoolSize(4)
          .withPoolPolicy(PoolPolicy.CACHED)
          .create();
     
    • Method Detail

      • newDynamicParallelOracle

        public static <I,​O> DynamicParallelOracleBuilder<I,​Word<O>> newDynamicParallelOracle​(SUL<I,​O> sul)
        Creates a DynamicParallelOracleBuilder using the provided sul as a supplier. This requires that the sul is forkable.
        Type Parameters:
        I - input symbol type
        O - output domain type
        Parameters:
        sul - the sul instance for spawning new thread-specific membership oracle instances
        Returns:
        a preconfigured oracle builder
      • newDynamicParallelOracle

        public static <I,​O> DynamicParallelOracleBuilder<I,​Word<O>> newDynamicParallelOracle​(StateLocalInputSUL<I,​O> sul,
                                                                                                         O undefinedInput)
        Creates a DynamicParallelOracleBuilder using the provided sul as a supplier. This requires that the sul is forkable.
        Type Parameters:
        I - input symbol type
        O - output domain type
        Parameters:
        sul - the sul instance for spawning new thread-specific membership oracle instances
        undefinedInput - the input symbol used for responding to inputs that are not enabled.
        Returns:
        a preconfigured oracle builder
      • newDynamicParallelOracle

        public static <I,​D> DynamicParallelOracleBuilder<I,​D> newDynamicParallelOracle​(Supplier<? extends MembershipOracle<I,​D>> oracleSupplier)
        Creates a DynamicParallelOracleBuilder using the provided supplier.
        Type Parameters:
        I - input symbol type
        D - output domain type
        Parameters:
        oracleSupplier - the supplier for spawning new thread-specific membership oracle instances
        Returns:
        a preconfigured oracle builder
      • newDynamicParallelOracle

        public static <I,​D> DynamicParallelOracleBuilder<I,​D> newDynamicParallelOracle​(Collection<? extends MembershipOracle<I,​D>> oracles)
        Creates a DynamicParallelOracleBuilder using the provided collection of membership oracles. The resulting parallel oracle will always use a ThreadPool.PoolPolicy.FIXED pool policy and spawn a separate thread for each of the provided oracles (so that the oracles do not need to care about synchronization if they don't share state).
        Type Parameters:
        I - input symbol type
        D - output domain type
        Parameters:
        oracles - the oracle instances to distribute the queries to
        Returns:
        the preconfigured oracle builder
      • newDynamicParallelOmegaOracle

        public static <I,​O> DynamicParallelOmegaOracleBuilder<?,​I,​Word<O>> newDynamicParallelOmegaOracle​(ObservableSUL<?,​I,​O> sul)
        Creates a DynamicParallelOracleBuilder using the provided sul as a supplier. This requires that the sul is forkable.
        Type Parameters:
        I - input symbol type
        O - output domain type
        Parameters:
        sul - the sul instance for spawning new thread-specific omega membership oracle instances
        Returns:
        a preconfigured oracle builder
      • newDynamicParallelOmegaOracle

        public static <S,​I,​D> DynamicParallelOmegaOracleBuilder<S,​I,​D> newDynamicParallelOmegaOracle​(Supplier<? extends OmegaMembershipOracle<S,​I,​D>> oracleSupplier)
        Creates a DynamicParallelOmegaOracleBuilder using the provided supplier.
        Type Parameters:
        S - oracle state type
        I - input symbol type
        D - output domain type
        Parameters:
        oracleSupplier - the supplier for spawning new thread-specific membership oracle instances
        Returns:
        a preconfigured oracle builder
      • newDynamicParallelOmegaOracle

        public static <S,​I,​D> DynamicParallelOmegaOracleBuilder<S,​I,​D> newDynamicParallelOmegaOracle​(Collection<? extends OmegaMembershipOracle<S,​I,​D>> oracles)
        Creates a DynamicParallelOmegaOracleBuilder using the provided collection of membership oracles. The resulting parallel oracle will always use a ThreadPool.PoolPolicy.FIXED pool policy and spawn a separate thread for each of the provided oracles (so that the oracles do not need to care about synchronization if they don't share state).
        Type Parameters:
        S - oracle state type
        I - input symbol type
        D - output domain type
        Parameters:
        oracles - the oracle instances to distribute the queries to
        Returns:
        the preconfigured oracle builder
      • newStaticParallelOracle

        public static <I,​O> StaticParallelOracleBuilder<I,​Word<O>> newStaticParallelOracle​(SUL<I,​O> sul)
        Creates a StaticParallelOracleBuilder using the provided sul as a supplier. This requires that the sul is forkable.
        Type Parameters:
        I - input symbol type
        O - output domain type
        Parameters:
        sul - the sul instance for spawning new thread-specific membership oracle instances
        Returns:
        a preconfigured oracle builder
      • newStaticParallelOracle

        public static <I,​O> StaticParallelOracleBuilder<I,​Word<O>> newStaticParallelOracle​(StateLocalInputSUL<I,​O> sul,
                                                                                                       O undefinedInput)
        Creates a StaticParallelOracleBuilder using the provided sul as a supplier. This requires that the sul is forkable.
        Type Parameters:
        I - input symbol type
        O - output domain type
        Parameters:
        sul - the sul instance for spawning new thread-specific membership oracle instances
        undefinedInput - the input symbol used for responding to inputs that are not enabled.
        Returns:
        a preconfigured oracle builder
      • newStaticParallelOracle

        public static <I,​D> StaticParallelOracleBuilder<I,​D> newStaticParallelOracle​(Collection<? extends MembershipOracle<I,​D>> oracles)
        Creates a StaticParallelOracleBuilder using the provided collection of membership oracles. The resulting parallel oracle will always use a ThreadPool.PoolPolicy.FIXED pool policy and spawn a separate thread for each of the provided oracles (so that the oracles do not need to care about synchronization if they don't share state).
        Type Parameters:
        I - input symbol type
        D - output domain type
        Parameters:
        oracles - the oracle instances to distribute the queries to
        Returns:
        the preconfigured oracle builder
      • newStaticParallelOmegaOracle

        public static <I,​O> StaticParallelOmegaOracleBuilder<?,​I,​Word<O>> newStaticParallelOmegaOracle​(ObservableSUL<?,​I,​O> sul)
        Creates a StaticParallelOmegaOracleBuilder using the provided sul as a supplier. This requires that the sul is forkable.
        Type Parameters:
        I - input symbol type
        O - output domain type
        Parameters:
        sul - the sul instance for spawning new thread-specific omega membership oracle instances
        Returns:
        a preconfigured oracle builder
      • newStaticParallelOmegaOracle

        public static <S,​I,​D> StaticParallelOmegaOracleBuilder<S,​I,​D> newStaticParallelOmegaOracle​(Supplier<? extends OmegaMembershipOracle<S,​I,​D>> oracleSupplier)
        Creates a StaticParallelOmegaOracleBuilder using the provided supplier.
        Type Parameters:
        S - oracle state type
        I - input symbol type
        D - output domain type
        Parameters:
        oracleSupplier - the supplier for spawning new thread-specific membership oracle instances
        Returns:
        a preconfigured oracle builder
      • newStaticParallelOmegaOracle

        public static <S,​I,​D> StaticParallelOmegaOracleBuilder<S,​I,​D> newStaticParallelOmegaOracle​(Collection<? extends OmegaMembershipOracle<S,​I,​D>> oracles)
        Creates a StaticParallelOmegaOracleBuilder using the provided collection of membership oracles. The resulting parallel oracle will always use a ThreadPool.PoolPolicy.FIXED pool policy and spawn a separate thread for each of the provided oracles (so that the oracles do not need to care about synchronization if they don't share state).
        Type Parameters:
        S - oracle state type
        I - input symbol type
        D - output domain type
        Parameters:
        oracles - the oracle instances to distribute the queries to
        Returns:
        the preconfigured oracle builder