implemented save and reload functionality.

temporaryWork^2
youainti 4 years ago
parent f8d3643329
commit f17ba05d7f

@ -14,7 +14,7 @@ using BSON: @save,@load
using Dates,BSON
# ╔═╡ eb25eb64-eb6c-48e0-8db6-d9705e397689
using Plots
using Plots,Zygote #need to include zygote to be able to save and export data
# ╔═╡ fe446c7e-ed8c-4a0b-8bc9-024806f9f352
md"""
@ -625,7 +625,7 @@ pl(s1,d1)[1]
# ╔═╡ 2b115364-a8ce-4eb9-a324-7ac213061b83
begin
N_epoch = 60
N_epoch = 6
data_gen = UniformDataConstructor(2_000,0,200,0,4000)
end
@ -800,48 +800,75 @@ begin
@save model_name pl
end
# ╔═╡ 3b58537f-201b-4dc2-99e8-faabd9ce400f
gr() #set backend
# ╔═╡ ca1e02b6-8c78-4a94-8c7c-7d9ec6cffbca
#reload model
BSON.load(model_name, @__MODULE__)[:pl]
# ╔═╡ 08820cf2-38cc-4451-9b6e-91475c396d6e
pl
# ╔═╡ 188deb3a-18db-4d10-a4e8-89c6fd6e9302
md"""
## Proto Kessler Region Analysis
"""
# ╔═╡ 3b58537f-201b-4dc2-99e8-faabd9ce400f
#gr() #set backend
plotly()
# ╔═╡ 109519b1-096f-46a0-91a7-6f0e5508a947
begin
kessler_field = []
stocks = []
debris = []
debris_updates = []
constellatin_index=1
#debris simulations
#get average stocks
= zero(data1[1][1])
#process data
for (s,d) in data1
a = pl.policy((s,d))
#=
It would be good to redefine this as a simulation with other details etc.
=#
+= s
end
= /200
for (s,d) in data1
=
[constellatin_index] = s[constellatin_index]
s = G(s,d,a)
d = H(s,d,a)
= pl.policy((,d))
d = H(,d,)
ϵ = d-d
append!(kessler_field, ϵ)
append!(stocks, s[1])
append!(debris, d)
append!(debris_updates, d)
end
end
# ╔═╡ 9ff075a3-cea6-466a-bc7d-ee2f85dc226e
length(kessler_field),length(stocks),length(debris)
# ╔═╡ 416c6b30-6139-4855-86d3-44b59c76e48a
surface(stocks,debris,kessler_field)
#= FIX
Currently dealing with the issue that there is only a single stock illustrated here, not multiple, and they are randomly selected.
I need to control/standardize the other 3 constellations to get a meaningful graph
=#
# ╔═╡ c85467b1-03f6-40da-8138-886245e1f29f
contour(stocks
,debris
,kessler_field
,xlabel="Constellation #$(constellatin_index) stocks"
,ylabel="Debris levels"
,title="Debris transition levels"
,color=:blues
)
# ╔═╡ 4f87d6c3-ef9d-4930-9a6a-acaae31cbb82
debris
# ╔═╡ 5c909bf7-9500-4ffa-a65d-91ddd155f675
debris_updates #issue here
# ╔═╡ 00000000-0000-0000-0000-000000000001
PLUTO_PROJECT_TOML_CONTENTS = """
@ -852,12 +879,14 @@ Flux = "587475ba-b771-5e3f-ad9e-33799f191a9c"
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
Plots = "91a5bcdd-55d7-5caf-9e0b-520d859cae80"
PlutoUI = "7f904dfe-b85e-4ff6-b463-dae2292396a8"
Zygote = "e88e6eb3-aa80-5325-afca-941959d7151f"
[compat]
BSON = "~0.3.4"
Flux = "~0.12.8"
Plots = "~1.23.6"
PlutoUI = "~0.7.18"
Zygote = "~0.6.30"
"""
# ╔═╡ 00000000-0000-0000-0000-000000000002
@ -1905,9 +1934,9 @@ version = "1.5.0+0"
[[Zygote]]
deps = ["AbstractFFTs", "ChainRules", "ChainRulesCore", "DiffRules", "Distributed", "FillArrays", "ForwardDiff", "IRTools", "InteractiveUtils", "LinearAlgebra", "MacroTools", "NaNMath", "Random", "Requires", "SpecialFunctions", "Statistics", "ZygoteRules"]
git-tree-sha1 = "0fc9959bcabc4668c403810b4e851f6b8962eac9"
git-tree-sha1 = "2c30f2df0ba43c17e88c8b55b5b22c401f7cde4e"
uuid = "e88e6eb3-aa80-5325-afca-941959d7151f"
version = "0.6.29"
version = "0.6.30"
[[ZygoteRules]]
deps = ["MacroTools"]
@ -2019,10 +2048,14 @@ version = "0.9.1+5"
# ╠═7f42b201-01ec-4d63-b8de-92e735f28e4a
# ╟─baac6c78-e3cc-4b4f-8945-2bb4109f1489
# ╠═65cf41b8-adf4-42b9-82dc-d2fbafccda81
# ╠═3b58537f-201b-4dc2-99e8-faabd9ce400f
# ╠═ca1e02b6-8c78-4a94-8c7c-7d9ec6cffbca
# ╠═08820cf2-38cc-4451-9b6e-91475c396d6e
# ╠═188deb3a-18db-4d10-a4e8-89c6fd6e9302
# ╠═3b58537f-201b-4dc2-99e8-faabd9ce400f
# ╠═109519b1-096f-46a0-91a7-6f0e5508a947
# ╠═9ff075a3-cea6-466a-bc7d-ee2f85dc226e
# ╠═416c6b30-6139-4855-86d3-44b59c76e48a
# ╠═c85467b1-03f6-40da-8138-886245e1f29f
# ╠═4f87d6c3-ef9d-4930-9a6a-acaae31cbb82
# ╠═5c909bf7-9500-4ffa-a65d-91ddd155f675
# ╟─00000000-0000-0000-0000-000000000001
# ╟─00000000-0000-0000-0000-000000000002

Loading…
Cancel
Save