iam-git / WellMet (public) (License: MIT) (since 2021-08-31) (hash sha1)
WellMet is pure Python framework for spatial structural reliability analysis. Or, more specifically, for "failure probability estimation and detection of failure surfaces by adaptive sequential decomposition of the design domain".
List of commits:
Subject Hash Author Date (UTC)
dicebox._exploration: rework explore() af54a2693f6da4d874ade55f02990c87ed7ce9c7 I am 2023-01-24 09:54:51
convex_hull.QHull: implement erfc and gammaincc-based outside integrations for now ad0a665b53b6c8ca24a215c0e4ca73a5c1d145ad I am 2023-01-23 19:29:09
convex_hull.QHull: accept integrational crime 788f3ffe604a4cac9d19382250dd5ebe3cd5befc I am 2023-01-21 13:09:31
convex_hull.QHull: normal fix 083bbdc4cb41fdb3e357b1d0359705a2a65d6d27 I am 2023-01-20 19:07:17
convex_hull.QHull: implement chi cubature integration 7537b642967b7dd5d8475c20aff2a930a5bcd3ad I am 2023-01-20 15:54:05
convex_hull: implement QHullCubature class 6f1b51ba6fe281f7cae4f44889db96787d916a99 I am 2023-01-20 10:46:54
convex_hull.QHull: add proof-of-concept get_inside() method 6013fbac742d6070771d7798c928538ebc54495e I am 2023-01-19 10:19:32
whitebox: add r exact for common nD boxes 7c4ab62f069f0efeb48a403dac5d27033003ded2 I am 2023-01-17 15:09:08
qt_gui: improve GRaph to show r-R bounds 59fa5bde7be2197b1f739bd1f829f927cef62603 I am 2023-01-17 14:26:16
dicebox.circumtri: calculate event's radia c6868cfbde7c8a86b73217da544f60e94a117bd8 I am 2023-01-16 06:12:34
simplex.Triangulation.get_averaged_mixed_normals: implement deep averaging 6dfb056e477479331c7a903ea52a98301fca4e71 I am 2023-01-15 23:26:43
replace flatten() by reshape(-1) everywhere. The former always allocates new array 97b35c989a5ad8e459bb60133222d50c7f78e1f0 I am 2023-01-15 12:04:30
qt_gui.qt_gui: explicitly export sample_box to console's namespace dd2e50245157082ddb645b693a8a8c573215d50c I am 2023-01-15 11:42:01
replace everywhere np.bool by just bool (it looks like newer numpy dropped it) ac208f89bbf0ad76d38790686041ea778a9b6376 I am 2023-01-15 11:31:56
simplex._Triangulation: implement averaged gradients() f6608597cf490dd6cf1a6af3b7d8e6d0a72732d9 I am 2023-01-15 09:37:14
add line and two lines problems for sensitivity analysis 0c620f7960399ed8b34e02d663772d0eb34e66f1 I am 2023-01-14 08:30:56
simplex.FullCubatureIntegration.get_sensitivities: do not normalize global gradient c648c484a5599a00236ab70c36cdf407c24f5306 I am 2023-01-14 04:51:16
simplex: implement sensitivities 65056319c51fd93deb76ce14e52c08869dfc04a2 I am 2023-01-13 11:27:46
mplot.maxes: prepare GRaph plot 68774535915af3deaf6104a0bbe9b3c4d24c0cec I am 2023-01-12 02:43:20
mplot.mgraph.tri_estimation_plot: use planar vertex estimator 1d300fa56248be9cdab5a4e5b0d4372f68fd5255 I am 2023-01-11 15:48:28
Commit af54a2693f6da4d874ade55f02990c87ed7ce9c7 - dicebox._exploration: rework explore()
Author: I am
Author date (UTC): 2023-01-24 09:54
Committer name: I am
Committer date (UTC): 2023-01-24 09:54
Parent(s): ad0a665b53b6c8ca24a215c0e4ca73a5c1d145ad
Signer:
Signing key:
Signing status: N
Tree: 2c05bbf75165a74caea1b62a2757e89cf6e156f3
File Lines added Lines deleted
wellmet/convex_hull.py 8 7
wellmet/dicebox/_exploration.py 34 14
File wellmet/convex_hull.py changed (mode: 100644) (index d12f786..6c21f9a)
... ... class BrickHull: #č nebo BoundingBrick
424 424 def get_exploration_vector(hull): def get_exploration_vector(hull):
425 425 hull._update() hull._update()
426 426 to_fire = np.nanargmax(hull.b) to_fire = np.nanargmax(hull.b)
427 return hull.A[to_fire], hull.b[to_fire]
427 return hull.A[to_fire], hull.b[to_fire], hull.sample
428 428
429 429 # shortcut for Ghull # shortcut for Ghull
430 430 # valid only if space==G # valid only if space==G
 
... ... class DirectHull:
668 668 def get_exploration_vector(hull): def get_exploration_vector(hull):
669 669 hull._update() hull._update()
670 670 to_fire = np.nanargmax(hull.b) to_fire = np.nanargmax(hull.b)
671 return hull.A[to_fire], hull.b[to_fire]
671 return hull.A[to_fire], hull.b[to_fire], hull.sample
672 672
673 673 # shortcut for Ghull # shortcut for Ghull
674 674 # valid only if space==G # valid only if space==G
 
... ... class QHull:
992 992 def get_exploration_vector(hull): def get_exploration_vector(hull):
993 993 hull._update() hull._update()
994 994 if hull.enough_points: if hull.enough_points:
995 to_fire = np.nanargmax(hull.b)
996 return hull.A[to_fire], hull.b[to_fire]
995 to_sample = np.nanargmax(hull.b)
996 sample = hull.sample[hull.simplices[to_sample]]
997 return hull.A[to_sample], hull.b[to_sample], sample
997 998 else: else:
998 return DirectHull(self.sample, self.fallback_plan, self.space).get_exploration_vector()
999 return DirectHull(hull.sample, hull.fallback_plan, hull.space).get_exploration_vector()
999 1000
1000 1001
1001 1002 # shortcut for Ghull # shortcut for Ghull
 
