I - the type of input that the solver handlespublic class HCRunner<I>
extends java.lang.Object
HCRunner provides a simple way to execute a given solver on multiple inputs in separate parallel tasks.
Simply use run(T...) or run(int, T...) and you're good to go.
Note: Depending on your choice of UncaughtExceptionsPolicy, you may need to provide an SLF4J implementation
on your classpath to be able to see error logs.
| Constructor | Description |
|---|---|
HCRunner(java.util.function.Consumer<I> solver,
UncaughtExceptionsPolicy exceptionsPolicy) |
Creates a new
HCRunner. |
| Modifier and Type | Method | Description |
|---|---|---|
void |
run(int nThreads,
I... inputs) |
Executes the solver given in the constructor on the given inputs, each in its own task.
|
void |
run(I... inputs) |
Executes the solver given in the constructor on the given inputs, each in its own thread.
|
public HCRunner(java.util.function.Consumer<I> solver, UncaughtExceptionsPolicy exceptionsPolicy)
HCRunner.solver - the solver to run on the inputs given to run(T...) or
run(int, T...)exceptionsPolicy - defines what to do with uncaught exceptions thrown by the solver@SafeVarargs public final void run(I... inputs)
inputs - the inputs to run the solver on@SafeVarargs
public final void run(int nThreads,
I... inputs)
nThreads - the number of threads to use in the poolinputs - the inputs to run the solver on