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)
simplex: novej bombastickej... ok, I mean, new elegant Shull object 28375fa49a07057f09f1afeb8d4916b0f1bc87ac Олёш 2020-09-30 23:18:25
blackbox, simplex: WIP f66479b0e3f8ce8866466a263cd80ba227098c82 Олёш 2020-09-29 00:57:33
blackbox, simplex: WIP 255033055fd2db7ab1445618cfe476c14b527d22 Олёш 2020-09-28 19:58:06
simplex: helper functions are prepared df48adbb92dd80421d0ec4e6c087db7919cda7c7 Олёш 2020-09-28 17:42:24
blackbox: .regen() refactoring 4064e769a19cc853028701853ff29de53782b08c Олёш 2020-09-27 01:24:34
blackbox: little refactoring c3669a2889c1b7056113c70d0b7bb1bb9aaa6593 Олёш 2020-09-26 15:13:48
IS_stat.ISSI: ZeroDivisionError fix 981eb1025f4059497172a0c6b71bee3fb9516a14 Олёш 2020-09-15 22:26:36
blackbox: BlackSimpleX is ready 683da8add2bafd4da2352b2e8fdabdb416daa02e Олёш 2020-09-15 22:25:00
blackbox: simplex optimalization WIP d81905dc1b143b6b6cbf8148a08469fe6227fea5 Олёш 2020-09-15 17:31:50
qt_plot: equal aspect option added 3c1325528bf84d42252a6e68e9649c38bbf2aa98 I am 2020-09-10 00:51:41
qt_plot: QSplitter is applied for estimation widgets 3f8733dbc62b341e1e53bb68ec044229beb86ff7 I am 2020-09-10 00:09:05
IS_stat: little fix in ISSI.get_estimations() 419c963e3188a6286af1f13fe9d69893c3036630 I am 2020-09-09 18:49:28
gl_plot: changes from qt_plot backported f6267793c711e877587ba1208b5a7638925e186d Alex 2020-09-09 17:47:48
plot: switch to refactored qt_plot 0c0c50c06cc3b135a85d825cf5cf31f83f84216d Олёш 2020-09-09 16:39:40
qt_plot: finally refactored and Simplex Graph updated b81f6c276ab9153ac86c26fe2c47cd6b4504d1db Олёш 2020-09-09 16:33:49
qt_plot: just playing 068010ed53213845fa29fc49b18a6edf65fe0c08 Олёш 2020-09-08 22:27:09
qt_plot: FastSimplexEstimationWidget is ready 07210b295638e9022589630bc1fb2a9b7ba5bae6 Олёш 2020-09-08 19:33:31
qt_plot: WIP simplex widget 9c801dee251d9ba17cae0c254df8ca9a2fb88753 Олёш 2020-09-07 22:59:23
qt_plot: polishing (mainly, triangulation) a4d9fd7f841f9f56ee6ff0725315e988b0a683b5 Олёш 2020-09-05 01:53:06
qt_plot: refactoring, WIP 0dffc07efa9557f5660b0be669b4e42ff7b049e8 Олёш 2020-09-04 23:21:58
Commit 28375fa49a07057f09f1afeb8d4916b0f1bc87ac - simplex: novej bombastickej... ok, I mean, new elegant Shull object
Author: Олёш
Author date (UTC): 2020-09-30 23:18
Committer name: Олёш
Committer date (UTC): 2020-09-30 23:20
Parent(s): f66479b0e3f8ce8866466a263cd80ba227098c82
Signer:
Signing key:
Signing status: N
Tree: 9eb560f6a53faa63ce761274d63a71f12e3f8c11
File Lines added Lines deleted
simplex.py 143 1
File simplex.py changed (mode: 100644) (index d74b680..5f20ce6)
3 3
4 4 import numpy as np import numpy as np
5 5 from . import IS_stat from . import IS_stat
6 from . import sball
7 from . import f_models
6 8 from scipy import spatial from scipy import spatial
9 from scipy import stats
10 from .candybox import CandyBox
11
12
13
14
15
16 #č napadlo mě zababáchnuť třidu, která by se sama starala o všem co se tyče
17 #č vnější domény. Nešlo mě totíž to udělat jednou funkcí, bylo by velmi
18 #č špatné z hlediska zodpovednosti kódu. Tak to všecko zabalíme to třidy
19 #č a odebereme z už beztak přetíženého blackboxu část komplexity
20 # keywords: ISSI, estimation, outside, ConvexHull, Sball, IS kolem středních hodnot
21 class Shull: # issi_estimate_outside
22 def __init__(sx, f, nis, model_space, sampling_space=None, powerset_correction=True):
23 #č tím powerset_corretion je myšlena úplná soustava jevů,
24 #č tj. vyrovnaní s použitím míry vnější i vnitřní
25 #č powerset_correction=True přídá -2 (inside) jev do ISSI
26
27 #č zde f-ko musí taky obsahovat vzorky!
28 sx.f = f
29 sx.budget = nis
30 sx.model_space = model_space
31 if sampling_space is None:
32 sx.sampling_space = model_space
33 else:
34 sx.sampling_space = sampling_space
35
36 sampled_plan_model = getattr(f, model_space)
37 #č žádná kontrola chyb - nechť to spadné, když má spadnout!
38 sx.convex_hull = spatial.ConvexHull(sampled_plan_model, incremental=True)
39
40 # current outside probability estimation
41 sx.p_out = 0.5 # implicit value
42 sx.sball = sball.Sball(f.nvar)
43 sx.base_r = sx.sball.get_r(0.5) # we want in average 50/50 ratio
44
45
46 # -1 = 'outside'
47 # -2 = 'inside'
48 #č založme ISSI
49 sx.powerset_correction = powerset_correction
50 #č potřebuji pro korektnost mít před integrací zadané jevy
51 if powerset_correction:
52 sx.oiss = IS_stat.ISSI([-1, -2])
53 else:
54 sx.oiss = IS_stat.ISSI([-1])
55
56
57
58 def increment(sx, input_sample):
59 #č sample by měl byt jíž převeden na f (v .add_sample()),
60 #č zodpovidá za to volajicí kód!
61 sx.convex_hull.add_points(getattr(input_sample, sx.model_space))
62
63
64
65
66 def integrate(sx):
67 # getting rid of the old estimations
68 sx.oiss.delete_event_data(-1)
69 sx.oiss.events.append(-1) #č už tak trošku sahám do vnitřku cizí třidy
70 if sx.powerset_correction:
71 sx.oiss.delete_event_data(-2)
72 sx.oiss.events.append(-2) #č a záse
73
74
75 # first step
76 nodes = sx.sample_sball()
77 mask = nodes.is_outside
78
79
80 cut_off = int(sx.budget/3)
81 #č robím cyklus dokud nesberu dostatečně teček.
82 #č To je fakt nejrobustnější řešení, co mě napadá
83 # while (number_of_out_nodes or number_of_nodes_inside is too little)
84 while (len(mask[mask]) < cut_off) or (len(mask[~mask]) < cut_off):
85 #č je třeba jenom sehnat dostatečně bodíků a utikat
86 nodes.add_sample(sx.sample_sball())
87 mask = nodes.is_outside
88
89
90 return nodes
91
92
93
94 def sample_sball(sx):
95 nvar = sx.f.nvar
96 sampling_r, sx.p_out = sx.sball.get_r_iteration(sx.p_out)
97 #č asi tam bylo sampling_r/base_r, že?
98 #č u stats.norm zadáváme směrodatnou odchylku, je to asi správné
99 h = f_models.UnCorD([stats.norm(0, sampling_r/sx.base_r) for i in range(nvar)])
100 nodes = IS_stat.IS(sx.f, h, space_from_h='R', space_to_f=sx.sampling_space, Nsim=sx.budget)
101
102 #č indikatorová funkce
103 sx.is_outside(nodes)
104
105 # for IS_stats
106 if sx.powerset_correction:
107 #č získáme výrovnaný odhad - je to skoro zdarma
108 #svar = (sampling_r/sx.base_r)**2 # svar like sampling_variance
109 #č kdysi snažil jsem něco odvést, moc se mi to nepovedlo
110 #č je to jen tak, jeden z pokusu, hrubej nastřel
111 #im = svar**nvar * np.exp(nvar/svar - nvar)
112
113 #č radší ne. IM špatně zachycuje nizkou důvěru k tomu, co nemá vlastní tečky
114 sx.oiss.add_IS_serie(nodes.w, nodes.event, implicit_multiplicator=np.inf)
115 outside_measure = sx.oiss.estimations[-1]
116 else:
117 weights = nodes.w[nodes.is_outside]
118 #č IM všecko pokazí, jakmile začnu přídávát další jevy
119 sx.oiss.add_single_event_data(weights, event=-1, nis=sx.budget)
120 # add_single_event_data() do not calculate estimations itself
121 weighted_mean, __, events = sx.oiss.get_means()
122 # outside probability
123 #č nevyrovnané!
124 outside_measure = weighted_mean[events==-1][0]
125
126 #č pro přiště
127 sx.p_out = (sx.p_out + outside_measure) / 2
128
129 return nodes
130
131
132 def is_outside(sx, nodes):
133 node_coordinates = getattr(nodes, sx.model_space)
134 mask = is_outside(sx.convex_hull, node_coordinates)
135
136 # -1 = 'outside'
137 # -2 = 'inside'
138 nodes.event = mask - 2
139 nodes.is_outside = mask
140
141
142
143
144
145
146
147
148
149
7 150
8 151
9 152 #č tato metoda je vlastně pro MinEnergyCensoredSampling #č tato metoda je vlastně pro MinEnergyCensoredSampling
 
... ... def sample_simplex(vertices, model_space, sampling_space, nis):
188 331
189 332
190 333
191
192 334 def is_outside(convex_hull, node_coordinates): def is_outside(convex_hull, node_coordinates):
193 335
194 336 x = node_coordinates x = node_coordinates
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