![JAR search and dependency download from the Maven repository](/logo.png)
com.thesett.aima.search.impl.IterativeBoundAlgorithm Maven / Gradle / Ivy
Show all versions of search Show documentation
/*
* Copyright The Sett Ltd, 2005 to 2014.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.thesett.aima.search.impl;
import java.util.Collection;
import com.thesett.aima.search.SearchNode;
import com.thesett.aima.search.SearchNotExhaustiveException;
import com.thesett.aima.search.Traversable;
import com.thesett.aima.search.spi.QueueSearchState;
/**
* Implements an iterative-bound search from any queue based search method. This progressively re-runs the search at
* ever increasing bounds until a solution is found. It extends {@link BoundedAlgorithm} which implements the
* {@link com.thesett.aima.search.spi.BoundProperty} interface to provide a depth bound by default. This algorithm
* therefore defaults to being an iterative-deepening algorithm, if a different bound property extractor is not
* substituted.
*
* The algorithm can either increase the bound by a fixed amount, epsilon, at each iteration or can increase the
* bound to the next smallest bound property value that was seen beyond the bound of the previous iteration on search
* nodes just over the fringe of the search bound. The latter case only produces good search algorithms where the bound
* property can only take a small number of values. In general if search nodes have real valued heuristics that are
* mostly different for each node then this strategy will result in N^2 nodes being examined. Use the constructor that
* accepts a value for epsilon to use the fixed increase strategy, use the other constructor to use the next minimal
* bound beyond the fringe strategy.
*
*
CRC Card
* Responsibilities Collaborations
* Transform any {@link BaseQueueSearch} into an iterative deepening search.
* {@link BaseQueueSearch}
*
*
* @author Rupert Smith
*/
public class IterativeBoundAlgorithm