/* * File: AnytimeAlgorithm.java * Authors: Kevin R. Dixon * Company: Sandia National Laboratories * Project: Cognitive Foundry * * Copyright Dec 11, 2007, Sandia Corporation. Under the terms of Contract * DE-AC04-94AL85000, there is a non-exclusive license for use of this work by * or on behalf of the U.S. Government. Export of this program may require a * license from the United States Government. See CopyrightHistory.txt for * complete details. * */ package gov.sandia.cognition.algorithm; import gov.sandia.cognition.annotation.CodeReview; import gov.sandia.cognition.annotation.PublicationReference; import gov.sandia.cognition.annotation.PublicationType; /** * The {@code AnytimeAlgorithm} interface defines the functionality of an * iterative algorithm that is stoppable and can return intermediate results. * * @param <ResultType> The type of the result generated by the algorithm. * @author Justin Basilico * @author Kevin R. Dixon * @since 2.0 * @see IterativeAlgorithm * @see StoppableAlgorithm */ @CodeReview( reviewer="Kevin R. Dixon", date="2008-02-08", changesNeeded=false, comments="Interface looks fine." ) @PublicationReference( author="Shlomo Zilberstein", title="Using Anytime Algorithms in Intelligent Systems", type=PublicationType.Journal, publication="AI Magazine", year=1996, pages={73,83}, url="http://anytime.cs.umass.edu/~shlomo/papers/aimag96.pdf" ) public interface AnytimeAlgorithm<ResultType> extends IterativeAlgorithm, StoppableAlgorithm { /** * Gets the maximum number of total iterations before stopping. * * @return * Maximum number of total iterations before stopping. Must be greater * than zero. */ int getMaxIterations(); /** * Sets the maximum number of total iterations before stopping. * * @param maxIterations * Maximum number of iterations before stopping. Must be greater * than zero. */ void setMaxIterations( int maxIterations); /** * Gets the current result of the algorithm. * * @return Current result of the algorithm. */ ResultType getResult(); }