File: MISER.html

package info (click to toggle)
gsl-ref-html 2.3-1
  • links: PTS
  • area: non-free
  • in suites: bullseye, buster, sid
  • size: 6,876 kB
  • ctags: 4,574
  • sloc: makefile: 35
file content (252 lines) | stat: -rw-r--r-- 12,685 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<!-- Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016 The GSL Team.

Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3 or
any later version published by the Free Software Foundation; with the
Invariant Sections being "GNU General Public License" and "Free Software
Needs Free Documentation", the Front-Cover text being "A GNU Manual",
and with the Back-Cover Text being (a) (see below). A copy of the
license is included in the section entitled "GNU Free Documentation
License".

(a) The Back-Cover Text is: "You have the freedom to copy and modify this
GNU Manual." -->
<!-- Created by GNU Texinfo 5.1, http://www.gnu.org/software/texinfo/ -->
<head>
<title>GNU Scientific Library &ndash; Reference Manual: MISER</title>

<meta name="description" content="GNU Scientific Library &ndash; Reference Manual: MISER">
<meta name="keywords" content="GNU Scientific Library &ndash; Reference Manual: MISER">
<meta name="resource-type" content="document">
<meta name="distribution" content="global">
<meta name="Generator" content="makeinfo">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link href="index.html#Top" rel="start" title="Top">
<link href="Function-Index.html#Function-Index" rel="index" title="Function Index">
<link href="Monte-Carlo-Integration.html#Monte-Carlo-Integration" rel="up" title="Monte Carlo Integration">
<link href="VEGAS.html#VEGAS" rel="next" title="VEGAS">
<link href="PLAIN-Monte-Carlo.html#PLAIN-Monte-Carlo" rel="previous" title="PLAIN Monte Carlo">
<style type="text/css">
<!--
a.summary-letter {text-decoration: none}
blockquote.smallquotation {font-size: smaller}
div.display {margin-left: 3.2em}
div.example {margin-left: 3.2em}
div.indentedblock {margin-left: 3.2em}
div.lisp {margin-left: 3.2em}
div.smalldisplay {margin-left: 3.2em}
div.smallexample {margin-left: 3.2em}
div.smallindentedblock {margin-left: 3.2em; font-size: smaller}
div.smalllisp {margin-left: 3.2em}
kbd {font-style:oblique}
pre.display {font-family: inherit}
pre.format {font-family: inherit}
pre.menu-comment {font-family: serif}
pre.menu-preformatted {font-family: serif}
pre.smalldisplay {font-family: inherit; font-size: smaller}
pre.smallexample {font-size: smaller}
pre.smallformat {font-family: inherit; font-size: smaller}
pre.smalllisp {font-size: smaller}
span.nocodebreak {white-space:nowrap}
span.nolinebreak {white-space:nowrap}
span.roman {font-family:serif; font-weight:normal}
span.sansserif {font-family:sans-serif; font-weight:normal}
ul.no-bullet {list-style: none}
-->
</style>


</head>

<body lang="en" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000">
<a name="MISER"></a>
<div class="header">
<p>
Next: <a href="VEGAS.html#VEGAS" accesskey="n" rel="next">VEGAS</a>, Previous: <a href="PLAIN-Monte-Carlo.html#PLAIN-Monte-Carlo" accesskey="p" rel="previous">PLAIN Monte Carlo</a>, Up: <a href="Monte-Carlo-Integration.html#Monte-Carlo-Integration" accesskey="u" rel="up">Monte Carlo Integration</a> &nbsp; [<a href="Function-Index.html#Function-Index" title="Index" rel="index">Index</a>]</p>
</div>
<hr>
<a name="MISER-1"></a>
<h3 class="section">25.3 MISER</h3>
<a name="index-MISER-monte-carlo-integration"></a>
<a name="index-recursive-stratified-sampling_002c-MISER"></a>

<p>The <small>MISER</small> algorithm of Press and Farrar is based on recursive
stratified sampling.  This technique aims to reduce the overall
integration error by concentrating integration points in the regions of
highest variance.
</p>
<p>The idea of stratified sampling begins with the observation that for two
disjoint regions <em>a</em> and <em>b</em> with Monte Carlo estimates of the
integral <em>E_a(f)</em> and <em>E_b(f)</em> and variances
<em>\sigma_a^2(f)</em> and <em>\sigma_b^2(f)</em>, the variance
<em>\Var(f)</em> of the combined estimate 
<em>E(f) = (1/2) (E_a(f) + E_b(f))</em> 
is given by,
</p>
<div class="example">
<pre class="example">\Var(f) = (\sigma_a^2(f) / 4 N_a) + (\sigma_b^2(f) / 4 N_b).
</pre></div>

