# SuanShu, a Java numerical and statistical library

com.numericalmethod.suanshu.misc.algorithm

## Class BruteForce<D,R>

• Type Parameters:
D - the domain type
R - 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.
Wikipedia: Brute-force search
• ### Constructor Summary

Constructors
Constructor and Description
BruteForce(Function<D,R> function)
Constructs a brute force search for a function.
• ### Method Summary

All Methods
Modifier and Type Method and 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.
• ### Methods inherited from class java.lang.Object

clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
• ### Constructor Detail

• #### BruteForce

public BruteForce(Function<D,R> function)
Constructs a brute force search for a function.
Parameters:
function - a function
• ### 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