Liking cljdoc? Tell your friends :D

sicmutils.numerical.unimin.golden


best-ofclj/s

(best-of & pairs)

Default selection function for the best possible point. This function chooses the point out of (a, l, r, b) with the minimum function value.

Default selection function for the best possible point. This function chooses
the point out of (a, l, r, b) with the minimum function value.
sourceraw docstring

convergence-fnclj/s

(convergence-fn {:keys [converged? fn-tolerance arg-tolerance]})

Returns a fn that returns true if any of the following are true:

  • the max interior value is within fn-tolerance of the smallest bound,
  • convergence? (if supplied) returns true
  • the bounds are within arg-tolerance absolute distance,

false otherwise.

Returns a fn that returns true if any of the following are true:

- the max interior value is within `fn-tolerance` of the smallest bound,
- `convergence?` (if supplied) returns true
- the bounds are within `arg-tolerance` absolute distance,

false otherwise.
sourceraw docstring

extend-ptclj/s

(extend-pt x away-from)

generate a new point by extending x away from away-from. The invariant is that x sits between the new point and away-from at the golden ratio point.

generate a new point by extending x away from `away-from`. The invariant is
that `x` sits between the new point and `away-from` at the golden ratio
point.
sourceraw docstring

golden-cutclj/s

(golden-cut from to)

Returns the point between from and to that cuts the region between the two into two sections in golden-ratioed proportion to each other.

For example, depending on the ordering of from and to, x would be either:

from------x1---to

to---x2------from

Such that from->x1 / from->to == to->x2 / from->x1.

Returns the point between `from` and `to` that cuts the region between the two
into two sections in golden-ratioed proportion to each other.

For example, depending on the ordering of `from` and `to`, `x` would be
either:

`from------x1---to`

`to---x2------from`

Such that `from->x1 / from->to == to->x2 / from->x1`.
sourceraw docstring

golden-section-maxclj/s

(golden-section-max f xa xb)
(golden-section-max f xa xb opts)

For convenience, we also provide the sister-procedure for finding the maximum of a unimodal function using the golden section method.

Negate the function, minimize, negate the result.

For convenience, we also provide the sister-procedure for finding
the maximum of a unimodal function using the golden section method.

Negate the function, minimize, negate the result.
sourceraw docstring

golden-section-minclj/s

(golden-section-min f xa xb)
(golden-section-min f
                    xa
                    xb
                    {:keys [choose callback]
                     :or {choose best-of callback (constantly nil)}
                     :as opts})

Golden Section search attempts to locate the minimum of the supplied function f by evaluating points located at golden-ratioed intervals between the two starting endpoints a and b. This method is slow, steady and reliable.

Supports the following optional keyword arguments:

:converged? is an optional predicate accepting five arguments:

[a fa] [l fl] [r fr] [b fb] current-iteration

If the supplied fn returns true, it will signal convergence and the optimizer will return. Returning false will continue.

:choose is called at the final step of optimization with all 4 points and their fn values (see the first four arguments to :converged?), and returns the final choice.

:callback receives all 5 arguments on every iteration.

:maxiter Maximum number of iterations allowed for the minimizer. Defaults to 1000.

:maxfun Maximum number of times the function can be evaluated before exiting. Defaults to 1000.

:fn-tolerance check that the minimal value of any of the checked points is within the maximum of f(a) or f(b).

:arg-tolerance check that a and b are within this supplied absolute distance.

Golden Section search attempts to locate the minimum of the supplied function
`f` by evaluating points located at golden-ratioed intervals between the two
starting endpoints `a` and `b`. This method is slow, steady and reliable.

Supports the following optional keyword arguments:

`:converged?` is an optional predicate accepting five arguments:

`[a fa]`
`[l fl]`
`[r fr]`
`[b fb]`
`current-iteration`

If the supplied `fn` returns true, it will signal convergence and the
optimizer will return. Returning false will continue.

`:choose` is called at the final step of optimization with all 4 points and
their fn values (see the first four arguments to `:converged?`), and returns
the final choice.

`:callback` receives all 5 arguments on every iteration.

`:maxiter` Maximum number of iterations allowed for the minimizer. Defaults to
1000.

`:maxfun` Maximum number of times the function can be evaluated before exiting.
Defaults to 1000.

`:fn-tolerance` check that the minimal value of any of the checked points is
within the maximum of f(a) or f(b).

`:arg-tolerance` check that `a` and `b` are within this supplied absolute
distance.
sourceraw docstring

inv-phiclj/s

source

inv-phi2clj/s

source

phiclj/s

source

stop-fnclj/s

(stop-fn {:keys [maxiter maxfun fn-counter]})

Returns a fn that returns true if any of the following are true::

  • the supplied fn-counter atom contains a value > maxfun
  • the loop has exceeded maxiter iterations

false otherwise.

Returns a fn that returns true if any of the following are true::

- the supplied `fn-counter` atom contains a value > `maxfun`
- the loop has exceeded `maxiter` iterations

false otherwise.
sourceraw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close