<p>It can be shown that this variance is minimized by distributing the
points such that,
</p>
<div class="example">
<pre class="example">N_a / (N_a + N_b) = \sigma_a / (\sigma_a + \sigma_b).
</pre></div>

<p>Hence the smallest error estimate is obtained by allocating sample
points in proportion to the standard deviation of the function in each
sub-region.
</p>
<p>The <small>MISER</small> algorithm proceeds by bisecting the integration region
along one coordinate axis to give two sub-regions at each step.  The
direction is chosen by examining all <em>d</em> possible bisections and
selecting the one which will minimize the combined variance of the two
sub-regions.  The variance in the sub-regions is estimated by sampling
with a fraction of the total number of points available to the current
step.  The same procedure is then repeated recursively for each of the
two half-spaces from the best bisection. The remaining sample points are
allocated to the sub-regions using the formula for <em>N_a</em> and
<em>N_b</em>.  This recursive allocation of integration points continues
down to a user-specified depth where each sub-region is integrated using
a plain Monte Carlo estimate.  These individual values and their error
estimates are then combined upwards to give an overall result and an
estimate of its error.
</p>
<p>The functions described in this section are declared in the header file
<samp>gsl_monte_miser.h</samp>.
</p>
<dl>
<dt><a name="index-gsl_005fmonte_005fmiser_005falloc"></a>Function: <em>gsl_monte_miser_state *</em> <strong>gsl_monte_miser_alloc</strong> <em>(size_t <var>dim</var>)</em></dt>
<dd><a name="index-gsl_005fmonte_005fmiser_005fstate"></a>
<p>This function allocates and initializes a workspace for Monte Carlo
integration in <var>dim</var> dimensions.  The workspace is used to maintain
the state of the integration.
</p></dd></dl>

<dl>
<dt><a name="index-gsl_005fmonte_005fmiser_005finit"></a>Function: <em>int</em> <strong>gsl_monte_miser_init</strong> <em>(gsl_monte_miser_state* <var>s</var>)</em></dt>
<dd><p>This function initializes a previously allocated integration state.
This allows an existing workspace to be reused for different
integrations.
</p></dd></dl>

<dl>
<dt><a name="index-gsl_005fmonte_005fmiser_005fintegrate"></a>Function: <em>int</em> <strong>gsl_monte_miser_integrate</strong> <em>(gsl_monte_function * <var>f</var>, const double <var>xl</var>[], const double <var>xu</var>[], size_t <var>dim</var>, size_t <var>calls</var>, gsl_rng * <var>r</var>, gsl_monte_miser_state * <var>s</var>, double * <var>result</var>, double * <var>abserr</var>)</em></dt>
<dd><p>This routines uses the <small>MISER</small> Monte Carlo algorithm to integrate the
function <var>f</var> over the <var>dim</var>-dimensional hypercubic region
defined by the lower and upper limits in the arrays <var>xl</var> and
<var>xu</var>, each of size <var>dim</var>.  The integration uses a fixed number
of function calls <var>calls</var>, and obtains random sampling points using
the random number generator <var>r</var>. A previously allocated workspace
<var>s</var> must be supplied.  The result of the integration is returned in
<var>result</var>, with an estimated absolute error <var>abserr</var>.
</p></dd></dl>

<dl>
<dt><a name="index-gsl_005fmonte_005fmiser_005ffree"></a>Function: <em>void</em> <strong>gsl_monte_miser_free</strong> <em>(gsl_monte_miser_state * <var>s</var>) </em></dt>
<dd><p>This function frees the memory associated with the integrator state
<var>s</var>.
</p></dd></dl>

<p>The <small>MISER</small> algorithm has several configurable parameters which can
be changed using the following two functions.<a name="DOCF13" href="#FOOT13"><sup>13</sup></a>
</p>
<dl>
<dt><a name="index-gsl_005fmonte_005fmiser_005fparams_005fget"></a>Function: <em>void</em> <strong>gsl_monte_miser_params_get</strong> <em>(const gsl_monte_miser_state * <var>s</var>, gsl_monte_miser_params * <var>params</var>) </em></dt>
<dd><p>This function copies the parameters of the integrator state into the
user-supplied <var>params</var> structure.
</p></dd></dl>

