A recursive golden section search requiring only one functional evaluation per call.
A recursive golden section search requiring only one functional evaluation per call. It works by comparing two center points x2 (given) and x4 computed.
whether to search left (true) or right (false) side of last interval
the left-most point
the center point (.618 across for left and .382 across for right)
the right-most point
the functional value for the x2 center point
Print the golden ratio and the golden section.
Perform a Line Search (LS) using the Golden Search Algorithm.
Perform a Line Search (LS) using the Golden Search Algorithm. Two phases are used: an expansion phase (moving the endpoint) to find a down-up pattern, followed by a traditional golden section search.
a rough guess for the right endpoint of the line search
the left (smallest) anchor point for the search (usually 0)
This class performs a line search on f(x) to find a maximal value for f. It requires no derivatives and only one functional evaluation per iteration. A search is conducted from x1 (often 0) to xmax. A guess for xmax must be given, but can be made larger during the expansion phase, that occurs before the recursive golden section search is called. It works on scalar functions (see GoldenSectionLSTest). If starting with a vector function f(x), simply define a new function g(y) = x0 + direction * y (see GoldenSectionLSTest2).