{"id":465997,"date":"2025-07-03T21:02:24","date_gmt":"2025-07-03T21:02:24","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=465997"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=465997","title":{"rendered":"<span>\u0412\u0441\u0451, \u0447\u0442\u043e \u043d\u0443\u0436\u043d\u043e \u0437\u043d\u0430\u0442\u044c \u043e \u0441\u0432\u043e\u0438\u0445 \u043f\u043b\u0430\u043d\u0430\u0445, \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u043e\u0441\u0442\u044f\u0445 \u0438 \u0441\u0442\u043e\u0445\u0430\u0441\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u043c \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0438<\/span>"},"content":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-1\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\u0412\u0441\u0435 \u043c\u044b \u043f\u0440\u0435\u043a\u0440\u0430\u0441\u043d\u043e \u0437\u043d\u0430\u0435\u043c, \u0447\u0442\u043e \u043e\u0447\u0435\u043d\u044c \u0447\u0430\u0441\u0442\u043e \u043d\u0430\u0448\u0438 \u043f\u043b\u0430\u043d\u044b \u0438\u0434\u0443\u0442 \u043d\u0435 \u043f\u043e \u043f\u043b\u0430\u043d\u0443 \u0438\u043c\u0435\u043d\u043d\u043e \u0438\u0437-\u0437\u0430 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u043e\u0441\u0442\u0435\u0439. \u0412 \u0442\u0430\u043a\u0438\u0435 \u043c\u043e\u043c\u0435\u043d\u0442\u044b \u043e\u0447\u0435\u043d\u044c \u0442\u0440\u0443\u0434\u043d\u043e \u043e\u0431\u043e\u0439\u0442\u0438\u0441\u044c \u0431\u0435\u0437 \u0436\u0430\u0440\u0433\u043e\u043d\u0438\u0437\u043c\u043e\u0432, \u043d\u0435\u0446\u0435\u043d\u0437\u0443\u0440\u043d\u043e\u0439 \u0431\u0440\u0430\u043d\u0438 \u0438 \u043e\u0442\u0431\u043e\u0440\u043d\u043e\u0433\u043e \u0442\u0440\u0435\u0445\u044d\u0442\u0430\u0436\u043d\u043e\u0433\u043e. \u041d\u043e \u0432\u0441\u0435 \u0436\u0435 \u0435\u0441\u0442\u044c \u0441\u043f\u043e\u0441\u043e\u0431 \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043d\u0430\u0448\u0438 \u043f\u043b\u0430\u043d\u044b \u0431\u043e\u043b\u0435\u0435 \u0443\u0441\u0442\u043e\u0439\u0447\u0438\u0432\u044b\u043c\u0438 \u0438 \u0441\u043e\u0441\u0442\u043e\u044f\u0442\u0435\u043b\u044c\u043d\u044b\u043c\u0438 \u2014 \u044d\u0442\u043e \u0441\u0442\u043e\u0445\u0430\u0441\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 (\u0434\u0430\u043b\u0435\u0435 SP \u2014 stochastic programming).<\/p>\n<p> <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/3g\/pf\/xy\/3gpfxy6ex9j-6ftabuuyc8ak_fm.png\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/webt\/3g\/pf\/xy\/3gpfxy6ex9j-6ftabuuyc8ak_fm.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/webt\/3g\/pf\/xy\/3gpfxy6ex9j-6ftabuuyc8ak_fm.png 781w\" loading=\"lazy\" decode=\"async\"\/><br \/> <a name=\"habracut\"><\/a> <\/p>\n<h2>\u041c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0438\u0439 \u0442\u0435\u043e\u0440\u0435\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u043c\u0438\u043d\u0438\u043c\u0443\u043c<\/h2>\n<p> \u041a\u0430\u043a \u0432\u0441\u0435\u0433\u0434\u0430, \u043a\u043e\u043d\u0446\u0435\u043f\u0442\u0443\u0430\u043b\u044c\u043d\u043e \u0432\u0441\u0435 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e. \u0414\u043e\u043f\u0443\u0441\u0442\u0438\u043c, \u043c\u044b \u0445\u043e\u0442\u0438\u043c \u043c\u0430\u043a\u0441\u0438\u043c\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0432\u043e\u0442 \u0442\u0430\u043a\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u044e:<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/c97\/4c3\/50f\/c974c350fe477274e39150ea8e390b38.svg\" alt=\"$Z(x) = -2x^{2} + 12x - 14 \\to \\max.$\" data-tex=\"display\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/c97\/4c3\/50f\/c974c350fe477274e39150ea8e390b38.svg 780w,&#10;       https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/c97\/4c3\/50f\/c974c350fe477274e39150ea8e390b38.svg 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<p> \u0427\u0442\u043e \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0431\u0430\u043d\u0430\u043b\u044c\u043d\u0435\u0435 \u043f\u0430\u0440\u0430\u0431\u043e\u043b\u044b? \u0421\u043e\u0433\u043b\u0430\u0441\u0435\u043d, \u0441\u043b\u0438\u0448\u043a\u043e\u043c \u043f\u0440\u043e\u0441\u0442\u043e. \u041d\u043e \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u0438\u043c, \u0447\u0442\u043e \u043f\u043e \u043a\u0430\u043a\u043e\u0439-\u0442\u043e \u043f\u0440\u0438\u0447\u0438\u043d\u0435 \u043a\u043e\u044d\u0444\u0444\u0438\u0446\u0438\u0435\u043d\u0442 <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/550\/3f6\/e4b\/5503f6e4bbcd757b67ac2386454859e3.svg\" alt=\"$a$\" data-tex=\"inline\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/550\/3f6\/e4b\/5503f6e4bbcd757b67ac2386454859e3.svg 780w,&#10;       https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/550\/3f6\/e4b\/5503f6e4bbcd757b67ac2386454859e3.svg 781w\" loading=\"lazy\" decode=\"async\"\/> \u043f\u0440\u0438 <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/377\/8ff\/73d\/3778ff73d1f0b9a3b5a491dbb82197ba.svg\" alt=\"$x^{2}$\" data-tex=\"inline\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/377\/8ff\/73d\/3778ff73d1f0b9a3b5a491dbb82197ba.svg 780w,&#10;       https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/377\/8ff\/73d\/3778ff73d1f0b9a3b5a491dbb82197ba.svg 781w\" loading=\"lazy\" decode=\"async\"\/> \u0432\u0434\u0440\u0443\u0433 \u043d\u0430\u0447\u0430\u043b \u0438\u0441\u043f\u044b\u0442\u044b\u0432\u0430\u0442\u044c \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0435 \u043e\u0442\u043a\u043b\u043e\u043d\u0435\u043d\u0438\u044f: <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/f96\/e56\/3df\/f96e563df6e1c9cc349370386dd2bf3f.svg\" alt=\"$a \\sim N(-2, 0.1^{2})$\" data-tex=\"inline\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/f96\/e56\/3df\/f96e563df6e1c9cc349370386dd2bf3f.svg 780w,&#10;       https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/f96\/e56\/3df\/f96e563df6e1c9cc349370386dd2bf3f.svg 781w\" loading=\"lazy\" decode=\"async\"\/>. \u0412\u043e\u043e\u0431\u0449\u0435, \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e \u0432\u0437\u0433\u043b\u044f\u043d\u0443\u0442\u044c, \u0447\u0442\u043e \u0431\u0443\u0434\u0435\u0442 \u0441 \u043f\u0430\u0440\u0430\u0431\u043e\u043b\u043e\u0439, \u0435\u0441\u043b\u0438 \u0434\u0440\u0443\u0433\u0438\u0435 \u0435\u0435 \u043a\u043e\u044d\u0444\u0444\u0438\u0446\u0438\u0435\u043d\u0442\u044b \u0442\u043e\u0436\u0435 \u0431\u0443\u0434\u0443\u0442 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u043c\u0438. \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043d\u0430\u0440\u0438\u0441\u0443\u0435\u043c:<\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">\u041a\u043e\u0434 \u0434\u043b\u044f \u043e\u0442\u0440\u0438\u0441\u043e\u0432\u043a\u0438<\/b>                         <\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"python\">import numpy as np from scipy.stats import bernoulli, uniform, norm, expon from scipy.integrate import quad from scipy.optimize import linprog from scipy.optimize import differential_evolution  import matplotlib.pyplot as plt import seaborn as sns sns.set_style(\"whitegrid\")  fig, ax = plt.subplots(1, 3, figsize=(12, 4), dpi=150)  x = np.linspace(0.5, 5) y_determ = -2 * x**2 + 12 * x - 14  iterations = 50  ax[0].plot(x, y_determ, 'C3', zorder=10) for i in range(iterations):     a = norm.rvs(loc=-2, scale = 0.1)     y = a * x**2 + 12 * x - 14     ax[0].plot(x, y, 'b', alpha=0.2)  ax[1].plot(x, y_determ, 'C3', zorder=10) for i in range(iterations):     b = uniform.rvs(loc=11, scale = 2)     y = -2*x**2 + b*x - 14     ax[1].plot(x, y, 'b', alpha=0.2)  ax[2].plot(x, y_determ, 'C3', zorder=10) for i in range(iterations):     c = expon.rvs(loc=-14, scale = 1)     y = -2*x**2 + 12*x + c     ax[2].plot(x, y, 'b', alpha=0.2)  ax[0].set_title(r'$a \\sim N(-2, 0.1^{2})$' + '\\n' + r'$b=12; c=-14$') ax[1].set_title(r'$b \\sim U(11, 13)$' + '\\n' + r'$a=-2; c=-14$') ax[2].set_title(r'$c \\sim Exp(-14)$' + '\\n' + r'$a=-2; b=12$')  ax[0].set_ylabel('Y') ax[0].set_xlabel('x') ax[1].set_xlabel('x') ax[2].set_xlabel('x')  plt.show()<\/code><\/pre>\n<p> <\/div>\n<\/p><\/div>\n<p> <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/zg\/he\/ml\/zghemlkvzlab5vri78poxp3yx-a.png\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/webt\/zg\/he\/ml\/zghemlkvzlab5vri78poxp3yx-a.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/webt\/zg\/he\/ml\/zghemlkvzlab5vri78poxp3yx-a.png 781w\" loading=\"lazy\" decode=\"async\"\/><br \/> \u041a\u0440\u0430\u0441\u043d\u0430\u044f \u043b\u0438\u043d\u0438\u044f \u2014 \u044d\u0442\u043e \u0434\u0435\u0442\u0435\u0440\u043c\u0438\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u0430\u044f \u0432\u0441\u0435\u043b\u0435\u043d\u043d\u0430\u044f, \u043e\u0447\u0435\u043d\u044c \u0445\u043e\u0440\u043e\u0448\u0435\u0435 \u043c\u0435\u0441\u0442\u043e: \u0441 \u0440\u0430\u0434\u0443\u0433\u0430\u043c\u0438 \u0438 \u0435\u0434\u0438\u043d\u043e\u0440\u043e\u0433\u0430\u043c\u0438, \u0442\u0430\u043c \u0430\u0431\u0441\u043e\u043b\u044e\u0442\u043d\u043e \u0432\u0441\u0435 \u0437\u0430\u0432\u0438\u0441\u0438\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0442 \u043d\u0430\u0448\u0438\u0445 \u0436\u0435\u043b\u0430\u043d\u0438\u0439, \u0440\u0435\u0448\u0435\u043d\u0438\u0439 \u0438 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0439.<\/p>\n<p> \u0420\u0435\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u2014 \u044d\u0442\u043e \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u0435\u0432 \u0438\u043b\u0438 \u0434\u0430\u0436\u0435 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u0445 \u0432\u0441\u0435\u043b\u0435\u043d\u043d\u044b\u0445 (\u0441\u0438\u043d\u0438\u0435 \u043b\u0438\u043d\u0438\u0438), \u043a\u0430\u0436\u0434\u0430\u044f \u0438\u0437 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043c\u043e\u0436\u0435\u0442 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u043f\u043e \u0432\u043e\u043b\u0435 \u0441\u043b\u0443\u0447\u0430\u044f, \u0447\u0430\u0449\u0435 \u0432\u0441\u0435\u0433\u043e \u0441 \u043f\u043e\u043b\u043d\u044b\u043c \u0438\u0433\u043d\u043e\u0440\u043e\u043c \u043d\u0430\u0448\u0438\u0445 \u0436\u0435\u043b\u0430\u043d\u0438\u0439 \u0438 \u043d\u0430\u0434\u0435\u0436\u0434.<\/p>\n<p> \u041f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u0432\u0441\u0435 \u0442\u0430\u043a\u043e\u0435 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u043e\u0435, \u0442\u043e \u0438 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043c\u044b, \u043e\u0447\u0435\u0432\u0438\u0434\u043d\u043e, \u0434\u043e\u043b\u0436\u043d\u044b (\u043d\u043e \u043d\u0435 \u043e\u0431\u044f\u0437\u0430\u043d\u044b) \u0442\u043e\u043b\u044c\u043a\u043e \u0432 \u0440\u0430\u043c\u043a\u0430\u0445 \u0442\u0435\u0440\u0432\u0435\u0440\u0430 \u0438 \u0441\u0442\u0430\u0442\u043e\u0432. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043c\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u0442\u044c \u043e\u0442 \u043d\u0430\u0448\u0438\u0445 \u043f\u043b\u0430\u043d\u043e\u0432 \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u043e\u043d\u0438 \u0431\u044b\u043b\u0438 <b>\u043e\u043f\u0442\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u043c\u0438 \u0432 \u0441\u0440\u0435\u0434\u043d\u0435\u043c<\/b>, \u0438\u043b\u0438 \u0447\u0442\u043e\u0431\u044b \u043e\u043d\u0438 \u0431\u044b\u043b\u0438 <b>\u043e\u043f\u0442\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u043c\u0438 \u0441 \u0437\u0430\u0434\u0430\u043d\u043d\u043e\u0439 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c\u044e<\/b>.<\/p>\n<p> \u0412 \u044d\u0442\u043e\u043c \u043c\u0435\u0441\u0442\u0435 \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u044c\u0441\u044f, \u0447\u0442\u043e \u0442\u0435\u043f\u0435\u0440\u044c \u0432\u0441\u0435, \u0447\u0442\u043e \u043d\u0443\u0436\u043d\u043e \u0434\u043b\u044f \u0441\u0447\u0430\u0441\u0442\u044c\u044f, \u044d\u0442\u043e \u0432\u0437\u044f\u0442\u044c \u0432\u0441\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u0438 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u0432 \u043d\u0430\u0448\u0438\u0445 \u043c\u043e\u0434\u0435\u043b\u044f\u0445 \u0438 \u0437\u0430\u043c\u0435\u043d\u0438\u0442\u044c \u0438\u0445 \u043d\u0430 \u0438\u0445 pdf-\u044b! \u041d\u043e \u043f\u043e\u0434\u043e\u0436\u0434\u0438\u0442\u0435, \u043d\u0435 \u0432\u0441\u0435 \u0442\u0430\u043a \u043f\u0440\u043e\u0441\u0442\u043e. \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u0438\u043c, \u0447\u0442\u043e \u0442\u0435\u043f\u0435\u0440\u044c \u0432\u0441\u0435 \u043a\u043e\u044d\u0444\u0444\u0438\u0446\u0438\u0435\u043d\u0442\u044b \u043d\u0430\u0448\u0435\u0439 \u043f\u0430\u0440\u0430\u0431\u043e\u043b\u044b \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u043c\u0438. \u0415\u0441\u043b\u0438 \u0438\u0437\u043e\u0431\u0440\u0430\u0437\u0438\u0442\u044c \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u043c\u0430\u043a\u0441\u0438\u043c\u0443\u043c\u043e\u0432, \u0442\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u043c \u0442\u0430\u043a\u043e\u0435:<\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">\u041a\u043e\u0434 \u0434\u043b\u044f \u043e\u0442\u0440\u0438\u0441\u043e\u0432\u043a\u0438<\/b>                         <\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"python\">x_vertex, y_vertex = [], []  N = 5000 a = norm.rvs(loc=-2, scale = 0.1, size=N) b = uniform.rvs(loc=11, scale = 2, size=N) c = expon.rvs(loc=-14, scale = 1, size=N) x_vertex.append(- b \/ (2 * a)) y_vertex.append((4*a*c - b**2) \/ (4*a))  f, ax = plt.subplots(1, 3, figsize=(12, 4), dpi=150)  ax[0].scatter(x_vertex, y_vertex, s=1, alpha=0.2) sns.kdeplot(x_vertex, ax=ax[1]) sns.kdeplot(y_vertex, ax=ax[2])  ax[0].set_title(r'KDE $Z^{*}$') ax[0].set_xlabel(r'$Z^{*}_{x}$') ax[0].set_ylabel(r'$Z^{*}_{y}$')  ax[1].set_title(r'KDE $Z^{*}_{x}$') ax[2].set_title(r'KDE $Z^{*}_{y}$') ax[1].set_xlabel('x') ax[2].set_xlabel('y')  plt.show()<\/code><\/pre>\n<p> <\/div>\n<\/p><\/div>\n<p> <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/bq\/j7\/vv\/bqj7vvp-hfthbkqk-q67kthu6_o.png\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/webt\/bq\/j7\/vv\/bqj7vvp-hfthbkqk-q67kthu6_o.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/webt\/bq\/j7\/vv\/bqj7vvp-hfthbkqk-q67kthu6_o.png 781w\" loading=\"lazy\" decode=\"async\"\/><br \/> \u0427\u0442\u043e \u044d\u0442\u043e \u0437\u0430 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435? \u042f \u043d\u0435 \u0437\u043d\u0430\u044e. \u041c\u043e\u0433\u0443 \u043b\u0438\u0448\u044c \u0441\u043a\u0430\u0437\u0430\u0442\u044c, \u0447\u0442\u043e \u0430\u0440\u0438\u0444\u043c\u0435\u0442\u0438\u043a\u0430 (\u0438 \u0430\u043b\u0433\u0435\u0431\u0440\u0430) \u0434\u043b\u044f \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0445 \u0432\u0435\u043b\u0438\u0447\u0438\u043d \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043d\u0435 \u0442\u0430\u043a, \u043a\u0430\u043a \u0434\u043b\u044f \u043e\u0431\u044b\u0447\u043d\u044b\u0445 \u0447\u0438\u0441\u0435\u043b. \u0422\u0443\u0442 <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/344\/0db\/e0a\/3440dbe0a9955d744933d872a9f17903.svg\" alt=\"$2 + 2 \\neq 4$\" data-tex=\"inline\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/344\/0db\/e0a\/3440dbe0a9955d744933d872a9f17903.svg 780w,&#10;       https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/344\/0db\/e0a\/3440dbe0a9955d744933d872a9f17903.svg 781w\" loading=\"lazy\" decode=\"async\"\/>.<\/p>\n<p> \u0414\u0430\u0436\u0435 \u0432 \u043f\u0440\u043e\u0441\u0442\u0435\u0439\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043a\u043e\u0433\u0434\u0430 <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/3ae\/d41\/799\/3aed417996e067bcc6e88140ab17653c.svg\" alt=\"$X \\sim U(0, 1)$\" data-tex=\"inline\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/3ae\/d41\/799\/3aed417996e067bcc6e88140ab17653c.svg 780w,&#10;       https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/3ae\/d41\/799\/3aed417996e067bcc6e88140ab17653c.svg 781w\" loading=\"lazy\" decode=\"async\"\/> \u0438 <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/d84\/fa2\/d1d\/d84fa2d1d63025d0925cae81a92c3ffe.svg\" alt=\"$Y \\sim U(0, 1)$\" data-tex=\"inline\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/d84\/fa2\/d1d\/d84fa2d1d63025d0925cae81a92c3ffe.svg 780w,&#10;       https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/d84\/fa2\/d1d\/d84fa2d1d63025d0925cae81a92c3ffe.svg 781w\" loading=\"lazy\" decode=\"async\"\/> \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u043c \u0430\u0440\u0438\u0444\u043c\u0435\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439 \u0431\u0443\u0434\u0435\u0442 \u0432\u043e\u0442 \u0442\u0430\u043a\u043e\u0435:<\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">\u041a\u043e\u0434 \u0434\u043b\u044f \u043e\u0442\u0440\u0438\u0441\u043e\u0432\u043a\u0438<\/b>                         <\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"python\"># \u041f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u0440\u0430\u0432\u043d\u043e\u043c\u0435\u0440\u043d\u044b\u0445 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0439 a, b = 1e-10, 1  # X ~ U(0, 1) c, d = 1e-10, 1  # Y ~ U(0, 1)  # \u0424\u0443\u043d\u043a\u0446\u0438\u0438 \u043f\u043b\u043e\u0442\u043d\u043e\u0441\u0442\u0438 def f_X(x):     return 1 \/ (b - a) if a &lt;= x &lt;= b else 0  def f_Y(y):     return 1 \/ (d - c) if c &lt;= y &lt;= d else 0  # \u0427\u0438\u0441\u043b\u0435\u043d\u043d\u0430\u044f \u0441\u0432\u0451\u0440\u0442\u043a\u0430 \u0434\u043b\u044f \u0441\u0443\u043c\u043c\u044b Z = X + Y def convolution_sum(z):     # \u041f\u0440\u0435\u0434\u0435\u043b\u044b \u0438\u043d\u0442\u0435\u0433\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f: max(a, z - d) &lt;= x &lt;= min(b, z - c)     lower = max(a, z - d)     upper = min(b, z - c)     if lower &gt;= upper:         return 0     integral, _ = quad(lambda x: f_X(x) * f_Y(z - x), lower, upper)     return integral  # \u0427\u0438\u0441\u043b\u0435\u043d\u043d\u0430\u044f \u0441\u0432\u0451\u0440\u0442\u043a\u0430 \u0434\u043b\u044f \u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0434\u0435\u043d\u0438\u044f Z = X * Y def convolution_prod(z):     # \u041f\u0440\u0435\u0434\u0435\u043b\u044b \u0438\u043d\u0442\u0435\u0433\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f: x in [a, b] and [z\/d, z\/c] (\u0434\u043b\u044f z &gt; 0)     if z == 0:         return 0  # \u041e\u0441\u043e\u0431\u044b\u0439 \u0441\u043b\u0443\u0447\u0430\u0439     lower = max(a, z \/ d)     upper = min(b, z \/ c)     if lower &gt;= upper:         return 0     integral, _ = quad(lambda x: f_X(x) * f_Y(z \/ x) \/ abs(x), lower, upper)     return integral  # \u0427\u0438\u0441\u043b\u0435\u043d\u043d\u0430\u044f \u0441\u0432\u0451\u0440\u0442\u043a\u0430 \u0434\u043b\u044f \u0447\u0430\u0441\u0442\u043d\u043e\u0433\u043e Z = X \/ Y def convolution_div(z):     # \u041f\u0440\u0435\u0434\u0435\u043b\u044b \u0438\u043d\u0442\u0435\u0433\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f: y in [c, d] and [a\/z, b\/z] (\u0434\u043b\u044f z &gt; 0)     if z == 0:         return 0  # \u041e\u0441\u043e\u0431\u044b\u0439 \u0441\u043b\u0443\u0447\u0430\u0439     lower = max(c, a \/ z)     upper = min(d, b \/ z)     if lower &gt;= upper:         return 0     integral, _ = quad(lambda y: f_X(y * z) * f_Y(y) * abs(y), lower, upper)     return integral  # \u0412\u0435\u043a\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u044f \u0434\u043b\u044f \u043c\u0430\u0441\u0441\u0438\u0432\u043e\u0432 z conv_sum_vec = np.vectorize(convolution_sum) conv_prod_vec = np.vectorize(convolution_prod) conv_div_vec = np.vectorize(convolution_div)  # \u0414\u0438\u0430\u043f\u0430\u0437\u043e\u043d z \u0434\u043b\u044f \u0441\u0443\u043c\u043c\u044b (X + Y) z_sum = np.linspace(1e-4, 2, 1000) pdf_sum = conv_sum_vec(z_sum)  # \u0414\u0438\u0430\u043f\u0430\u0437\u043e\u043d z \u0434\u043b\u044f \u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0434\u0435\u043d\u0438\u044f (X * Y) z_prod = np.linspace(5e-3, 1, 1000) pdf_prod = conv_prod_vec(z_prod)  # \u0414\u0438\u0430\u043f\u0430\u0437\u043e\u043d z \u0434\u043b\u044f \u0447\u0430\u0441\u0442\u043d\u043e\u0433\u043e (X \/ Y) z_div = np.linspace(1e-3, 5, 1000) pdf_div = conv_div_vec(z_div)  # \u041c\u043e\u043d\u0442\u0435-\u041a\u0430\u0440\u043b\u043e \u0434\u043b\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 X = np.random.uniform(a, b, 100000) Y = np.random.uniform(c, d, 100000) Z_mc_sum = X + Y Z_mc_prod = X * Y Z_mc_div = X \/ Y Z_mc_div = Z_mc_div[Z_mc_div &lt; 100]  # \u0412\u0438\u0437\u0443\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f f, ax = plt.subplots(1, 3, figsize=(12, 3), dpi=150)  ax[0].plot(z_sum, pdf_sum, c='C3', lw=2, label='PDF') ax[0].hist(Z_mc_sum, bins=50, density=True, alpha=0.5, label='MC') ax[0].set_title(r'$X + Y$') ax[0].legend()  ax[1].plot(z_prod, pdf_prod, c='C3', lw=2, label='PDF') ax[1].hist(Z_mc_prod, bins=50, density=True, alpha=0.5, label='MC') ax[1].set_title(r'$X * Y$') ax[1].legend()  ax[2].plot(z_div, pdf_div, c='C3', lw=2, label='PDF') ax[2].hist(Z_mc_div, bins=1000, density=True, alpha=0.5, label='MC') ax[2].set_xlim(0, 5) ax[2].set_title(r'$X \\; \/ \\; Y$') ax[2].legend()  plt.show()<\/code><\/pre>\n<p> <\/div>\n<\/p><\/div>\n<p> <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/rz\/zt\/5c\/rzzt5cyuvshbzjtvzv5tiz8jqxk.png\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/webt\/rz\/zt\/5c\/rzzt5cyuvshbzjtvzv5tiz8jqxk.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/webt\/rz\/zt\/5c\/rzzt5cyuvshbzjtvzv5tiz8jqxk.png 781w\" loading=\"lazy\" decode=\"async\"\/><br \/> \u041a\u0430\u043a \u0432\u0438\u0434\u0438\u043c, \u0442\u0443\u0442 \u0435\u0441\u0442\u044c \u0438 \u043d\u0435\u043b\u0438\u043d\u0435\u0439\u043d\u043e\u0441\u0442\u0438, \u0438 \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u0438. \u0425\u043e\u0440\u043e\u0448\u043e \u044d\u0442\u043e \u0438\u043b\u0438 \u043f\u043b\u043e\u0445\u043e? \u041a\u0430\u043a \u0441\u043a\u0430\u0437\u0430\u0442\u044c, \u0435\u0441\u043b\u0438 \u043c\u044b \u0442\u043e\u0447\u043d\u043e \u0437\u043d\u0430\u0435\u043c, \u043a\u0430\u043a \u043a\u0440\u0443\u0442\u044f\u0442\u0441\u044f \u0448\u0435\u0441\u0442\u0435\u0440\u0435\u043d\u043a\u0438 \u043f\u043e\u0434 \u043a\u0430\u043f\u043e\u0442\u043e\u043c \u0443 \u043d\u0430\u0448\u0435\u0439 \u043c\u043e\u0434\u0435\u043b\u0438, \u0442\u043e \u044d\u0442\u043e \u043a\u0440\u0443\u0442\u043e. \u041a \u0442\u043e\u043c\u0443 \u0436\u0435 \u0438\u043d\u043e\u0433\u0434\u0430 \u043d\u0435\u043b\u0438\u043d\u0435\u0439\u043d\u043e\u0441\u0442\u0438 \u043f\u0440\u043e\u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u0432 \u0442\u0430\u043a\u0438\u0445 \u043c\u043e\u0449\u043d\u044b\u0445 \u044d\u0444\u0444\u0435\u043a\u0442\u0430\u0445, \u043a\u0430\u043a \u0441\u0443\u043f\u0435\u0440\u0430\u0434\u0434\u0438\u0442\u0438\u0432\u043d\u043e\u0441\u0442\u044c, \u043a\u043e\u0433\u0434\u0430<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/ea7\/c94\/bd2\/ea7c94bd2cabed0611f0633166661ae5.svg\" alt=\"$F(X + Y) &gt; F(X) + F(Y)$\" data-tex=\"display\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/ea7\/c94\/bd2\/ea7c94bd2cabed0611f0633166661ae5.svg 780w,&#10;       https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/ea7\/c94\/bd2\/ea7c94bd2cabed0611f0633166661ae5.svg 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<p> \u0438 \u0441\u0443\u043f\u0435\u0440\u043c\u0443\u043b\u044c\u0442\u0438\u043f\u043b\u0438\u043a\u0430\u0442\u0438\u0432\u043d\u043e\u0441\u0442\u044c, \u043a\u043e\u0433\u0434\u0430<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/d00\/a65\/980\/d00a659808b1b0e9480cfb27690e074d.svg\" alt=\"$F(X * Y) &gt; F(X) * F(Y).$\" data-tex=\"display\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/d00\/a65\/980\/d00a659808b1b0e9480cfb27690e074d.svg 780w,&#10;       https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/d00\/a65\/980\/d00a659808b1b0e9480cfb27690e074d.svg 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<p> \u0412\u043e\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u044d\u0442\u0438 \u044d\u0444\u0444\u0435\u043a\u0442\u044b \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u043a\u0430\u043a \u043f\u043e\u043b\u043e\u0436\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u043c\u0438, \u0442\u0430\u043a \u0438 \u043e\u0442\u0440\u0438\u0446\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u043c\u0438. \u041f\u043e \u043e\u043f\u044b\u0442\u0443 \u043c\u043e\u0433\u0443 \u0441\u043a\u0430\u0437\u0430\u0442\u044c, \u0447\u0442\u043e \u0435\u0441\u043b\u0438 \u043c\u043e\u0434\u0435\u043b\u044c \u0441\u043b\u043e\u0436\u043d\u0430\u044f, \u0438 \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u043e\u0434\u043d\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0438 \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u043c\u0438 \u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u0434\u043b\u044f \u0434\u0440\u0443\u0433\u043e\u0439, \u0442\u043e \u043b\u0443\u0447\u0448\u0435 \u0437\u0430\u043c\u043e\u0440\u043e\u0447\u0438\u0442\u044c\u0441\u044f \u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c. \u041c\u043e\u0435 \u0437\u043d\u0430\u043a\u043e\u043c\u0441\u0442\u0432\u043e \u0441 SP \u043d\u0430\u0447\u0430\u043b\u043e\u0441\u044c \u0438\u043c\u0435\u043d\u043d\u043e \u0442\u0430\u043a. \u0418\u043d\u043e\u0433\u0434\u0430 \u043a \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u0438\u043c \u0443\u043b\u0443\u0447\u0448\u0435\u043d\u0438\u044f\u043c \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u0442 \u043f\u0440\u043e\u0441\u0442\u0430\u044f \u0437\u0430\u043c\u0435\u043d\u0430 \u0441\u0440\u0435\u0434\u043d\u0438\u0445 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u044b\u0445 \u0432\u0435\u043b\u0438\u0447\u0438\u043d \u043d\u0430 \u0438\u0445 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f.<\/p>\n<p> \u0414\u0430\u0436\u0435 \u043d\u0435 \u0437\u043d\u0430\u044e, \u0447\u0442\u043e \u0435\u0449\u0435 \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c? \u0421\u043b\u0443\u0447\u0430\u0439\u043d\u043e\u0441\u0442\u044c \u2014 \u044d\u0442\u043e \u043d\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u0441\u0442\u044c, \u0430 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c \u2014 \u044d\u0442\u043e \u043c\u0435\u0440\u0430 \u043d\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u0441\u0442\u0438, \u0441 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043c\u044b \u0443\u043c\u0435\u0435\u043c \u0445\u043e\u0440\u043e\u0448\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c. \u0422\u0435\u043c \u043d\u0435 \u043c\u0435\u043d\u0435\u0435 \u0441\u043e\u0432\u043b\u0430\u0434\u0430\u0442\u044c \u0441 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u044c\u044e \u0432\u0441\u0435 \u0440\u0430\u0432\u043d\u043e \u0431\u044b\u0432\u0430\u0435\u0442 \u043d\u0435\u043f\u0440\u043e\u0441\u0442\u043e.<\/p>\n<h2>\u0422\u0430\u043a \u043a\u0430\u043a\u0430\u044f \u043e\u043d\u0430, \u0420\u0415\u0410\u041b\u042c\u041d\u041e\u0421\u0422\u042c?<\/h2>\n<p> \u041f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u0438\u043c, \u0447\u0442\u043e \u043d\u0430\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u0438\u0442\u044c \u0447\u0430\u0441\u0442\u044c \u0444\u0443\u043d\u0434\u0430\u043c\u0435\u043d\u0442\u0430 \u0434\u043b\u044f \u043d\u0435\u0431\u043e\u0441\u043a\u0440\u0435\u0431\u0430. \u041e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442 \u0431\u0435\u0442\u043e\u043d\u0430 (60-70% \u043e\u0431\u044a\u0435\u043c\u0430) \u2014 \u044d\u0442\u043e \u0449\u0435\u0431\u0435\u043d\u044c (\u043d\u0435\u0431\u043e\u043b\u044c\u0448\u0438\u0435 \u043a\u0430\u043c\u0435\u0448\u043a\u0438 \u043e\u0442 5 \u0434\u043e 40 \u043c\u043c \u0441 \u0448\u0435\u0440\u043e\u0445\u043e\u0432\u0430\u0442\u043e\u0439 \u043f\u043e\u0432\u0435\u0440\u0445\u043d\u043e\u0441\u0442\u044c\u044e), \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0438\u043d\u043e\u0433\u0434\u0430 \u043f\u043e\u043b\u0443\u0447\u0430\u044e\u0442 \u043f\u0443\u0442\u0435\u043c \u043f\u0435\u0440\u0435\u043c\u0430\u043b\u044b\u0432\u0430\u043d\u0438\u044f \u043a\u0430\u043c\u043d\u0435\u0439 \u0438\u0437 \u0433\u0440\u0430\u0432\u0438\u044f. \u0412 \u0442\u043e\u0436\u0435 \u0432\u0440\u0435\u043c\u044f \u0433\u0440\u0430\u0432\u0438\u0439 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u043a\u0430\u043c\u043d\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u043e\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u043c\u043e\u043b\u043e\u0442\u044c \u0434\u043b\u044f \u0449\u0435\u0431\u043d\u044f, \u043d\u043e \u0435\u0449\u0435 \u0438 \u043f\u0435\u0441\u043e\u043a, \u0430 \u043e\u043d \u0442\u043e\u0436\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u043c \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u043e\u043c \u0431\u0435\u0442\u043e\u043d\u0430.<\/p>\n<p> \u0414\u043e\u043f\u0443\u0441\u0442\u0438\u043c, \u0443 \u043d\u0430\u0441 \u0432\u0441\u0435\u0433\u043e \u0434\u0432\u0430 \u043c\u0435\u0441\u0442\u043e\u0440\u043e\u0436\u0434\u0435\u043d\u0438\u044f \u0433\u0440\u0430\u0432\u0438\u044f:<\/p>\n<ul>\n<li> <b>\u0414\u043e\u043b\u044f \u043a\u0430\u043c\u043d\u0435\u0439<\/b>: <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/75d\/689\/d8e\/75d689d8eecf9b34888f087bfe80eafb.svg\" alt=\"$a_{11} \\sim U[0.6, 0.7]$\" data-tex=\"inline\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/75d\/689\/d8e\/75d689d8eecf9b34888f087bfe80eafb.svg 780w,&#10;       https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/75d\/689\/d8e\/75d689d8eecf9b34888f087bfe80eafb.svg 781w\" loading=\"lazy\" decode=\"async\"\/> \u2014 \u0432 \u043f\u0435\u0440\u0432\u043e\u043c \u043c\u0435\u0441\u0442\u043e\u0440\u043e\u0436\u0434\u0435\u043d\u0438\u0438, <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/ba2\/cd3\/43a\/ba2cd343adfa538702dba51f37f9733b.svg\" alt=\"$a_{12} \\sim U[0.75, 0.9]$\" data-tex=\"inline\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/ba2\/cd3\/43a\/ba2cd343adfa538702dba51f37f9733b.svg 780w,&#10;       https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/ba2\/cd3\/43a\/ba2cd343adfa538702dba51f37f9733b.svg 781w\" loading=\"lazy\" decode=\"async\"\/> \u2014 \u0432\u043e \u0432\u0442\u043e\u0440\u043e\u043c \u043c\u0435\u0441\u0442\u043e\u0440\u043e\u0436\u0434\u0435\u043d\u0438\u0438;<\/li>\n<li> <b>\u0414\u043e\u043b\u044f \u043f\u0435\u0441\u043a\u0430<\/b>: <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/f21\/8ae\/263\/f218ae2631afdce6fc602e345860832b.svg\" alt=\"$a_{21} = 1 - a_{11}$\" data-tex=\"inline\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/f21\/8ae\/263\/f218ae2631afdce6fc602e345860832b.svg 780w,&#10;       https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/f21\/8ae\/263\/f218ae2631afdce6fc602e345860832b.svg 781w\" loading=\"lazy\" decode=\"async\"\/> \u2014 \u0432 \u043f\u0435\u0440\u0432\u043e\u043c \u043c\u0435\u0441\u0442\u043e\u0440\u043e\u0436\u0434\u0435\u043d\u0438\u0438, <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/1ea\/0c6\/4b6\/1ea0c64b664b9d26fd490be76f547e53.svg\" alt=\"$a_{22} = 1 - a_{12}$\" data-tex=\"inline\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/1ea\/0c6\/4b6\/1ea0c64b664b9d26fd490be76f547e53.svg 780w,&#10;       https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/1ea\/0c6\/4b6\/1ea0c64b664b9d26fd490be76f547e53.svg 781w\" loading=\"lazy\" decode=\"async\"\/> \u2014 \u0432\u043e \u0432\u0442\u043e\u0440\u043e\u043c \u043c\u0435\u0441\u0442\u043e\u0440\u043e\u0436\u0434\u0435\u043d\u0438\u0438;<\/li>\n<li> <b>\u041c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u0432 \u0442\u043e\u043d\u043d\u0430\u0445<\/b>: <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/62b\/af6\/328\/62baf632881eaf71eda1242c6a9a146a.svg\" alt=\"$b_{1} = 6500$\" data-tex=\"inline\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/62b\/af6\/328\/62baf632881eaf71eda1242c6a9a146a.svg 780w,&#10;       https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/62b\/af6\/328\/62baf632881eaf71eda1242c6a9a146a.svg 781w\" loading=\"lazy\" decode=\"async\"\/> \u2014 \u043a\u0430\u043c\u043d\u0438, <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/417\/b59\/217\/417b59217fc8c6a26779efd90863b90f.svg\" alt=\"$b_{2} = 3000$\" data-tex=\"inline\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/417\/b59\/217\/417b59217fc8c6a26779efd90863b90f.svg 780w,&#10;       https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/417\/b59\/217\/417b59217fc8c6a26779efd90863b90f.svg 781w\" loading=\"lazy\" decode=\"async\"\/> \u043f\u0435\u0441\u043e\u043a;<\/li>\n<li> <b>\u0421\u0442\u043e\u0438\u043c\u043e\u0441\u0442\u0438 \u0437\u0430 \u0442\u043e\u043d\u043d\u0443<\/b>: <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/38e\/26f\/3e5\/38e26f3e514f9d4160021d7c1e03c4fe.svg\" alt=\"$c_{1} \\sim U[2.2, 2.5]$\" data-tex=\"inline\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/38e\/26f\/3e5\/38e26f3e514f9d4160021d7c1e03c4fe.svg 780w,&#10;       https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/38e\/26f\/3e5\/38e26f3e514f9d4160021d7c1e03c4fe.svg 781w\" loading=\"lazy\" decode=\"async\"\/> \u2014 \u0432 \u043f\u0435\u0440\u0432\u043e\u043c \u043c\u0435\u0441\u0442\u043e\u0440\u043e\u0436\u0434\u0435\u043d\u0438\u0438, <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/c7e\/45a\/875\/c7e45a875769151b8356e3d5ecac5320.svg\" alt=\"$c_{2} \\sim U[1.7, 2.1]$\" data-tex=\"inline\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/c7e\/45a\/875\/c7e45a875769151b8356e3d5ecac5320.svg 780w,&#10;       https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/c7e\/45a\/875\/c7e45a875769151b8356e3d5ecac5320.svg 781w\" loading=\"lazy\" decode=\"async\"\/> \u2014 \u0432\u043e \u0432\u0442\u043e\u0440\u043e\u043c \u043c\u0435\u0441\u0442\u043e\u0440\u043e\u0436\u0434\u0435\u043d\u0438\u0438;<\/li>\n<li> <b>\u041d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u0438 \u0441\u043e\u0431\u043b\u044e\u0434\u0435\u043d\u0438\u044f \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u0439<\/b>: <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/2a2\/18f\/007\/2a218f007b543f130851c9af5c8db00c.svg\" alt=\"$P(a_{11}x_{1} + a_{12}x_{2} \\geq b_{1}) &gt; 0.8$\" data-tex=\"inline\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/2a2\/18f\/007\/2a218f007b543f130851c9af5c8db00c.svg 780w,&#10;       https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/2a2\/18f\/007\/2a218f007b543f130851c9af5c8db00c.svg 781w\" loading=\"lazy\" decode=\"async\"\/> \u2014 \u0434\u043b\u044f \u043a\u0430\u043c\u043d\u0435\u0439, <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/016\/5a3\/37d\/0165a337de9226471bf23d5a27d6711a.svg\" alt=\"$P(a_{21}x_{1} + a_{22}x_{2} \\geq b_{2}) &gt; 0.95$\" data-tex=\"inline\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/016\/5a3\/37d\/0165a337de9226471bf23d5a27d6711a.svg 780w,&#10;       https:\/\/habrastorage.org\/getpro\/habr\/\/formulas\/016\/5a3\/37d\/0165a337de9226471bf23d5a27d6711a.svg 781w\" loading=\"lazy\" decode=\"async\"\/> \u2014 \u0434\u043b\u044f \u043f\u0435\u0441\u043a\u0430.<\/li>\n<\/ul>\n<p> \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0440\u0435\u0448\u0438\u043c \u0437\u0430\u0434\u0430\u0447\u0443 \u0442\u0430\u043a, \u0441\u043b\u043e\u0432\u043d\u043e \u043d\u0438\u043a\u0430\u043a\u0438\u0445 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u043e\u0441\u0442\u0435\u0439 \u043d\u0435\u0442 \u0438 \u043f\u0440\u043e\u0441\u0442\u043e \u0432\u043e\u0437\u044c\u043c\u0435\u043c \u0441\u0440\u0435\u0434\u043d\u0438\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f.<\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">\u041a\u043e\u0434 \u0434\u043b\u044f \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0438 \u043e\u0442\u0440\u0438\u0441\u043e\u0432\u043a\u0438<\/b>                         <\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"python\"># \u0421\u0440\u0435\u0434\u043d\u0438\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 a11 = (0.6 + 0.7) \/ 2   # \u0441\u0440\u0435\u0434\u043d\u0435\u0435 \u0434\u043b\u044f U[0.6, 0.7] a12 = (0.75 + 0.9) \/ 2  # \u0441\u0440\u0435\u0434\u043d\u0435\u0435 \u0434\u043b\u044f U[0.75, 0.9] a21 = 1 - a11 a22 = 1 - a12 c1 = (2.2 + 2.5) \/ 2    # \u0441\u0440\u0435\u0434\u043d\u044f\u044f \u0441\u0442\u043e\u0438\u043c\u043e\u0441\u0442\u044c 1-\u0433\u043e \u043c\u0435\u0441\u0442\u043e\u0440\u043e\u0436\u0434\u0435\u043d\u0438\u044f c2 = (1.7 + 2.1) \/ 2    # \u0441\u0440\u0435\u0434\u043d\u044f\u044f \u0441\u0442\u043e\u0438\u043c\u043e\u0441\u0442\u044c 2-\u0433\u043e \u043c\u0435\u0441\u0442\u043e\u0440\u043e\u0436\u0434\u0435\u043d\u0438\u044f  # \u0426\u0435\u043b\u0435\u0432\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f (\u043c\u0438\u043d\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u044f \u0441\u0442\u043e\u0438\u043c\u043e\u0441\u0442\u0438) c = [c1, c2]  # \u041e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u044f \u0432 \u0432\u0438\u0434\u0435 A_ub * x &lt;= b_ub A = [     [-a11, -a12],  # -x1*a11 - x2*a12 &lt;= -b1 (\u043a\u0430\u043c\u043d\u0438)     [-a21, -a22]   # -x1*a21 - x2*a22 &lt;= -b2 (\u043f\u0435\u0441\u043e\u043a) ] b = [-6500, -3000]  # \u0413\u0440\u0430\u043d\u0438\u0446\u044b \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 (x1 &gt;= 0, x2 &gt;= 0) bounds = [(0, None), (0, None)]  # \u0420\u0435\u0448\u0435\u043d\u0438\u0435 \u0437\u0430\u0434\u0430\u0447\u0438 \u043b\u0438\u043d\u0435\u0439\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f res = linprog(c, A_ub=A, b_ub=b, bounds=bounds, method='highs')  # \u0412\u044b\u0432\u043e\u0434 \u0440\u0435\u0448\u0435\u043d\u0438\u044f: print(f\"\u041e\u043f\u0442\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0438\u0437 1-\u0433\u043e \u043c\u0435\u0441\u0442\u043e\u0440\u043e\u0436\u0434\u0435\u043d\u0438\u044f: {res.x[0]:.2f} \u0442\u043e\u043d\u043d\") print(f\"\u041e\u043f\u0442\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0438\u0437 2-\u0433\u043e \u043c\u0435\u0441\u0442\u043e\u0440\u043e\u0436\u0434\u0435\u043d\u0438\u044f: {res.x[1]:.2f} \u0442\u043e\u043d\u043d\") print(f\"\u041c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u0430\u044f \u0441\u0442\u043e\u0438\u043c\u043e\u0441\u0442\u044c: {res.fun:.2f} \u0443.\u0435.\")  # \u041f\u043e\u0441\u0442\u0440\u043e\u0438\u043c \u043e\u0431\u043b\u0430\u0441\u0442\u044c \u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c\u044b\u0445 \u0440\u0435\u0448\u0435\u043d\u0438\u0439 x1 = np.linspace(6000, 10000, 500)  # \u0423\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044f \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u0439 (\u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u043a x2) # 1) a11*x1 + a12*x2 &gt;= b1 =&gt; x2 &gt;= (b1 - a11*x1)\/a12 x2_1 = (6500 - a11*x1)\/a12 # 2) a21*x1 + a22*x2 &gt;= b2 =&gt; x2 &gt;= (b2 - a21*x1)\/a22 x2_2 = (3000 - a21*x1)\/a22  # \u0412\u0438\u0437\u0443\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f plt.figure(figsize=(10, 6), dpi=150) plt.plot(x1, x2_1, label=r'\u041a\u0430\u043c\u043d\u0438: $0.65x_{1} + 0.825x_{2} \u2265 6500$') plt.plot(x1, x2_2, label=r'\u041f\u0435\u0441\u043e\u043a: $0.35x_{1} + 0.175x_{2} \u2265 3000$') plt.fill_between(x1, np.maximum(x2_1, x2_2), 10000, alpha=0.1, label='\u041e\u0431\u043b\u0430\u0441\u0442\u044c \u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c\u044b\u0445 \u0440\u0435\u0448\u0435\u043d\u0438\u0439')  # \u041e\u043f\u0442\u0438\u043c\u0430\u043b\u044c\u043d\u0430\u044f \u0442\u043e\u0447\u043a\u0430 plt.scatter(res.x[0], res.x[1], color='red', zorder=100,             label=f'\u041e\u043f\u0442\u0438\u043c\u0443\u043c ({res.x[0]:.0f}, {res.x[1]:.0f})')  # \u041b\u0438\u043d\u0438\u0438 \u043f\u043e\u0441\u0442\u043e\u044f\u043d\u043d\u043e\u0439 \u0441\u0442\u043e\u0438\u043c\u043e\u0441\u0442\u0438 for cost in [20000, 21489, 22000]:     x2_cost = (cost - c1*x1)\/c2     plt.plot(x1, x2_cost, '--', alpha=0.3, label=f'\u0421\u0442\u043e\u0438\u043c\u043e\u0441\u0442\u044c={cost}' if cost==21489 else None)  plt.xlim(6000, 10000) plt.ylim(0, 4000) plt.xlabel(r'\u041a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0438\u0437 1-\u0433\u043e \u043c\u0435\u0441\u0442\u043e\u0440\u043e\u0436\u0434\u0435\u043d\u0438\u044f ($x_{1}$), \u0442\u043e\u043d\u043d') plt.ylabel(r'\u041a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0438\u0437 2-\u0433\u043e \u043c\u0435\u0441\u0442\u043e\u0440\u043e\u0436\u0434\u0435\u043d\u0438\u044f ($x_{2}$), \u0442\u043e\u043d\u043d') plt.title('\u041e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u044f \u0437\u0430\u043a\u0443\u043f\u043a\u0438 \u0433\u0440\u0430\u0432\u0438\u044f \u0434\u043b\u044f \u0444\u0443\u043d\u0434\u0430\u043c\u0435\u043d\u0442\u0430') plt.legend() plt.show()<\/code><\/pre>\n<p> <\/div>\n<\/p><\/div>\n<p> <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/j4\/22\/x-\/j422x-cg-ytpnzuv9bh5qs5q5-4.png\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/webt\/j4\/22\/x-\/j422x-cg-ytpnzuv9bh5qs5q5-4.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/webt\/j4\/22\/x-\/j422x-cg-ytpnzuv9bh5qs5q5-4.png 781w\" loading=\"lazy\" decode=\"async\"\/><br \/> \u0421\u0442\u043e\u0438\u043c\u043e\u0441\u0442\u044c \u043e\u043f\u0442\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0441\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 21489 \u0443.\u0435. \u2014 \u0437\u0430\u043f\u043e\u043c\u043d\u0438\u043c \u044d\u0442\u043e.<\/p>\n<p> \u0422\u0435\u043f\u0435\u0440\u044c \u0440\u0435\u0448\u0438\u043c \u0437\u0430\u0434\u0430\u0447\u0443 \u0432 \u0441\u0442\u043e\u0445\u0430\u0441\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u043f\u043e\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0435. <\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">\u041a\u043e\u0434 \u0434\u043b\u044f \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0438 \u043e\u0442\u0440\u0438\u0441\u043e\u0432\u043a\u0438<\/b>                         <\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"python\"># \u041f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0439 a11_range = [0.6, 0.7] a12_range = [0.75, 0.9] c1_range = [2.2, 2.5] c2_range = [1.7, 2.1] b1, b2 = 6500, 3000 n_samples = 10000  # \u0427\u0438\u0441\u043b\u043e \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u0435\u0432 \u041c\u043e\u043d\u0442\u0435-\u041a\u0430\u0440\u043b\u043e  # \u0413\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u044f \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0445 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 np.random.seed(42) a11_samples = np.random.uniform(a11_range[0], a11_range[1], n_samples) a12_samples = np.random.uniform(a12_range[0], a12_range[1], n_samples) c1_samples = np.random.uniform(c1_range[0], c1_range[1], n_samples) c2_samples = np.random.uniform(c2_range[0], c2_range[1], n_samples) a21_samples = 1 - a11_samples a22_samples = 1 - a12_samples  # \u0426\u0435\u043b\u0435\u0432\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f (\u043e\u0436\u0438\u0434\u0430\u0435\u043c\u0430\u044f \u0441\u0442\u043e\u0438\u043c\u043e\u0441\u0442\u044c) def expected_cost(x, c1_samples, c2_samples):     return np.mean(c1_samples * x[0] + c2_samples * x[1])  def objective(x):     return expected_cost(x, c1_samples, c2_samples)  # \u041e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u044f \u0432 \u0432\u0438\u0434\u0435 \u0448\u0442\u0440\u0430\u0444\u0430 (soft constraints) def constraint1(x):     return np.mean(a11_samples * x[0] + a12_samples * x[1] &gt;= b1) - 0.7  def constraint2(x):     return np.mean(a21_samples * x[0] + a22_samples * x[1] &gt;= b2) - 0.9  # \u0428\u0442\u0440\u0430\u0444\u043d\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f def penalized_objective(x):     cost = objective(x)     penalty = 0     if constraint1(x) &lt; 0:         penalty += 1e6 * abs(constraint1(x))     if constraint2(x) &lt; 0:         penalty += 1e6 * abs(constraint2(x))     return cost + penalty  # \u041e\u0431\u043b\u0430\u0441\u0442\u044c \u043f\u043e\u0438\u0441\u043a\u0430 bounds = [(0, 10000), (0, 10000)]  result = differential_evolution(penalized_objective, bounds) print(f\"\u041e\u043f\u0442\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430: x1 = {result.x[0]:.2f}, x2 = {result.x[1]:.2f}\") print(f\"\u041e\u0436\u0438\u0434\u0430\u0435\u043c\u0430\u044f \u0441\u0442\u043e\u0438\u043c\u043e\u0441\u0442\u044c: {result.fun:.2f} \u0443.\u0435.\")  # \u0413\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u044f \u043b\u0438\u043d\u0438\u0439 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u0439 \u0438 \u0441\u0442\u043e\u0438\u043c\u043e\u0441\u0442\u0438 \u0434\u043b\u044f \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0445 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 plt.figure(figsize=(12, 8)) for i in range(100):  # \u0420\u0438\u0441\u0443\u0435\u043c 100 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0445 \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u0435\u0432     a11, a12 = a11_samples[i], a12_samples[i]     a21, a22 = 1 - a11, 1 - a12     c1, c2 = c1_samples[i], c2_samples[i]          # \u041b\u0438\u043d\u0438\u0438 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u0439     x1 = np.linspace(6000, 11000, 100)     x2_stones = (b1 - a11 * x1) \/ a12     x2_sand = (b2 - a21 * x1) \/ a22     plt.plot(x1, x2_stones, 'C1-', alpha=0.3, label='\u041a\u0430\u043c\u043d\u0438' if i==0 else None)     plt.plot(x1, x2_sand, 'C0-', alpha=0.3, label='\u041f\u0435\u0441\u043e\u043a' if i==0 else None)          # \u041b\u0438\u043d\u0438\u0438 \u043f\u043e\u0441\u0442\u043e\u044f\u043d\u043d\u043e\u0439 \u0441\u0442\u043e\u0438\u043c\u043e\u0441\u0442\u0438     #x2_cost = (result.fun - c1 * x1) \/ c2     #plt.plot(x1, x2_cost, 'g-', alpha=0.05)  # \u041e\u043f\u0442\u0438\u043c\u0430\u043b\u044c\u043d\u0430\u044f \u0442\u043e\u0447\u043a\u0430 plt.scatter(result.x[0], result.x[1], c='red', s=80, zorder=100,             label=f'\u041e\u043f\u0442\u0438\u043c\u0443\u043c ({res.x[0]:.0f}, {res.x[1]:.0f})')  plt.legend() plt.ylim(0, 5000) plt.xlabel(r'\u041a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0438\u0437 1-\u0433\u043e \u043c\u0435\u0441\u0442\u043e\u0440\u043e\u0436\u0434\u0435\u043d\u0438\u044f ($x_{1}$), \u0442\u043e\u043d\u043d') plt.ylabel(r'\u041a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0438\u0437 2-\u0433\u043e \u043c\u0435\u0441\u0442\u043e\u0440\u043e\u0436\u0434\u0435\u043d\u0438\u044f ($x_{2}$), \u0442\u043e\u043d\u043d') plt.title('\u041e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u044f \u0437\u0430\u043a\u0443\u043f\u043a\u0438 \u0433\u0440\u0430\u0432\u0438\u044f \u0434\u043b\u044f \u0444\u0443\u043d\u0434\u0430\u043c\u0435\u043d\u0442\u0430\\n(100 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0445 \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u0435\u0432)')  plt.show()<\/code><\/pre>\n<p> <\/div>\n<\/p><\/div>\n<p> <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/by\/ek\/kf\/byekkf4bpnup2kx--te52fafwc8.png\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/webt\/by\/ek\/kf\/byekkf4bpnup2kx--te52fafwc8.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/webt\/by\/ek\/kf\/byekkf4bpnup2kx--te52fafwc8.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<p> \u0421\u0442\u043e\u0438\u043c\u043e\u0441\u0442\u044c \u043e\u043f\u0442\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0440\u0435\u0448\u0435\u043d\u0438\u044f 23222 \u0443.\u0435., \u0447\u0442\u043e \u0430\u0436 \u043d\u0430 1733 \u0443.\u0435. \u0431\u043e\u043b\u044c\u0448\u0435, \u0447\u0435\u043c \u0432 \u00ab\u0434\u0435\u0442\u0435\u0440\u043c\u0438\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u043c\u00bb \u0441\u043b\u0443\u0447\u0430\u0435. \u041f\u043e\u0447\u0435\u043c\u0443 \u0442\u0430\u043a? \u041c\u044b \u0437\u0430\u043f\u043b\u0430\u0442\u0438\u043b\u0438 \u0437\u0430 \u0433\u0430\u0440\u0430\u043d\u0442\u0438\u0438 \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0433\u043e \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u043a\u0430\u043c\u043d\u0435\u0439 \u0431\u0443\u0434\u0435\u0442 \u0432 80%-\u0445 \u0441\u043b\u0443\u0447\u0430\u0435\u0432, \u0430 \u043f\u0435\u0441\u043a\u0430 \u0432 95%-\u0445. \u0412 \u0447\u0435\u043c \u043b\u0435\u0433\u043a\u043e \u0443\u0431\u0435\u0434\u0438\u0442\u044c\u0441\u044f, \u0435\u0441\u043b\u0438 \u043f\u0440\u043e\u043a\u0440\u0443\u0442\u0438\u0442\u044c \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u0435\u0432.<\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">\u041a\u043e\u0434 \u0434\u043b\u044f \u043e\u0442\u0440\u0438\u0441\u043e\u0432\u043a\u0438<\/b>                         <\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"python\">x = result.x f, ax = plt.subplots(1, 3, figsize=(12, 3), dpi=150) sns.histplot(a11_samples * x[0] + a12_samples * x[1], stat='density', ax=ax[0]) ax[0].axvline(b1, c='C3') sns.histplot(a21_samples * x[0] + a22_samples * x[1], stat='density', ax=ax[1]) ax[1].axvline(b2, c='C3') sns.histplot(c1_samples * x[0] + c2_samples * x[1], stat='density', ax=ax[2]); ax[2].axvline(expected_cost(x, c1_samples, c2_samples), c='C3')  ax[0].set_title('\u041a\u0430\u043c\u043d\u0438') ax[1].set_title('\u041f\u0435\u0441\u043e\u043a') ax[2].set_title('\u0421\u0442\u043e\u0438\u043c\u043e\u0441\u0442\u044c')  ax[1].set_ylabel('') ax[2].set_ylabel('')  plt.show()<\/code><\/pre>\n<p> <\/div>\n<\/p><\/div>\n<p> <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/py\/c7\/_o\/pyc7_opqewr0ciee0vupe-efhhq.png\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/webt\/py\/c7\/_o\/pyc7_opqewr0ciee0vupe-efhhq.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/webt\/py\/c7\/_o\/pyc7_opqewr0ciee0vupe-efhhq.png 781w\" loading=\"lazy\" decode=\"async\"\/><br \/> \u0415\u0441\u043b\u0438 \u0435\u0441\u0442\u044c \u0440\u0438\u0441\u043a \u043d\u0435\u0441\u043e\u0431\u043b\u044e\u0434\u0435\u043d\u0438\u044f \u0442\u0435\u0445.\u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430 \u043f\u0440\u0438\u0433\u043e\u0442\u043e\u0432\u043b\u0435\u043d\u0438\u044f \u0431\u0435\u0442\u043e\u043d\u0430 \u0438 \u0435\u0433\u043e \u043c\u043e\u0433\u0443\u0442 \u0437\u0430\u0431\u0440\u0430\u043a\u043e\u0432\u0430\u0442\u044c, \u0442\u043e \u043b\u0443\u0447\u0448\u0435 \u0437\u0430\u043f\u043b\u0430\u0442\u0438\u0442\u044c \u0437\u0430 \u0441\u0442\u0440\u0430\u0445\u043e\u0432\u043a\u0443 \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c SP. \u0415\u0441\u043b\u0438 \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u043a\u0430\u043a\u0438\u0435-\u0442\u043e \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0438 \u0440\u0430\u0437\u0443\u043c\u043d\u044b\u0435 \u0433\u0438\u043f\u043e\u0442\u0435\u0437\u044b, \u0442\u043e \u0438\u0445 \u0442\u043e\u0436\u0435 \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043f\u0443\u0442\u0435\u043c \u0443\u0442\u043e\u0447\u043d\u0435\u043d\u0438\u044f \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0439.<\/p>\n<p> \u0412\u0430\u0436\u043d\u043e \u043f\u043e\u043d\u0438\u043c\u0430\u0442\u044c, \u0447\u0442\u043e SP \u2014 \u044d\u0442\u043e \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0447\u0442\u043e-\u0442\u043e \u0432\u0440\u043e\u0434\u0435 \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c\u0430 \u0441\u0430\u043c\u043e\u0441\u0442\u0440\u0430\u0445\u043e\u0432\u0430\u043d\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0442\u043e\u0436\u0435 \u0441\u0442\u043e\u0438\u0442 \u0434\u0435\u043d\u0435\u0433. \u041d\u043e \u044d\u0442\u043e\u0442 \u0436\u0435 \u0441\u0430\u043c\u044b\u0439 \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c \u043e\u0447\u0435\u043d\u044c \u0445\u043e\u0440\u043e\u0448\u043e \u0437\u0430\u0449\u0438\u0449\u0430\u0435\u0442 \u043e\u0442 \u043d\u0435\u0431\u043b\u0430\u0433\u043e\u043f\u0440\u0438\u044f\u0442\u043d\u044b\u0445 \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u0435\u0432. \u0425\u043e\u0447\u0435\u0448\u044c, \u0447\u0442\u043e\u0431\u044b \u0432\u0441\u0435 \u0431\u044b\u043b\u043e \u00ab\u0440\u043e\u0432\u043d\u043e\u00bb \u2014 \u043f\u043b\u0430\u0442\u0438. \u0412\u043e\u0442 \u0442\u0430\u043a\u0430\u044f \u043e\u043d\u0430, \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u044c.<\/p>\n<h2>\u041d\u0435\u043f\u0440\u0435\u0440\u044b\u0432\u043d\u0430\u044f \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u044f<\/h2>\n<p> \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u0438\u043c, \u0447\u0442\u043e \u043c\u044b \u0438\u0433\u0440\u0430\u0435\u043c \u0432 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0443\u044e \u0438\u0433\u0440\u0443. \u0415\u0441\u0442\u044c 100 \u043d\u0435\u043e\u0431\u044b\u0447\u043d\u044b\u0445 \u043c\u043e\u043d\u0435\u0442 \u2014 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c \u0432\u044b\u043f\u0430\u0434\u0435\u043d\u0438\u044f \u043e\u0440\u043b\u0430 \u043d\u0430 \u043a\u0430\u0436\u0434\u043e\u0439 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u0439 \u043c\u043e\u043d\u0435\u0442\u0435 \u043c\u043e\u0436\u0435\u0442 \u043d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0442\u044c\u0441\u044f. \u041c\u043e\u043d\u0435\u0442\u044b \u0431\u0440\u043e\u0441\u0430\u044e\u0442\u0441\u044f \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e, \u043e\u0434\u043d\u0430 \u0437\u0430 \u0434\u0440\u0443\u0433\u043e\u0439. \u0415\u0441\u043b\u0438 \u0432\u044b\u043f\u0430\u0434\u0430\u0435\u0442 \u043e\u0440\u0435\u043b, \u0442\u043e \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u043d\u0430\u0433\u0440\u0430\u0434\u0443, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043e\u0431\u0440\u0430\u0442\u043d\u043e\u043f\u0440\u043e\u043f\u043e\u0440\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u0430 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u0438 \u0435\u0433\u043e \u0432\u044b\u043f\u0430\u0434\u0435\u043d\u0438\u044f. \u0415\u0441\u043b\u0438 \u0432\u044b\u043f\u0430\u0434\u0430\u0435\u0442 \u0440\u0435\u0448\u043a\u0430, \u0442\u043e \u043c\u044b \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c. \u0418\u0433\u0440\u0430 \u043e\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u0442\u0441\u044f, \u0435\u0441\u043b\u0438 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0432\u044b\u043f\u0430\u0432\u0448\u0438\u0445 \u043e\u0440\u043b\u043e\u0432 \u0441\u0442\u0430\u043b\u043e \u0440\u0430\u0432\u043d\u043e 50 \u0438\u043b\u0438 \u0435\u0441\u043b\u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u043e \u043f\u043e\u0434\u0431\u0440\u0430\u0441\u044b\u0432\u0430\u043d\u0438\u0435 \u0432\u0441\u0435\u0445 \u0441\u0442\u0430 \u043c\u043e\u043d\u0435\u0442. \u0426\u0435\u043b\u044c \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043d\u0430\u0438\u0431\u043e\u043b\u044c\u0448\u0443\u044e \u0441\u0443\u043c\u043c\u0430\u0440\u043d\u0443\u044e \u043d\u0430\u0433\u0440\u0430\u0434\u0443.<\/p>\n<p> \u041a\u0430\u043a\u0430\u044f \u0441\u0442\u0440\u0430\u0442\u0435\u0433\u0438\u044f \u0438\u0433\u0440\u044b \u0431\u0443\u0434\u0435\u0442 \u043e\u043f\u0442\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0439?<\/p>\n<h3>\u041d\u0430\u0438\u0432\u043d\u0430\u044f \u0441\u0442\u0440\u0430\u0442\u0435\u0433\u0438\u044f<\/h3>\n<p> \u0421\u0430\u043c\u044b\u0439 \u043d\u0430\u0438\u0432\u043d\u044b\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e\u0431\u044b \u0432\u044b\u0431\u0440\u0430\u0442\u044c \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u0443\u044e \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c \u0434\u043b\u044f \u0432\u0441\u0435\u0445 \u043c\u043e\u043d\u0435\u0442, \u043f\u0443\u0441\u0442\u044c \u043e\u043d\u0430 \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0432\u043d\u0430 0.5, \u0442\u043e\u0433\u0434\u0430 \u043c\u044b \u0443\u0432\u0438\u0434\u0438\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435:<\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">\u041a\u043e\u0434<\/b>                         <\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"python\">def naive_strategy():     p = 0.5          heads = bernoulli.rvs(p=p, size=100)     count_heads = np.cumsum(heads)          if count_heads[-1] &lt; 50:         total_revard = count_heads[-1] * (1 \/ 0.5)         count_steps = 100     else:         total_revard = 50 * (1 \/ 0.5)         count_steps = np.where(count_heads &gt;= 50)[0][0] + 1     return total_revard, count_steps  data_naive_strategy = np.array([naive_strategy() for i in range(3000)])  total_reward = np.mean(data_naive_strategy[:, 0]) total_flips = np.mean(data_naive_strategy[:, 1])  f, ax = plt.subplots(1, 2, figsize=(10, 4), dpi=150) sns.histplot(data_naive_strategy[:, 0], discrete=True, ax=ax[0]) ax[0].axvline(total_reward, c='C3') sns.histplot(data_naive_strategy[:, 1], discrete=True, ax=ax[1]) ax[1].axvline(total_flips, c='C3')  ax[0].set_title(f'\u041e\u0431\u0449\u0430\u044f \u043d\u0430\u0433\u0440\u0430\u0434\u0430 (\u0432 \u0441\u0440\u0435\u0434\u043d\u0435\u043c: {total_reward:.2f})') ax[1].set_title(f'\u041a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0431\u0440\u043e\u0441\u043a\u043e\u0432 (\u0432 \u0441\u0440\u0435\u0434\u043d\u0435\u043c: {total_flips:.2f})') plt.show()<\/code><\/pre>\n<p> <\/div>\n<\/p><\/div>\n<p> <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/xk\/l1\/ee\/xkl1eecgcmj8s8vgzukv3njsdoc.png\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/webt\/xk\/l1\/ee\/xkl1eecgcmj8s8vgzukv3njsdoc.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/webt\/xk\/l1\/ee\/xkl1eecgcmj8s8vgzukv3njsdoc.png 781w\" loading=\"lazy\" decode=\"async\"\/> <\/p>\n<h4>\u0416\u0430\u0434\u043d\u0430\u044f \u0441\u0442\u0440\u0430\u0442\u0435\u0433\u0438\u044f<\/h4>\n<p> \u041b\u043e\u0433\u0438\u0447\u043d\u043e \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u043e\u0436\u0438\u0442\u044c, \u0447\u0442\u043e \u043d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u044f \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c \u043c\u043e\u043d\u0435\u0442\u044b \u043f\u0440\u0438 \u043a\u0430\u0436\u0434\u043e\u043c \u0431\u0440\u043e\u0441\u043a\u0435, \u043d\u0430\u0434\u043e \u043e\u0440\u0438\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u043d\u0430 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043e\u0441\u0442\u0430\u0432\u0448\u0438\u0445\u0441\u044f \u0431\u0440\u043e\u0441\u043a\u043e\u0432 \u0438 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0443\u0436\u0435 \u0432\u044b\u043f\u0430\u0432\u0448\u0438\u0445 \u043e\u0440\u043b\u043e\u0432. \u041d\u0430\u0432\u0435\u0440\u043d\u044f\u043a\u0430 \u0442\u0430\u043a \u0431\u0443\u0434\u0435\u0442 \u043b\u0443\u0447\u0448\u0435. \u041f\u0440\u043e\u0432\u0435\u0440\u0438\u043c.<\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">\u041a\u043e\u0434<\/b>                         <\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"python\">import numpy as np  def greedy_strategy(n_coins=100, max_heads=50):     remaining_heads = max_heads     remaining_coins = n_coins     rewards = []      for t in range(n_coins):         if remaining_heads == 0:             break  # \u0418\u0433\u0440\u0430 \u043e\u043a\u043e\u043d\u0447\u0435\u043d\u0430         p = remaining_heads \/ remaining_coins         flip = np.random.rand() &lt; p         if flip:             reward = 1 \/ p             rewards.append(reward)             remaining_heads -= 1         remaining_coins -= 1      return sum(rewards), t  data_greedy_strategy= np.array([greedy_strategy() for _ in range(10000)])  total_reward = np.mean(data_greedy_strategy[:, 0]) total_flips = np.mean(data_greedy_strategy[:, 1])  f, ax = plt.subplots(1, 2, figsize=(10, 4), dpi=150) sns.histplot(data_greedy_strategy[:, 0], ax=ax[0]) ax[0].axvline(np.mean(data_greedy_strategy[:, 0]), c='C3') sns.histplot(data_greedy_strategy[:, 1], discrete=True, ax=ax[1]) ax[1].axvline(np.mean(data_greedy_strategy[:, 1]), c='C3')  ax[0].set_title(f'\u041e\u0431\u0449\u0430\u044f \u043d\u0430\u0433\u0440\u0430\u0434\u0430 (\u0432 \u0441\u0440\u0435\u0434\u043d\u0435\u043c: {total_reward:.2f})') ax[1].set_title(f'\u041a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0431\u0440\u043e\u0441\u043a\u043e\u0432 (\u0432 \u0441\u0440\u0435\u0434\u043d\u0435\u043c: {total_flips:.2f})') plt.show()<\/code><\/pre>\n<p> <\/div>\n<\/p><\/div>\n<p> <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/qw\/xc\/hx\/qwxchxep2rs-kcfuukkmx99e9ek.png\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/webt\/qw\/xc\/hx\/qwxchxep2rs-kcfuukkmx99e9ek.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/webt\/qw\/xc\/hx\/qwxchxep2rs-kcfuukkmx99e9ek.png 781w\" loading=\"lazy\" decode=\"async\"\/><br \/> \u0418 \u043f\u0440\u0430\u0432\u0434\u0430 \u0441\u0442\u0430\u043b\u043e \u0433\u043e\u0440\u0430\u0437\u0434\u043e \u043b\u0443\u0447\u0448\u0435. \u041d\u043e \u043d\u0435\u0442 \u043b\u0438 \u0442\u0443\u0442 \u043a\u0430\u043a\u043e\u0433\u043e-\u0442\u043e \u043f\u043e\u0434\u0432\u043e\u0445\u0430 \u2014 \u043f\u043e\u0447\u0435\u043c\u0443 \u0441\u0440\u0435\u0434\u043d\u044f\u044f \u043e\u0431\u0449\u0430\u044f\u044f \u043d\u0430\u0433\u0440\u0430\u0434\u0430 \u043d\u0435 \u0440\u0430\u0432\u043d\u0430 100, \u0430 \u0432\u0441\u0435\u0433\u043e 99 \u0441 \u043a\u043e\u043f\u0435\u0439\u043a\u0430\u043c\u0438?<\/p>\n<h4>\u0421\u0442\u043e\u0445\u0430\u0441\u0442\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u0441\u0442\u0440\u0430\u0442\u0435\u0433\u0438\u044f<\/h4>\n<p> \u0416\u0430\u0434\u043d\u044b\u0435 \u0441\u0442\u0440\u0430\u0442\u0435\u0433\u0438\u0438 \u043f\u0440\u043e\u0441\u0442\u044b, \u0438\u043d\u0442\u0443\u0438\u0442\u0438\u0432\u043d\u044b, \u043d\u043e \u043d\u0435 \u0443\u0447\u0438\u0442\u044b\u0432\u0430\u044e\u0442 \u043d\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u0441\u0442\u044c \u0431\u0443\u0434\u0443\u0449\u0435\u0433\u043e. \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u0443\u044e \u0441\u0442\u0440\u0430\u0442\u0435\u0433\u0438\u044e. <\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">\u041a\u043e\u0434<\/b>                         <\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"python\"># \u041f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u0438\u0433\u0440\u044b n_coins = 100 max_heads = 50  # \u0422\u0430\u0431\u043b\u0438\u0446\u044b \u043f\u043e\u043b\u0438\u0442\u0438\u043a \u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 V = np.zeros((n_coins + 2, max_heads + 1))  # V[t][s] policy = np.zeros((n_coins + 2, max_heads + 1))  # \u0421\u0435\u0442\u043a\u0430 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u0435\u0439 p_values = np.linspace(0.01, 1.0, 100)  # \u041e\u0431\u0440\u0430\u0442\u043d\u0430\u044f \u043f\u0440\u043e\u0433\u043e\u043d\u043a\u0430 for t in range(n_coins, 0, -1):     for s in range(max_heads, -1, -1):         if s &gt;= max_heads:             policy[t][s] = 0.0             continue          best_value = -np.inf         best_p = 0.01          for p in p_values:             reward_hit = 1.0 \/ p             next_s = min(s + 1, max_heads)              value = p * (reward_hit + V[t + 1][next_s]) + (1 - p) * V[t + 1][s]              # \u0428\u0442\u0440\u0430\u0444 \u0437\u0430 \u043c\u0430\u043b\u0435\u043d\u044c\u043a\u0438\u0435 p             penalty = 0.01 * (1.0 \/ p)             value -= penalty              if value &gt; best_value:                 best_value = value                 best_p = p          # \u041c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u0430\u044f \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c         best_p = max(best_p, 0.01)          V[t][s] = best_value         policy[t][s] = best_p  def dynamic_strategy(policy, n_coins=100, max_heads=50):     total_reward = 0.0     used_heads = 0     flips_made = 0      for t in range(1, n_coins + 1):         if used_heads &gt;= max_heads:             break  # \u041b\u0438\u043c\u0438\u0442 \u043e\u0440\u043b\u043e\u0432 \u0438\u0441\u0447\u0435\u0440\u043f\u0430\u043d          # \u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u043e\u043f\u0442\u0438\u043c\u0430\u043b\u044c\u043d\u0443\u044e \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c \u0438\u0437 \u043f\u043e\u043b\u0438\u0442\u0438\u043a\u0438         p = policy[t][used_heads]          # \u0411\u0440\u043e\u0441\u043e\u043a \u043c\u043e\u043d\u0435\u0442\u044b         flip = np.random.rand() &lt; p         flips_made += 1          if flip:             reward = 1.0 \/ p             total_reward += reward             used_heads += 1      return total_reward, flips_made  data_dynamic_strategy = np.array([dynamic_strategy(policy, n_coins=100, max_heads=50) for _ in range(10000)])  total_reward = np.mean(data_dynamic_strategy[:, 0]) total_flips = np.mean(data_dynamic_strategy[:, 1])  f, ax = plt.subplots(1, 2, figsize=(10, 4), dpi=150) sns.histplot(data_dynamic_strategy[:, 0], ax=ax[0]) ax[0].axvline(np.mean(data_dynamic_strategy[:, 0]), c='C3') sns.histplot(data_dynamic_strategy[:, 1], discrete=True, ax=ax[1]) ax[1].axvline(np.mean(data_dynamic_strategy[:, 1]), c='C3')  ax[0].set_title(f'\u041e\u0431\u0449\u0430\u044f \u043d\u0430\u0433\u0440\u0430\u0434\u0430 (\u0432 \u0441\u0440\u0435\u0434\u043d\u0435\u043c: {total_reward:.2f})') ax[1].set_title(f'\u041a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0431\u0440\u043e\u0441\u043a\u043e\u0432 (\u0432 \u0441\u0440\u0435\u0434\u043d\u0435\u043c: {total_flips:.2f})') plt.show()<\/code><\/pre>\n<p> <\/div>\n<\/p><\/div>\n<p> <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/8h\/of\/lk\/8hoflkdenj4v89kicxieny195oq.png\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/webt\/8h\/of\/lk\/8hoflkdenj4v89kicxieny195oq.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/webt\/8h\/of\/lk\/8hoflkdenj4v89kicxieny195oq.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<p> \u0412\u043e\u0442 \u0442\u0435\u043f\u0435\u0440\u044c \u0441\u0440\u0435\u0434\u043d\u0438\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043e\u0431\u0449\u0435\u0433\u043e \u0432\u044b\u0438\u0433\u0440\u044b\u0448\u0430 \u0438 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u0431\u0440\u043e\u0441\u043a\u043e\u0432 \u043c\u043e\u043d\u0435\u0442\u044b \u043e\u0447\u0435\u043d\u044c \u0431\u043b\u0438\u0437\u043a\u0438 \u043a 100.<\/p>\n<p> \u0415\u0441\u043b\u0438 \u0447\u0435\u0441\u0442\u043d\u043e, \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u044f \u0433\u0434\u0435-\u0442\u043e \u0447\u0442\u043e-\u0442\u043e \u043d\u0435 \u0442\u0430\u043a \u043d\u0430\u043a\u043e\u0434\u0438\u043b. \u041d\u043e \u043e\u043f\u044f\u0442\u044c \u0436\u0435 \u043f\u043e \u043e\u043f\u044b\u0442\u0443 \u043c\u043e\u0433\u0443 \u0441\u043a\u0430\u0437\u0430\u0442\u044c, \u0447\u0442\u043e \u0432 \u0441\u0442\u043e\u0445\u0430\u0441\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u0438\u0433\u0440\u0430\u0445 \u043b\u0443\u0447\u0448\u0435 \u043d\u0435 \u043f\u043e\u043b\u0430\u0433\u0430\u0442\u044c\u0441\u044f \u043d\u0430 \u0430\u043d\u0430\u043b\u0438\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u044f. \u0412 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u043d\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u0441\u0442\u044c\u044e, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0432\u043c\u0435\u0441\u0442\u043e \u043c\u043e\u043d\u0435\u0442\u044b \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043f\u043e\u043a\u0443\u043f\u0430\u0442\u0435\u043b\u044c, \u0430 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c\u044e \u043f\u043e\u043a\u0443\u043f\u043a\u0438 \u0438\u043c \u043a\u0430\u043a\u043e\u0433\u043e-\u043d\u0438\u0431\u0443\u0434\u044c \u0442\u043e\u0432\u0430\u0440\u0430 \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0446\u0435\u043d\u044b. \u041d\u043e \u0432 \u044d\u0442\u043e\u0439 \u0436\u0435 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0443 \u043f\u043e\u043a\u0443\u043f\u0430\u0442\u0435\u043b\u044f \u0435\u0441\u0442\u044c \u0441\u0432\u043e\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u043f\u043e\u043b\u0435\u0437\u043d\u043e\u0441\u0442\u0438, \u0430 \u043d\u0430\u0433\u0440\u0430\u0434\u0430 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0441\u043b\u043e\u0436\u043d\u0435\u0435. \u0410\u043d\u0430\u043b\u0438\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u2014 \u044d\u0442\u043e \u043e\u0447\u0435\u043d\u044c \u043a\u0440\u0443\u0442\u043e, \u043d\u043e \u0438\u043d\u043e\u0433\u0434\u0430 \u043e\u043d\u0438 \u043f\u043e\u043b\u0443\u0447\u0430\u044e\u0442\u0441\u044f \u0441\u043b\u0438\u0448\u043a\u043e\u043c \u0441\u043b\u043e\u0436\u043d\u044b\u043c\u0438, \u0441 \u043e\u0433\u0440\u043e\u043c\u043d\u044b\u043c \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u043e\u043c \u0434\u043b\u044f \u043e\u0448\u0438\u0431\u043e\u043a. \u0418\u043d\u043e\u0433\u0434\u0430 \u043b\u0443\u0447\u0448\u0435 \u0432\u0441\u0435-\u0442\u0430\u043a\u0438 \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f RL.<\/p>\n<h2>\u0412 \u0437\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/h2>\n<p> \u041b\u0443\u0447\u0448\u0430\u044f \u0441\u0442\u0440\u0430\u0442\u0435\u0433\u0438\u044f \u2014 \u044d\u0442\u043e \u0432\u043e\u0441\u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0442\u044c \u043c\u0438\u0440 \u0442\u0430\u043a\u0438\u043c, \u043a\u0430\u043a\u043e\u0439 \u043e\u043d \u0435\u0441\u0442\u044c, \u0438 SP \u043e\u0447\u0435\u043d\u044c \u0445\u043e\u0440\u043e\u0448\u043e \u0432\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0432 \u044d\u0442\u0443 \u043f\u0430\u0440\u0430\u0434\u0438\u0433\u043c\u0443.<\/p>\n<p> \u0421\u043b\u0438\u0448\u043a\u043e\u043c \u043c\u043d\u043e\u0433\u043e \u0432\u0441\u0435\u0433\u043e \u043e\u0441\u0442\u0430\u043b\u043e\u0441\u044c \u0437\u0430 \u043a\u0430\u0434\u0440\u043e\u043c. \u041c\u0430\u043b\u043e \u0442\u0435\u043e\u0440\u0438\u0438, \u0444\u043e\u0440\u043c\u0443\u043b, \u0441\u0442\u0440\u043e\u0433\u0438\u0445 \u043e\u0431\u043e\u0441\u043d\u043e\u0432\u0430\u043d\u0438\u0439, \u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u043e\u0433\u043b\u044f\u043d\u0438\u0442\u0435\u0441\u044c \u0432\u043e\u043a\u0440\u0443\u0433, \u0437\u0430\u0434\u0443\u043c\u0430\u0439\u0442\u0435\u0441\u044c: \u0432\u0441\u0435, \u0447\u0442\u043e \u043d\u0430\u0441 \u043e\u043a\u0440\u0443\u0436\u0430\u0435\u0442 \u2014 \u044d\u0442\u043e \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0447\u044c\u0438\u0445-\u0442\u043e \u043f\u043b\u0430\u043d\u043e\u0432. \u0421\u043a\u043e\u043b\u044c\u043a\u043e \u041c\u042b \u0442\u0435\u0440\u044f\u0435\u043c, \u0438\u0433\u043d\u043e\u0440\u0438\u0440\u0443\u044f \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u043e\u0441\u0442\u044c. \u0416\u0438\u0437\u043d\u044c \u0432 \u0434\u0435\u0442\u0435\u0440\u043c\u0438\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u043c \u043c\u0438\u0440\u0435 \u2014 \u044d\u0442\u043e \u0438\u043b\u043b\u044e\u0437\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043e\u0431\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0441\u043b\u0438\u0448\u043a\u043e\u043c \u0434\u043e\u0440\u043e\u0433\u043e \u0430\u0431\u0441\u043e\u043b\u044e\u0442\u043d\u043e \u0432\u0441\u0435\u0433\u0434\u0430 \u0438 \u0432\u0435\u0437\u0434\u0435 \u043e\u0442 \u0437\u0434\u0440\u0430\u0432\u043e\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u0434\u043e \u044d\u043a\u043e\u043d\u043e\u043c\u0438\u043a\u0438.<\/p><\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/articles\/924770\/\"> https:\/\/habr.com\/ru\/articles\/924770\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-1\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\u0412\u0441\u0435 \u043c\u044b \u043f\u0440\u0435\u043a\u0440\u0430\u0441\u043d\u043e \u0437\u043d\u0430\u0435\u043c, \u0447\u0442\u043e \u043e\u0447\u0435\u043d\u044c \u0447\u0430\u0441\u0442\u043e \u043d\u0430\u0448\u0438 \u043f\u043b\u0430\u043d\u044b \u0438\u0434\u0443\u0442 \u043d\u0435 \u043f\u043e \u043f\u043b\u0430\u043d\u0443 \u0438\u043c\u0435\u043d\u043d\u043e \u0438\u0437-\u0437\u0430 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u043e\u0441\u0442\u0435\u0439. \u0412 \u0442\u0430\u043a\u0438\u0435 \u043c\u043e\u043c\u0435\u043d\u0442\u044b \u043e\u0447\u0435\u043d\u044c \u0442\u0440\u0443\u0434\u043d\u043e \u043e\u0431\u043e\u0439\u0442\u0438\u0441\u044c \u0431\u0435\u0437 \u0436\u0430\u0440\u0433\u043e\u043d\u0438\u0437\u043c\u043e\u0432, \u043d\u0435\u0446\u0435\u043d\u0437\u0443\u0440\u043d\u043e\u0439 \u0431\u0440\u0430\u043d\u0438 \u0438 \u043e\u0442\u0431\u043e\u0440\u043d\u043e\u0433\u043e \u0442\u0440\u0435\u0445\u044d\u0442\u0430\u0436\u043d\u043e\u0433\u043e. \u041d\u043e \u0432\u0441\u0435 \u0436\u0435 \u0435\u0441\u0442\u044c \u0441\u043f\u043e\u0441\u043e\u0431 \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043d\u0430\u0448\u0438 \u043f\u043b\u0430\u043d\u044b \u0431\u043e\u043b\u0435\u0435 \u0443\u0441\u0442\u043e\u0439\u0447\u0438\u0432\u044b\u043c\u0438 \u0438 \u0441\u043e\u0441\u0442\u043e\u044f\u0442\u0435\u043b\u044c\u043d\u044b\u043c\u0438 \u2014 \u044d\u0442\u043e \u0441\u0442\u043e\u0445\u0430\u0441\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 (\u0434\u0430\u043b\u0435\u0435 SP \u2014 stochastic programming).<\/p>\n<p> <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/3g\/pf\/xy\/3gpfxy6ex9j-6ftabuuyc8ak_fm.png\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/webt\/3g\/pf\/xy\/3gpfxy6ex9j-6ftabuuyc8ak_fm.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/webt\/3g\/pf\/xy\/3gpfxy6ex9j-6ftabuuyc8ak_fm.png 781w\" loading=\"lazy\" decode=\"async\"\/> <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-465997","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/465997","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=465997"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/465997\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=465997"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=465997"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=465997"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}