Package dev.nm.misc.algorithm
Class BruteForce<D,R>
- java.lang.Object
-
- dev.nm.misc.algorithm.BruteForce<D,R>
-
- Type Parameters:
D
- the domain typeR
- the result type
public class BruteForce<D,R> extends Object
A brute force algorithm, or brute-force search or exhaustive search, also known as generate and test, is a very general problem-solving technique that consists of systematically enumerating all possible candidates for the solution and checking whether each candidate satisfies the problem's statement. In addition, it allows a quick scan of the search space before further refined investigation.- See Also:
- Wikipedia: Brute-force search
-
-
Constructor Summary
Constructors Constructor Description BruteForce(Function<D,R> function)
Constructs a brute force search for a function.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description List<R>
getResults(List<D> domain)
Runs in parallel the brute force algorithm on the function for a given domain.List<R>
getResultsSerially(List<D> domain)
Deprecated.
-
-
-
Method Detail
-
getResults
public List<R> getResults(List<D> domain)
Runs in parallel the brute force algorithm on the function for a given domain.- Parameters:
domain
- a domain- Returns:
- the results of applying the domains to the function
-
getResultsSerially
@Deprecated public List<R> getResultsSerially(List<D> domain)
Deprecated.Runs serially the brute force algorithm on the function for a given domain. This function is mainly for testing and debugging. Otherwise, use getResults(java.util.List).- Parameters:
domain
- a domain- Returns:
- the results of applying the domains to the function
-
-