Package de.learnlib.oracle.parallelism
Class ParallelOracleBuilders
- java.lang.Object
-
- de.learnlib.oracle.parallelism.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 Summary
-
-
-
Method Detail
-
newDynamicParallelOracle
public static <I,O> DynamicParallelOracleBuilder<I,Word<O>> newDynamicParallelOracle(SUL<I,O> sul)
Creates aDynamicParallelOracleBuilder
using the providedsul
as a supplier. This requires that the sul isforkable
.- Type Parameters:
I
- input symbol typeO
- 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 aDynamicParallelOracleBuilder
using the providedsul
as a supplier. This requires that the sul isforkable
.- Type Parameters:
I
- input symbol typeO
- output domain type- Parameters:
sul
- the sul instance for spawning new thread-specific membership oracle instancesundefinedInput
- the input symbol used for responding to inputs that are notenabled
.- Returns:
- a preconfigured oracle builder
-
newDynamicParallelOracle
public static <I,D> DynamicParallelOracleBuilder<I,D> newDynamicParallelOracle(Supplier<? extends MembershipOracle<I,D>> oracleSupplier)
Creates aDynamicParallelOracleBuilder
using the provided supplier.- Type Parameters:
I
- input symbol typeD
- output domain type- Parameters:
oracleSupplier
- the supplier for spawning new thread-specific membership oracle instances- Returns:
- a preconfigured oracle builder
-
newDynamicParallelOracle
@SafeVarargs public static <I,D> DynamicParallelOracleBuilder<I,D> newDynamicParallelOracle(MembershipOracle<I,D> firstOracle, MembershipOracle<I,D>... otherOracles)
Convenience method fornewDynamicParallelOracle(Collection)
.- Type Parameters:
I
- input symbol typeD
- output domain type- Parameters:
firstOracle
- the first (mandatory) oracleotherOracles
- further (optional) oracles to be used by other threads- Returns:
- a preconfigured oracle builder
-
newDynamicParallelOracle
public static <I,D> DynamicParallelOracleBuilder<I,D> newDynamicParallelOracle(Collection<? extends MembershipOracle<I,D>> oracles)
Creates aDynamicParallelOracleBuilder
using the provided collection of membership oracles. The resulting parallel oracle will always use aThreadPool.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 typeD
- 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 aDynamicParallelOracleBuilder
using the providedsul
as a supplier. This requires that the sul isforkable
.- Type Parameters:
I
- input symbol typeO
- 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 aDynamicParallelOmegaOracleBuilder
using the provided supplier.- Type Parameters:
S
- oracle state typeI
- input symbol typeD
- output domain type- Parameters:
oracleSupplier
- the supplier for spawning new thread-specific membership oracle instances- Returns:
- a preconfigured oracle builder
-
newDynamicParallelOmegaOracle
@SafeVarargs public static <S,I,D> DynamicParallelOmegaOracleBuilder<S,I,D> newDynamicParallelOmegaOracle(OmegaMembershipOracle<S,I,D> firstOracle, OmegaMembershipOracle<S,I,D>... otherOracles)
Convenience method fornewDynamicParallelOmegaOracle(Collection)
.- Type Parameters:
S
- oracle state typeI
- input symbol typeD
- output domain type- Parameters:
firstOracle
- the first (mandatory) oracleotherOracles
- further (optional) oracles to be used by other threads- Returns:
- a preconfigured oracle builder
-
newDynamicParallelOmegaOracle
public static <S,I,D> DynamicParallelOmegaOracleBuilder<S,I,D> newDynamicParallelOmegaOracle(Collection<? extends OmegaMembershipOracle<S,I,D>> oracles)
Creates aDynamicParallelOmegaOracleBuilder
using the provided collection of membership oracles. The resulting parallel oracle will always use aThreadPool.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 typeI
- input symbol typeD
- 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 aStaticParallelOracleBuilder
using the providedsul
as a supplier. This requires that the sul isforkable
.- Type Parameters:
I
- input symbol typeO
- 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 aStaticParallelOracleBuilder
using the providedsul
as a supplier. This requires that the sul isforkable
.- Type Parameters:
I
- input symbol typeO
- output domain type- Parameters:
sul
- the sul instance for spawning new thread-specific membership oracle instancesundefinedInput
- the input symbol used for responding to inputs that are notenabled
.- Returns:
- a preconfigured oracle builder
-
newStaticParallelOracle
public static <I,D> StaticParallelOracleBuilder<I,D> newStaticParallelOracle(Supplier<? extends MembershipOracle<I,D>> oracleSupplier)
Creates aStaticParallelOracleBuilder
using the provided supplier. Uses the further specifiedAbstractStaticBatchProcessorBuilder.withPoolPolicy(PoolPolicy)
andAbstractStaticBatchProcessorBuilder.withNumInstances(int)
} (or its defaults) to determine the thread pool.- Type Parameters:
I
- input symbol typeD
- output domain type- Parameters:
oracleSupplier
- the supplier for spawning new thread-specific membership oracle instances- Returns:
- a preconfigured oracle builder
-
newStaticParallelOracle
@SafeVarargs public static <I,D> StaticParallelOracleBuilder<I,D> newStaticParallelOracle(MembershipOracle<I,D> firstOracle, MembershipOracle<I,D>... otherOracles)
Convenience method fornewStaticParallelOracle(Collection)
.- Type Parameters:
I
- input symbol typeD
- output domain type- Parameters:
firstOracle
- the first (mandatory) oracleotherOracles
- further (optional) oracles to be used by other threads- Returns:
- a preconfigured oracle builder
-
newStaticParallelOracle
public static <I,D> StaticParallelOracleBuilder<I,D> newStaticParallelOracle(Collection<? extends MembershipOracle<I,D>> oracles)
Creates aStaticParallelOracleBuilder
using the provided collection of membership oracles. The resulting parallel oracle will always use aThreadPool.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 typeD
- 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 aStaticParallelOmegaOracleBuilder
using the providedsul
as a supplier. This requires that the sul isforkable
.- Type Parameters:
I
- input symbol typeO
- 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 aStaticParallelOmegaOracleBuilder
using the provided supplier.- Type Parameters:
S
- oracle state typeI
- input symbol typeD
- output domain type- Parameters:
oracleSupplier
- the supplier for spawning new thread-specific membership oracle instances- Returns:
- a preconfigured oracle builder
-
newStaticParallelOmegaOracle
@SafeVarargs public static <S,I,D> StaticParallelOmegaOracleBuilder<S,I,D> newStaticParallelOmegaOracle(OmegaMembershipOracle<S,I,D> firstOracle, OmegaMembershipOracle<S,I,D>... otherOracles)
Convenience method fornewStaticParallelOmegaOracle(Collection)
.- Type Parameters:
S
- oracle state typeI
- input symbol typeD
- output domain type- Parameters:
firstOracle
- the first (mandatory) oracleotherOracles
- further (optional) oracles to be used by other threads- Returns:
- a preconfigured oracle builder
-
newStaticParallelOmegaOracle
public static <S,I,D> StaticParallelOmegaOracleBuilder<S,I,D> newStaticParallelOmegaOracle(Collection<? extends OmegaMembershipOracle<S,I,D>> oracles)
Creates aStaticParallelOmegaOracleBuilder
using the provided collection of membership oracles. The resulting parallel oracle will always use aThreadPool.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 typeI
- input symbol typeD
- output domain type- Parameters:
oracles
- the oracle instances to distribute the queries to- Returns:
- the preconfigured oracle builder
-
-