Safe Haskell | None |
---|---|
Language | Haskell2010 |
Subdivision contains an implementation of the branch-and-bound algorithm. This method divides interval-like values into smaller subdivisions and then applies a function to those values. This results in a more accurate output at the cost of having to repeat the calculations multiple times
Synopsis
- class Subdivisible a where
- data SubdivisionEnvironment a b e = SubdivisionEnvironment {}
- defaultEnvironment :: Fractional e => (a -> b) -> (b -> e) -> SubdivisionEnvironment a b e
- branchAndBound :: (Subdivisible a, Subdivisible b, Ord e) => a -> SubdivisionEnvironment a b e -> b
Documentation
class Subdivisible a where Source #
The Subdivisible
class is used for datatypes that can be broken down into smaller pieces
and combined together
The subdivide
function subdivides the value into n
smaller values and combine
joins
the subdivisions together into a bigger value
Subdividing and then combining a value is expected to give the initial value (sans rounding errors)
Instances
Subdivisible a => Subdivisible [a] Source # | |
(Ord a, Fractional a) => Subdivisible (Interval a) Source # | |
(Ord a, Fractional a, ExplicitRounding a) => Subdivisible (AF s a) Source # | |
data SubdivisionEnvironment a b e Source #
A data structure for configuring the branchAndBound
method
function
is the function that gets evaluated
errorFun
is the error measuring function of the result
maxError
specifies the maximum permitted error of an evaluation
maxDepth
specifies how deep the subdivision can go
subdivs
specifies the number of subdivisions per value
defaultEnvironment :: Fractional e => (a -> b) -> (b -> e) -> SubdivisionEnvironment a b e Source #
This function creates a simple subdivision configuration. It requires the evaluator function and an error measuring function as its parameters.
branchAndBound :: (Subdivisible a, Subdivisible b, Ord e) => a -> SubdivisionEnvironment a b e -> b Source #
This function iteratively subdivides a value to arrive at a more accurate result