The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

SYNOPSIS

  use Games::Go::AGA::BayRate::GSL::Multimin;

    .  .  .

  # minimizer 'state'
  my $state = my_gsl_multimin_fminimizer_set (
      $gsl_multimin_fminimizer_nmsimplex,    # minimizer type
      # gsl_multimin_function_f structure members:
          \&my_f,     # f       callback function
          2,          # n       number of free variables
          \@params,   # params  function params passed to f
      # end of gsl_multimin_function_f structure members:
      $x->raw,    # starting point vector
      $ss->raw,   # step size
  );

    .  .  .

  gsl_multimin_fminimizer_iterate($state);

  # For full examples, see f_test.pl and fdf_test.pl in the
  #    extra/ subdirectory of this distribution.

DESCRIPTION

As of this writing, Math::GSL::Multimin is only partially implemented. No doubt this is due to the (let's be generous) difficult interface to the fminimizer and fdf_minimizer functions in the GSL library.

Games::Go::AGA::BayRate::GSL::Multimin uses Inline::C to interface to fminimizer and fdfminimizer in the GSL library. Other aspects of GSL are required, for which you must also have Math::GSL installed.

The following documentation uses names similar to the names found in the Multimin section of the GSL Reference Manual. Referring to that manual will probably make things clearer.

FUNCITONS

my_gsl_multimin_fminimizer_set

Similar to gsl_multimin_fminimizer_set as defined the the GSL library, but with the members of gsl_multimin_function passed individually instead of as members of a structure. gsl_multimin_fminimizer_alloc is called internally (which is why the type is required).

 my $state = my_gsl_multimin_fminimizer_set (
     $gsl_multimin_fminimizer_nmsimplex2,    # type
     \&my_f,    # gsl_multimin_function . f       callback function
     $count,    # gsl_multimin_function . n       number of free variables
     $params,   # gsl_multimin_function . params  function params passed to f, df, and fdf
     $x->raw,   # gsl vector
     $ss->raw); # step size

$x and $ss are assumed to be Math::GSL::Vector objects here. Use the raw method to extract the low-level GSL vectors.

my_gsl_multimin_fdfminimizer_set

Similar to gsl_multimin_fdfminimizer_set as defined the the GSL library, but with the members of gsl_multimin_function_fdf passed individually instead of as members of a structure. gsl_multimin_fminimizer_alloc is called internally (which is why the type is required).

 my $state = my_gsl_multimin_fdfminimizer_set (
     $gsl_multimin_fdfminimizer_vector_bfgs2,    # type
     \&my_f,    # gsl_multimin_function_fdf . f       function
     \&my_df,   # gsl_multimin_function_fdf . df      derivative of f
     \&my_fdf,  # gsl_multimin_function_fdf . fdf     f and df
     $count,    # gsl_multimin_function_fdf . n       number of free variables
     $params,   # gsl_multimin_function_fdf . params  function params passed to f, df, and fdf
     $x->raw,   # gsl vector
     2.0,       # step size
     0.1);      # accuracy required (tol?)

$x is assumed to be a Math::GSL::Vector object here. Use the raw method to extract the low-level GSL vector.

raw_gsl_multimin_fminimizer_fval($state)

Returns the 'fval' member of the gsl_multimin_fminimizer.

raw_gsl_multimin_fdfminimizer_f($state)

Returns the 'f' member of the gsl_multimin_fdfminimizer.

raw_gsl_multimin_fdfminimizer_gradient($state)

Returns the 'gradient' member of the gsl_multimin_fdfminimizer.

raw_gsl_vector_size($vector->raw);

Returns the 'size' member of a (raw) gsl_vector.

CALLBACKS

GSL Multimin requires callbacks. For details, see the GSL Multimin documentation. The requirements here are similar, but translated to perl. Here are the details:

my_f($x, $params);

The 'f' callback. $x is a raw gsl_vector, not a Math::GSL::Vector. $params is specified in the appropriate my_gsl_multimin_f(df)minimizer_set call.

my_df($x, $params, $df);

The 'df' callback. $x and $df are raw gsl_vectors, not Math::GSL::Vectors. $params is specified in the appropriate my_gsl_multimin_f(df)minimizer_set call.

my_fdf($x, $params, $f, $df);

The 'fdf' callback. $x and $df are raw gsl_vectors, not Math::GSL::Vectors. $f is a reference to a floating point number which should be altered by this function. $params is specified in the appropriate my_gsl_multimin_f(df)minimizer_set call.

This definition of my_fdf is usually appropriate:

  sub my_fdf {
      my ($raw_v, $params, $f, $raw_df) = @_;

      ${$f} = my_f( $raw_v, $params );
      my_df( $raw_v, $params, $raw_df );
  }