NAME
    Simulation::Sensitivity - A general-purpose sensitivity analysis tool
    for user-supplied calculations and parameters

SYNOPSIS
     use Simulation::Sensitivity;
     $sim = Simulation::Sensitiviy->new(
        calculation => sub { my $p = shift; return $p->{alpha} + $p->{beta} }
        parameters  => { alpha => 1.1, beta => 0.2 },
        delta       => 0.1 );
     $result = $sim->run;
     print $sim->text_report($result);

DESCRIPTION
    Simulation::Sensitivity is a general-purpose sensitivity analysis tool.
    Given a user-written calculating function, a "base-case" of parameters,
    and a requested input sensitivity delta, this module will carry out a
    sensitivity analysis, capturing the output of the calculating function
    while varying each parameter positively and negatively by the specified
    delta. The module also produces a simple text report showing the
    percentage impact of each parameter upon the output.

    The user-written calculating function must follow a standard form, but
    may make any type of computations so long as the form is satisfied. It
    must take a single argument -- a hash reference of parameters for use in
    the calculation. It must return a single, numerical result.

CONSTRUCTORS
  "new"
     my $sim = Simulation::Sensitivity->new(
        calculation => sub { my $p = shift; return $p->{alpha} + $p->{beta} }
        parameters  => { alpha => 1.1, beta => 0.2 },
        delta       => 0.1 );

    "new" takes as its argument a hash with three required parameters.
    "calculation" must be a reference to a subroutine and is used for
    calculation. It must adhere to the usage guidelines above for such
    functions. "parameters" must be a reference to a hash that represents
    the initial starting parameters for the calculation. "delta" is a
    percentage that each parameter will be pertubed by during the analysis.
    Percentages should be expressed as a decimal (0.1 to indicate 10%).

    As a constructor, "new" returns a Simulation::Sensitivity object.

PROPERTIES
  "calculation", "parameters", "delta"
     $sim->calculation()->({alpha=1.0, beta=1.0});
     %p = %{$sim->parameters()};
     $new_delta = $sim->delta(.15);

    The parameter values in a Simulation::Sensitivity object may be
    retreived or modified using get/set accessors. With no argument, the
    accessor returns the value of the parameter. With an argument, the
    accessor sets the value to the new value and returns the new value.

METHODS
  "base"
     $base_case = base();

    This method returns the base-case result for the parameter values
    provided in the constructor.

  "run"
     $results = run();

    This method returns a hash reference containing the results of the
    sensitivity analysis. The keys of the hash are the same as the keys of
    the parameters array. The values of the hash are themselves a hash
    reference with each key representing a particular case in string form
    (e.g. "+10%" or "-10%") and the value equal to the result from the
    calculation. A simple example would be:

     {
         alpha => {
             "+25%" => 5.25,
             "-25%" => 4.75
         },
         beta => {
             "+25%" => 6,
             "-25%" => 4
         }
     }

  "text_report"
     $report = text_report( $results );

    This method generates a text string containing a simple, multi-line
    report. The only parameter is a hash reference containing a set of
    results produced with "run".

BUGS
    Please report any bugs or feature using the CPAN Request Tracker. Bugs
    can be submitted by email to "bug-Simulation-Sensitivity@rt.cpan.org" or
    through the web interface at
    <http://rt.cpan.org/Public/Dist/Display.html?Name=Simulation-Sensitivity
    >

    When submitting a bug or request, please include a test-file or a patch
    to an existing test-file that illustrates the bug or desired feature.

AUTHOR
    David A Golden (DAGOLDEN)

    dagolden@cpan.org

    <http://dagolden.com/>

COPYRIGHT
    Copyright (c) 2006 by David A Golden

    This program is free software; you can redistribute it and/or modify it
    under the same terms as Perl itself.

    The full text of the license can be found in the LICENSE file included
    with this module.

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.

