Class IterativeDeepening

  • All Implemented Interfaces:
    IAdversarialSearch

    public class IterativeDeepening
    extends java.lang.Object
    implements IAdversarialSearch
    This class implements IAdversarialSearch and defines the Iterative Deepening Minimax algorithm with alpha-beta pruning.
    Author:
    Alessandro Buldini, Alessandro Pomponio, Federico Zanini
    See Also:
    AIMA Java
    • Constructor Detail

      • IterativeDeepening

        public IterativeDeepening​(TablutGame game,
                                  int utilMin,
                                  int utilMax,
                                  int time)
        Creates an IterativeDeepening instance for a TablutGame with a given timeout and utility values.
        Parameters:
        game - instance of the TablutGame class
        utilMin - minimum value the heuristic function can reach
        utilMax - maximum value the heuristic function can reach
        time - timeout for the search strategy
    • Method Detail

      • makeDecision

        public IAction makeDecision​(IState state)
        Returns the action which appears to be the best at the given state
        Specified by:
        makeDecision in interface IAdversarialSearch
        Parameters:
        state - state of the game on which the decision should be made
        Returns:
        the best action to perform for the input state
        See Also:
        IState
      • setGameState

        public void setGameState​(IState state)
        Sets the game state to the value passed as input
        Parameters:
        state - state to be set within the IterativeDeepening class
        See Also:
        IState
      • getUtilMin

        public int getUtilMin()
        Returns the minimum value the heuristic function can reach
        Returns:
        the minimum value the heuristic function can reach
      • getUtilMax

        public int getUtilMax()
        Returns the maximum value the heuristic function can reach
        Returns:
        the maximum value the heuristic function can reach
      • getCurrDepthLimit

        public int getCurrDepthLimit()
        Returns the current depth limit reached by the search
        Returns:
        the current depth limit reached by the search
      • getMetrics

        public Metrics getMetrics()
        Returns the metrics object set within the class
        Specified by:
        getMetrics in interface IAdversarialSearch
        Returns:
        the metrics object set within the class
      • updateMetrics

        public void updateMetrics​(int depth)
        Given a depth value, updates the metrics object set within the class
        Parameters:
        depth - depth reached at the current state of the search