<dl>
<dt><a name="index-gsl_005fmonte_005fmiser_005fparams_005fset"></a>Function: <em>void</em> <strong>gsl_monte_miser_params_set</strong> <em>(gsl_monte_miser_state * <var>s</var>, const gsl_monte_miser_params * <var>params</var>) </em></dt>
<dd><p>This function sets the integrator parameters based on values provided
in the <var>params</var> structure.
</p></dd></dl>

<p>Typically the values of the parameters are first read using
<code>gsl_monte_miser_params_get</code>, the necessary changes are made to
the fields of the <var>params</var> structure, and the values are copied
back into the integrator state using
<code>gsl_monte_miser_params_set</code>.  The functions use the
<code>gsl_monte_miser_params</code> structure which contains the following
fields:
</p>
<dl>
<dt><a name="index-estimate_005ffrac"></a>Variable: <em>double</em> <strong>estimate_frac</strong></dt>
<dd><p>This parameter specifies the fraction of the currently available number of
function calls which are allocated to estimating the variance at each
recursive step. The default value is 0.1.
</p></dd></dl>

<dl>
<dt><a name="index-min_005fcalls"></a>Variable: <em>size_t</em> <strong>min_calls</strong></dt>
<dd><p>This parameter specifies the minimum number of function calls required
for each estimate of the variance. If the number of function calls
allocated to the estimate using <var>estimate_frac</var> falls below
<var>min_calls</var> then <var>min_calls</var> are used instead.  This ensures
that each estimate maintains a reasonable level of accuracy.  The
default value of <var>min_calls</var> is <code>16 * dim</code>.
</p></dd></dl>

<dl>
<dt><a name="index-min_005fcalls_005fper_005fbisection"></a>Variable: <em>size_t</em> <strong>min_calls_per_bisection</strong></dt>
<dd><p>This parameter specifies the minimum number of function calls required
to proceed with a bisection step.  When a recursive step has fewer calls
available than <var>min_calls_per_bisection</var> it performs a plain Monte
Carlo estimate of the current sub-region and terminates its branch of
the recursion.  The default value of this parameter is <code>32 *
min_calls</code>.
</p></dd></dl>

<dl>
<dt><a name="index-alpha"></a>Variable: <em>double</em> <strong>alpha</strong></dt>
<dd><p>This parameter controls how the estimated variances for the two
sub-regions of a bisection are combined when allocating points.  With
recursive sampling the overall variance should scale better than
<em>1/N</em>, since the values from the sub-regions will be obtained using
a procedure which explicitly minimizes their variance.  To accommodate
this behavior the <small>MISER</small> algorithm allows the total variance to
depend on a scaling parameter <em>\alpha</em>,
</p>
<div class="example">
<pre class="example">\Var(f) = {\sigma_a \over N_a^\alpha} + {\sigma_b \over N_b^\alpha}.
</pre></div>

<p>The authors of the original paper describing <small>MISER</small> recommend the
value <em>\alpha = 2</em> as a good choice, obtained from numerical
experiments, and this is used as the default value in this
implementation.
</p></dd></dl>

<dl>
<dt><a name="index-dither"></a>Variable: <em>double</em> <strong>dither</strong></dt>
<dd><p>This parameter introduces a random fractional variation of size
<var>dither</var> into each bisection, which can be used to break the
symmetry of integrands which are concentrated near the exact center of
the hypercubic integration region.  The default value of dither is zero,
so no variation is introduced. If needed, a typical value of
<var>dither</var> is 0.1.
</p></dd></dl>

<div class="footnote">
<hr>
<h4 class="footnotes-heading">Footnotes</h4>

<h3><a name="FOOT13" href="#DOCF13">(13)</a></h3>
<p>The previous
method of accessing these fields directly through the
<code>gsl_monte_miser_state</code> struct is now deprecated.</p>
</div>
<hr>
<div class="header">
<p>
Next: <a href="VEGAS.html#VEGAS" accesskey="n" rel="next">VEGAS</a>, Previous: <a href="PLAIN-Monte-Carlo.html#PLAIN-Monte-Carlo" accesskey="p" rel="previous">PLAIN Monte Carlo</a>, Up: <a href="Monte-Carlo-Integration.html#Monte-Carlo-Integration" accesskey="u" rel="up">Monte Carlo Integration</a> &nbsp; [<a href="Function-Index.html#Function-Index" title="Index" rel="index">Index</a>]</p>
</div>



</body>
</html>