Package ai.libs.jaicore.basic.algorithm
Class ASolutionCandidateIterator<I,O>
- java.lang.Object
-
- ai.libs.jaicore.basic.algorithm.AAlgorithm<I,O>
-
- ai.libs.jaicore.basic.algorithm.ASolutionCandidateIterator<I,O>
-
- Type Parameters:
I-O-
- All Implemented Interfaces:
java.lang.Iterable<org.api4.java.algorithm.events.IAlgorithmEvent>,java.util.concurrent.Callable<O>,java.util.Iterator<org.api4.java.algorithm.events.IAlgorithmEvent>,org.api4.java.algorithm.IAlgorithm<I,O>,org.api4.java.algorithm.ISolutionCandidateIterator<I,O>,org.api4.java.common.control.ICancelable,org.api4.java.common.control.ILoggingCustomizable
- Direct Known Subclasses:
AOptimizer,AReducingSolutionIterator
public abstract class ASolutionCandidateIterator<I,O> extends AAlgorithm<I,O> implements org.api4.java.algorithm.ISolutionCandidateIterator<I,O>
A template for algorithms that iterate over solution candidates. By default, if this algorithm is called, it returns the first solution it finds.
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedASolutionCandidateIterator(IOwnerBasedAlgorithmConfig config, I input)ASolutionCandidateIterator(I input)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Ocall()java.util.List<O>collectAllSolutions()Gathers all solutions that existOnextSolutionCandidate()org.api4.java.algorithm.events.result.ISolutionCandidateFoundEvent<O>nextSolutionCandidateEvent()-
Methods inherited from class ai.libs.jaicore.basic.algorithm.AAlgorithm
activate, announceTimeoutDetected, avoidReinterruptionOnShutdownOnCurrentThread, cancel, checkAndConductTermination, checkTermination, computeTimeoutAware, getActivationTime, getConfig, getId, getInput, getListeners, getLoggerName, getNumCPUs, getRemainingTimeToDeadline, getState, getTimeout, getTimeoutPrecautionOffset, hasNext, hasThreadBeenInterruptedDuringShutdown, interruptThreadAsPartOfShutdown, isCanceled, isShutdownInitialized, isStopCriterionSatisfied, isTimeouted, iterator, next, post, registerActiveThread, registerListener, resolveShutdownInterruptOnCurrentThread, setConfig, setDeadline, setLoggerName, setMaxNumThreads, setNumCPUs, setState, setTimeout, setTimeout, setTimeoutPrecautionOffset, shutdown, terminate, unregisterActiveThread, unregisterThreadAndShutdown
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
-
-
Constructor Detail
-
ASolutionCandidateIterator
public ASolutionCandidateIterator(I input)
-
ASolutionCandidateIterator
protected ASolutionCandidateIterator(IOwnerBasedAlgorithmConfig config, I input)
-
-
Method Detail
-
nextSolutionCandidate
public O nextSolutionCandidate() throws java.lang.InterruptedException, org.api4.java.algorithm.exceptions.AlgorithmExecutionCanceledException, org.api4.java.algorithm.exceptions.AlgorithmTimeoutedException, org.api4.java.algorithm.exceptions.AlgorithmException
- Specified by:
nextSolutionCandidatein interfaceorg.api4.java.algorithm.ISolutionCandidateIterator<I,O>- Throws:
java.lang.InterruptedExceptionorg.api4.java.algorithm.exceptions.AlgorithmExecutionCanceledExceptionorg.api4.java.algorithm.exceptions.AlgorithmTimeoutedExceptionorg.api4.java.algorithm.exceptions.AlgorithmException
-
nextSolutionCandidateEvent
public org.api4.java.algorithm.events.result.ISolutionCandidateFoundEvent<O> nextSolutionCandidateEvent() throws java.lang.InterruptedException, org.api4.java.algorithm.exceptions.AlgorithmExecutionCanceledException, org.api4.java.algorithm.exceptions.AlgorithmTimeoutedException, org.api4.java.algorithm.exceptions.AlgorithmException
- Specified by:
nextSolutionCandidateEventin interfaceorg.api4.java.algorithm.ISolutionCandidateIterator<I,O>- Throws:
java.lang.InterruptedExceptionorg.api4.java.algorithm.exceptions.AlgorithmExecutionCanceledExceptionorg.api4.java.algorithm.exceptions.AlgorithmTimeoutedExceptionorg.api4.java.algorithm.exceptions.AlgorithmException
-
call
public O call() throws java.lang.InterruptedException, org.api4.java.algorithm.exceptions.AlgorithmExecutionCanceledException, org.api4.java.algorithm.exceptions.AlgorithmTimeoutedException, org.api4.java.algorithm.exceptions.AlgorithmException
- Specified by:
callin interfacejava.util.concurrent.Callable<I>- Specified by:
callin interfaceorg.api4.java.algorithm.IAlgorithm<I,O>- Throws:
java.lang.InterruptedExceptionorg.api4.java.algorithm.exceptions.AlgorithmExecutionCanceledExceptionorg.api4.java.algorithm.exceptions.AlgorithmTimeoutedExceptionorg.api4.java.algorithm.exceptions.AlgorithmException
-
collectAllSolutions
public java.util.List<O> collectAllSolutions() throws java.lang.InterruptedException, org.api4.java.algorithm.exceptions.AlgorithmExecutionCanceledException, java.util.concurrent.TimeoutException, org.api4.java.algorithm.exceptions.AlgorithmException
Gathers all solutions that exist- Returns:
- Throws:
java.lang.InterruptedExceptionorg.api4.java.algorithm.exceptions.AlgorithmExecutionCanceledExceptionjava.util.concurrent.TimeoutExceptionorg.api4.java.algorithm.exceptions.AlgorithmException
-
-