... ... class Grick:
1429 1430 def get_exploration_vector(hull): def get_exploration_vector(hull):
1430 1431 hull._update() hull._update()
1431 1432 if hull.bm[0] > (-hull.bp[0]): if hull.bm[0] > (-hull.bp[0]):
1432 return -hull.orth_basis[0], hull.bm[0]
1433 return -hull.orth_basis[0], hull.bm[0], hull.sample
1433 1434 else: else:
1434 return hull.orth_basis[0], -hull.bp[0]
1435 return hull.orth_basis[0], -hull.bp[0], hull.sample
1435 1436
1436 1437
1437 1438
File wellmet/dicebox/_exploration.py changed (mode: 100644) (index 41e448f..5c80972)
... ... import numpy as np
6 6 import quadpy import quadpy
7 7
8 8 from ..ghull import Ghull from ..ghull import Ghull
9 from ..convex_hull import Grick
9 from .. import convex_hull as khull
10 10 from .. import simplex as sx from .. import simplex as sx
11 11 from ..reader import Store from ..reader import Store
12 12 from .. import sball from .. import sball
13 13
14 from scipy import stats
15 from scipy import spatial
14 16
15 17 from collections import namedtuple from collections import namedtuple
16 18 from sortedcollections import ValueSortedDict from sortedcollections import ValueSortedDict
 
... ... from sortedcollections import ValueSortedDict
24 26
25 27 class _Exploration: class _Exploration:
26 28
29 outer_budget = 100
30 psi_q = 0.5
27 31
28 32 def __call__(bx): def __call__(bx):
29 33 if bx.nsim < 1: # je to legální if bx.nsim < 1: # je to legální
 
... ... class _Exploration:
40 44
41 45
42 46 def explore(bx): def explore(bx):
47 # empirical rule to get desired behavior
43 48 p_desired = np.exp(-np.sqrt(bx.q * bx.nsim)) p_desired = np.exp(-np.sqrt(bx.q * bx.nsim))
49
50 # get matematically clean radius of it
44 51 r = bx.sball.get_r(p_desired) r = bx.sball.get_r(p_desired)
45 if bx.nsim > len(bx.direct_plan):
46 a, b = bx.convex_hull.get_exploration_vector()
47 R = -b
48 else:
49 a = bx.direct_plan[bx.nsim-1]
50 R = bx.ghull.get_R()
52
53 #č konkretně tato třída je pevně napojena na G prostor
54 #č ale bacha, kbyby se to změnilo...
55 assert bx.convex_hull.space == 'G'
56
57 a, b, _sample = bx.convex_hull.get_exploration_vector()
58 R = -b
51 59
52 60 if r < R: if r < R:
53 61 bx._logger(msg='refine (fallbacked)!') bx._logger(msg='refine (fallbacked)!')
54 62 return bx.refine() return bx.refine()
55 63
56 sample_G = a * r
57 bx._logger(msg='explore!')
58 return bx.f_model.new_sample(sample_G, space='G')
59
60
61
64 orth_nodes_T = np.random.randn(len(a), bx.outer_budget) # len(a) == ndim
65 orth_basis = khull.get_orth_basis(a)
66 sample_from = stats.norm.sf(r)
67 t = np.linspace(sample_from, 0, bx.outer_budget, endpoint=False)
68 orth_nodes_T[0] = stats.norm.isf(t)
69
70 outside_nodes_G = (orth_basis.T @ orth_nodes_T).T
71 outside_nodes = bx.f_model.new_sample(outside_nodes_G, space='G')
62 72
73 tree = spatial.KDTree(bx.G, compact_nodes=True, balanced_tree=False)
74 d1, i1 = tree.query(outside_nodes_G, k=1)
63 75
76 PDF = bx.pdf('G')
64 77
78 nodes_pdf = outside_nodes.pdf('G')
79 node_potentials = d1**bx.nvar * nodes_pdf**bx.psi_q * PDF[i1]**(1-bx.psi_q)
65 80
81 max_node = np.argmax(node_potentials)
82
83 bx._logger(msg='explore!')
84 return outside_nodes[max_node]
85
66 86
67 87
68 88
 
... ... class DumbExploration(_Exploration):
98 118
99 119 bx.direct_plan = quadpy.un.mysovskikh_1(bx.nvar).points bx.direct_plan = quadpy.un.mysovskikh_1(bx.nvar).points
100 120
101 bx.convex_hull = Grick(bx.f_model, bx.direct_plan, nrandom=50)
121 bx.convex_hull = khull.Grick(bx.f_model, bx.direct_plan, nrandom=50)
102 122 bx.q = q bx.q = q
103 123
104 124 bx.ghull = Ghull(bx.convex_hull) bx.ghull = Ghull(bx.convex_hull)
Hints:
Before first commit, do not forget to setup your git environment:
git config --global user.name "your_name_here"
git config --global user.email "your@email_here"

Clone this repository using HTTP(S):
git clone https://rocketgit.com/user/iam-git/WellMet

Clone this repository using ssh (do not forget to upload a key first):
git clone ssh://rocketgit@ssh.rocketgit.com/user/iam-git/WellMet

Clone this repository using git:
git clone git://git.rocketgit.com/user/iam-git/WellMet

You are allowed to anonymously push to this repository.
This means that your pushed commits will automatically be transformed into a merge request:
... clone the repository ...
... make some changes and some commits ...
git push origin main