Class TwoPhaseHASCO<S extends ai.libs.jaicore.search.probleminputs.GraphSearchWithPathEvaluationsInput<N,A,java.lang.Double>,N,A>
- java.lang.Object
-
- ai.libs.jaicore.basic.algorithm.AAlgorithm<I,O>
-
- ai.libs.jaicore.basic.algorithm.ASolutionCandidateIterator<I,O>
-
- ai.libs.jaicore.basic.algorithm.AOptimizer<P,O,V>
-
- ai.libs.hasco.optimizingfactory.SoftwareConfigurationAlgorithm<TwoPhaseSoftwareConfigurationProblem,HASCOSolutionCandidate<java.lang.Double>,java.lang.Double>
-
- ai.libs.hasco.variants.forwarddecomposition.twophase.TwoPhaseHASCO<S,N,A>
-
- All Implemented Interfaces:
java.lang.Iterable<org.api4.java.algorithm.events.IAlgorithmEvent>
,java.util.concurrent.Callable<HASCOSolutionCandidate<java.lang.Double>>
,java.util.Iterator<org.api4.java.algorithm.events.IAlgorithmEvent>
,org.api4.java.algorithm.IAlgorithm<TwoPhaseSoftwareConfigurationProblem,HASCOSolutionCandidate<java.lang.Double>>
,org.api4.java.algorithm.IOptimizationAlgorithm<TwoPhaseSoftwareConfigurationProblem,HASCOSolutionCandidate<java.lang.Double>,java.lang.Double>
,org.api4.java.algorithm.ISolutionCandidateIterator<TwoPhaseSoftwareConfigurationProblem,HASCOSolutionCandidate<java.lang.Double>>
,org.api4.java.common.control.ICancelable
,org.api4.java.common.control.ILoggingCustomizable
public class TwoPhaseHASCO<S extends ai.libs.jaicore.search.probleminputs.GraphSearchWithPathEvaluationsInput<N,A,java.lang.Double>,N,A> extends SoftwareConfigurationAlgorithm<TwoPhaseSoftwareConfigurationProblem,HASCOSolutionCandidate<java.lang.Double>,java.lang.Double>
-
-
Constructor Summary
Constructors Constructor Description TwoPhaseHASCO(TwoPhaseSoftwareConfigurationProblem problem, TwoPhaseHASCOConfig config)
TwoPhaseHASCO(TwoPhaseSoftwareConfigurationProblem problem, TwoPhaseHASCOConfig config, HASCO<S,N,A,java.lang.Double> hasco)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
cancel()
TwoPhaseHASCOConfig
getConfig()
int
getExpectedRuntimeForPhase2ForAGivenPool(java.util.Collection<HASCOSolutionCandidate<java.lang.Double>> solutions)
int
getExpectedTotalRemainingRuntimeForAGivenPool(java.util.Collection<HASCOSolutionCandidate<java.lang.Double>> solutions, boolean assumeCurrentlyBestCandidateToBeSelected)
org.api4.java.ai.graphsearch.problem.IPathSearchInput<N,A>
getGraphSearchInput()
HASCO<S,N,A,java.lang.Double>
getHasco()
java.lang.String
getLoggerName()
int
getMaximumPostprocessingTimeOfAnyPoolMember(java.util.Collection<HASCOSolutionCandidate<java.lang.Double>> solutions)
int
getNumberOfConsideredSolutions()
java.util.Queue<HASCOSolutionCandidate<java.lang.Double>>
getPhase1ResultQueue()
int
getPostprocessingTimeOfCurrentlyBest()
TwoPhaseHASCOReport
getReort()
int
getSecondsSpentInPhase1()
HASCOSolutionCandidate<java.lang.Double>
getSelectedSolutionCandidate()
java.util.List<HASCOSolutionCandidate<java.lang.Double>>
getSelectionForPhase2()
java.util.Map<HASCOSolutionCandidate<java.lang.Double>,java.lang.Double>
getSelectionScoresOfCandidates()
org.api4.java.algorithm.events.IAlgorithmEvent
nextWithException()
protected HASCOSolutionCandidate<java.lang.Double>
selectModel()
void
setHasco(HASCO<S,N,A,java.lang.Double> hasco)
void
setLoggerName(java.lang.String name)
void
setNumberOfConsideredSolutions(int numberOfConsideredSolutions)
protected boolean
shouldSearchTerminate(long timeRemaining)
void
shutdown()
java.lang.String
toString()
-
Methods inherited from class ai.libs.jaicore.basic.algorithm.AOptimizer
call, getBestSeenSolution, nextSolutionCandidate, nextSolutionCandidateEvent, setBestSeenSolution, updateBestSeenSolution
-
Methods inherited from class ai.libs.jaicore.basic.algorithm.ASolutionCandidateIterator
collectAllSolutions
-
Methods inherited from class ai.libs.jaicore.basic.algorithm.AAlgorithm
activate, announceTimeoutDetected, avoidReinterruptionOnShutdownOnCurrentThread, checkAndConductTermination, checkTermination, computeTimeoutAware, getActivationTime, getId, getInput, getNumCPUs, getRemainingTimeToDeadline, getState, getTimeout, getTimeoutPrecautionOffset, hasNext, hasThreadBeenInterruptedDuringShutdown, interruptThreadAsPartOfShutdown, isCanceled, isShutdownInitialized, isStopCriterionSatisfied, isTimeouted, iterator, next, post, registerActiveThread, registerListener, resolveShutdownInterruptOnCurrentThread, setConfig, setDeadline, setMaxNumThreads, setNumCPUs, setState, setTimeout, setTimeout, setTimeoutPrecautionOffset, terminate, unregisterActiveThread, unregisterThreadAndShutdown
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
-
-
-
Constructor Detail
-
TwoPhaseHASCO
public TwoPhaseHASCO(TwoPhaseSoftwareConfigurationProblem problem, TwoPhaseHASCOConfig config)
-
TwoPhaseHASCO
public TwoPhaseHASCO(TwoPhaseSoftwareConfigurationProblem problem, TwoPhaseHASCOConfig config, HASCO<S,N,A,java.lang.Double> hasco)
-
-
Method Detail
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
nextWithException
public org.api4.java.algorithm.events.IAlgorithmEvent nextWithException() throws java.lang.InterruptedException, org.api4.java.algorithm.exceptions.AlgorithmTimeoutedException, org.api4.java.algorithm.exceptions.AlgorithmException, org.api4.java.algorithm.exceptions.AlgorithmExecutionCanceledException
- Throws:
java.lang.InterruptedException
org.api4.java.algorithm.exceptions.AlgorithmTimeoutedException
org.api4.java.algorithm.exceptions.AlgorithmException
org.api4.java.algorithm.exceptions.AlgorithmExecutionCanceledException
-
shouldSearchTerminate
protected boolean shouldSearchTerminate(long timeRemaining)
-
getSelectionForPhase2
public java.util.List<HASCOSolutionCandidate<java.lang.Double>> getSelectionForPhase2()
-
getExpectedTotalRemainingRuntimeForAGivenPool
public int getExpectedTotalRemainingRuntimeForAGivenPool(java.util.Collection<HASCOSolutionCandidate<java.lang.Double>> solutions, boolean assumeCurrentlyBestCandidateToBeSelected)
-
getPostprocessingTimeOfCurrentlyBest
public int getPostprocessingTimeOfCurrentlyBest()
-
getMaximumPostprocessingTimeOfAnyPoolMember
public int getMaximumPostprocessingTimeOfAnyPoolMember(java.util.Collection<HASCOSolutionCandidate<java.lang.Double>> solutions)
-
getExpectedRuntimeForPhase2ForAGivenPool
public int getExpectedRuntimeForPhase2ForAGivenPool(java.util.Collection<HASCOSolutionCandidate<java.lang.Double>> solutions)
-
selectModel
protected HASCOSolutionCandidate<java.lang.Double> selectModel() throws java.lang.InterruptedException
- Throws:
java.lang.InterruptedException
-
getPhase1ResultQueue
public java.util.Queue<HASCOSolutionCandidate<java.lang.Double>> getPhase1ResultQueue()
-
getSecondsSpentInPhase1
public int getSecondsSpentInPhase1()
-
getSelectionScoresOfCandidates
public java.util.Map<HASCOSolutionCandidate<java.lang.Double>,java.lang.Double> getSelectionScoresOfCandidates()
-
shutdown
public void shutdown()
- Overrides:
shutdown
in classai.libs.jaicore.basic.algorithm.AAlgorithm<TwoPhaseSoftwareConfigurationProblem,HASCOSolutionCandidate<java.lang.Double>>
-
cancel
public void cancel()
- Specified by:
cancel
in interfaceorg.api4.java.common.control.ICancelable
- Overrides:
cancel
in classai.libs.jaicore.basic.algorithm.AAlgorithm<TwoPhaseSoftwareConfigurationProblem,HASCOSolutionCandidate<java.lang.Double>>
-
getSelectedSolutionCandidate
public HASCOSolutionCandidate<java.lang.Double> getSelectedSolutionCandidate()
- Returns:
- The solution candidate selected by TwoPhase HASCO
-
getConfig
public TwoPhaseHASCOConfig getConfig()
- Specified by:
getConfig
in interfaceorg.api4.java.algorithm.IAlgorithm<S extends ai.libs.jaicore.search.probleminputs.GraphSearchWithPathEvaluationsInput<N,A,java.lang.Double>,N>
- Overrides:
getConfig
in classai.libs.jaicore.basic.algorithm.AAlgorithm<TwoPhaseSoftwareConfigurationProblem,HASCOSolutionCandidate<java.lang.Double>>
-
getNumberOfConsideredSolutions
public int getNumberOfConsideredSolutions()
- Returns:
- The number of considered solutions in the selection phase.
-
setNumberOfConsideredSolutions
public void setNumberOfConsideredSolutions(int numberOfConsideredSolutions)
- Parameters:
numberOfConsideredSolutions
- The number of considered solutions in the selection phase.
-
getGraphSearchInput
public org.api4.java.ai.graphsearch.problem.IPathSearchInput<N,A> getGraphSearchInput()
-
getReort
public TwoPhaseHASCOReport getReort()
-
getLoggerName
public java.lang.String getLoggerName()
- Specified by:
getLoggerName
in interfaceorg.api4.java.common.control.ILoggingCustomizable
- Overrides:
getLoggerName
in classai.libs.jaicore.basic.algorithm.AOptimizer<TwoPhaseSoftwareConfigurationProblem,HASCOSolutionCandidate<java.lang.Double>,java.lang.Double>
-
setLoggerName
public void setLoggerName(java.lang.String name)
- Specified by:
setLoggerName
in interfaceorg.api4.java.common.control.ILoggingCustomizable
- Overrides:
setLoggerName
in classai.libs.jaicore.basic.algorithm.AOptimizer<TwoPhaseSoftwareConfigurationProblem,HASCOSolutionCandidate<java.lang.Double>,java.lang.Double>
-
-