ParaMonte MATLAB 3.0.0
Parallel Monte Carlo and Machine Learning Library
See the latest version documentation.
getLogUDF.m
Go to the documentation of this file.
1
%> \brief
2
%> Return the natural logarithm of the Unnormalized Density Function (UDF)
3
%> of the inverse of the 2-dimensional modified Himmelblau function.<br>
4
%>
5
%> \details
6
%> Himmelblau
's function is a multi-modal function, used to test
7
%> the performance of optimization algorithms. The function is defined by:<br>
8
%> \f{equation}
9
%> H(x, y) = (x^{2} + y - 11)^{2} + (x + y^{2} - 7)^{2} ~.
10
%> \f}
11
%>
12
%> It has one local maximum at \f$x = -0.270845\f$ and \f$y = -0.923039\f$ where \f$H(x, y) = 181.617\f$,
13
%> and four identical local minima:<br>
14
%> \f{eqnarray}
15
%> H(3.0,2.0) &=& 0.0 ~,\\
16
%> H(-2.805118, 3.131312) &=& 0.0 ~,\\
17
%> H(-3.779310, -3.283186) &=& 0.0 ~,\\
18
%> H(3.584428, -1.848126) &=& 0.0 ~.
19
%> \f}
20
%>
21
%> The function is named after David Mautner Himmelblau (1924–2011), who introduced it.<br>
22
%> The locations of all the minima can be found analytically.<br>
23
%>
24
%> This MATLAB function returns a modification of the Himmelblau function as a density
25
%> function suitable for testing sampling algorithms (or stochastic maximizers):<br>
26
%> \f{equation}
27
%> f(x, y, \epsilon) = \frac{1}{H(x, y) + \epsilon} ~.
28
%> \f}
29
%> where \f$\epsilon\f$ is an arbitrary positive real number
30
%> which determines the sharpness of the function four peaks.<br>
31
%>
32
%> \param[in] x : The input scalar or array of the same rank and shape as
33
%> other input array-like arguments of type MATLAB ``double``,
34
%> representing the x-component of the state within the domain
35
%> of Himmelblau density at which the density value must be computed.<br>
36
%> \param[in] y : The input scalar or array of the same rank and shape as
37
%> other input array-like arguments of type MATLAB ``double``,
38
%> representing the y-component of the state within the domain
39
%> of Himmelblau density at which the density value must be computed.<br>
40
%> \param[in] epsilon : The input positive scalar or array of the same rank and shape as
41
%> other array-like input arguments of type MATLAB ``double``,
42
%> representing the value to be added to the inverse
43
%> of the Himmelblau function.<br>
44
%> Increasingly smaller values of ``epsilon`` will yield pointier densities.<br>
45
%> Increasingly larger values of ``epsilon`` will yield flatter densities.<br>
46
%> (**optional**, default = ``1``)
47
%>
48
%> \return
49
%> ``logUDF`` : The output Unnormalized Density Function (UDF) of the
50
%> Himmelblau density at the specified input ``state``.<br>
51
%>
52
%> \interface{getLogUDF}
53
%> \code{.m}
54
%>
55
%> logUDF = pm.stats.himmelblau.getLogUDF(state);
56
%> logUDF = pm.stats.himmelblau.getLogUDF(state, epsilon);
57
%>
58
%> \endcode
59
%>
60
%> \see
61
%> [pm.stats.himmelblau.getFunc](@ref getFunc)<br>
62
%> [pm.stats.himmelblau.getLogUDF](@ref getLogUDF)<br>
63
%> [pm.sampling.Paradram](@ref Paradram)<br>
64
%>
65
%> \example{getLogUDF}
66
%> \include{lineno} example/stats/dist/himmelblau/getLogUDF/main.m
67
%> \vis{getLogUDF}
68
%> \image html example/stats/dist/himmelblau/getLogUDF/himmelblau.getLogUDF.2d.png width=700
69
%> \image html example/stats/dist/himmelblau/getLogUDF/himmelblau.getLogUDF.3d.png width=700
70
%>
71
%> \final{getLogUDF}
72
%>
73
%> \author
74
%> \AmirShahmoradi, May 16 2016, 9:03 AM, Oden Institute for Computational Engineering and Sciences (ICES), UT Austin<br>
75
function logFunc = getLogUDF(x, y, epsilon)
76
if nargin < 3
77
epsilon = 1;
78
end
79
logFunc = -log(pm.math.func.himmelblau.getFunc(x, y) + epsilon);
80
if false
81
nsim = 100000;
82
for i = 1 : nsim
83
logFunc = logFunc - log((x^2 + y - 11)^2 + (x + y^2 - 7)^2 + 0.1);
84
end
85
logFunc = logFunc / (nsim + 1);
86
end
87
end
getLogUDF
function getLogUDF(in x, in y, in epsilon)
Return the natural logarithm of the Unnormalized Density Function (UDF) of the inverse of the 2-dimen...
src
matlab
main
+pm
+stats
+dist
+himmelblau
getLogUDF.m
Generated on Mon Dec 2 2024 10:04:17 for ParaMonte MATLAB 3.0.0 by
1.9.3