AI-SimulatedAnnealing
view release on metacpan or search on metacpan
t/annealing_tests.t view on Meta::CPAN
say "\nHere are a, b, and c: " . $abc->[0] . ", "
. $abc->[1] . ", " . $abc->[2];
# Helper functions:
# The cost_function_factory() takes a reference to an array containing
# real-world market distances and returns a reference to a cost function.
# The cost function takes a reference to an array of three coefficients,
# and returns the mean absolute percentage deviation of the calculated
# results from the real-world results based on this formula:
#
# (a * sqrt(x + b)) + c
#
# where x is a number of trading days in the range 3 to 63.
sub cost_function_factory {
my $real_world_distances = $_[0];
my $current_coefficients;
my $calculate_distance
= sub {
( run in 0.999 second using v1.01-cache-2.11-cpan-3cd7ad12f66 )