NAME
Algorithm::GoldenSection - Golden Section Search Algorithm for one-dimensional minimisation.
VERSION
This document describes Algorithm::GoldenSection version 0.0.2
DESCRIPTION
This module is an implementation of the Golden Section Search Algorithm for finding minima of a unimodal function. In order to isolate a minimum of a univariate functions the minimum must first be isolated. Consequently the program first bounds a minimum - i.e. the program initially creates a triplet of points: x_low < x_int < x_high, such that f(x_int) is lower than both f(x_low) and f(x_high). Thus we ensure that there is a local minimum within the interval: x_low-x_high. The program then uses the Golde Section Search algorithm to successively narrow down on the bounded region to find the minimum. See http://en.wikipedia.org/wiki/Golden_section_search and http://www.gnu.org/software/gsl/manual/html_node/One-dimensional-Minimization.html.
The module provides a Perl5OO interface. Simply construct a Algorithm::GoldenSection object with appropriate parameters - see "SYNOPSIS". Then call the minimise method
. This returns a LIST of the value of x at the minimum, the value of f(x) at the minimum and the number of iterations used to isolate the minimum.
SYNOPSIS
use Algorithm::GoldenSection;
# Create a Algorithm::GoldenSection object and pass it a CODE reference to the function to be minimised and initials values for x_low and x_int.
$gs = Algorithm::GoldenSection->new( { function => sub { my $x = shift; my $b = $x * sin($x) - 2 * cos($x); return $b },
x_low => 4,
x_int => 4.7,} ) ;
# Call minimisation method to bracket and minimise.
my ($x_min, $f_min, $iterations) = $gs->minimise;
print qq{\nMinimisation results: x a minimum = $x_min, function value at minimum = $f_min. Calculation took $iterations iterations};
DEPENDENCIES
Carp => "1.08", Readonly => "1.03",
AUTHOR
Daniel S. T. Hughes <dsth@cantab.net>
SEE ALSO
LICENCE AND COPYRIGHT
Copyright (c) 2010, Daniel S. T. Hughes <dsth@cantab.net>
. All rights reserved.
This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See perlartistic.
DISCLAIMER OF WARRANTY
Because this software is licensed free of charge, there is no warranty for the software, to the extent permitted by applicable law. Except when otherwise stated in writing the copyright holders and/or other parties provide the software "as is" without warranty of any kind, either expressed or implied, including, but not limited to, the implied warranties of merchantability and fitness for a particular purpose. The entire risk as to the quality and performance of the software is with you. Should the software prove defective, you assume the cost of all necessary servicing, repair, or correction.
In no event unless required by applicable law or agreed to in writing will any copyright holder, or any other party who may modify and/or redistribute the software as permitted by the above licence, be liable to you for damages, including any general, special, incidental, or consequential damages arising out of the use or inability to use the software (including but not limited to loss of data or data being rendered inaccurate or losses sustained by you or third parties or a failure of the software to operate with any other software), even if such holder or other party has been advised of the possibility of such damages.