Commit 81d12f82 authored by Jayant Khatkar's avatar Jayant Khatkar
Browse files

aluminium properties

parent eeaf1938
mater = Al
Al_tds_decay = [tempdecay(1215,25, 0.001), tempdecay(1215,25, 0.01), tempdecay(1215,25, 0.03), tempdecay(1215,25, 0.05), tempdecay(1215,25, 0.1), tempdecay(1215,25, 0.2), tempdecay(1215,25, 0.5), tempdecay(1215,25, 1),tempdecay(1215,25, 10),tempdecay(1215,25, 20),tempdecay(1215,25, 30)]
# different decay rates (Not under our control but whatever)
tds_decay = [tempdecay(215,25, 0.02*i) for i in 1:10]
tds_decay = [tempdecay(1215,25, 0.02*i) for i in 1:10]
push!(tds_decay, tempdecay(215,25, 0.4))
push!(tds_decay, tempdecay(215,25, 0.6))
decay_results = Dict[]
for td in tds_decay #[1:12]
Al_decay_results = Dict[]
for td in Al_tds_decay[end:end]
println(td)
obj="obj" * string(rand(1:1000000))
println(obj)
n_local_searches = 10
n_local_searches = 50
max_iterations = 250
k = 150
# Load data
f_name = Symbol("cost_" * obj)
construct_cost(cdata, vd, ABS, td, f_name)
construct_cost(cdata, vd, mater, td, f_name)
cost_func = getfield(Main, f_name)
construct_best_neighbor(cdata, cost_func, k)
results = Dict()
......@@ -33,7 +34,7 @@ for td in tds_decay #[1:12]
println("Doing local search " * string(n_local_searches) * " times")
#Threads.@threads
for i in 1:n_local_searches
println(i)
# println(i)
rl = random_rollout(cdata)
random_cost = cost_func(rl) # change to random
update_result(results, obj, rl, random_cost, :random)
......@@ -41,16 +42,16 @@ for td in tds_decay #[1:12]
update_result(results, obj, rl, local_cost, :local)
end
println("best LS: " * string(results[obj]["cost_local"]))
push!(decay_results, results[obj])
push!(Al_decay_results, results[obj])
end
ys_default = [r["cost_default"] for r in decay_results]
ys_local = [r["cost_local"] for r in decay_results]
xs = [td.decay_rate for td in tds_decay]
Plots.plot(xs, ys_default, label="Default")
plot!(xs, ys_local, label="Local search")
ys_default = [r["cost_default"] for r in Al_decay_results]
ys_local = [r["cost_local"] for r in Al_decay_results]
xs = [td.decay_rate for td in Al_tds_decay]
# Plots.plot(xs, ys_default./ys_default, label="Default")
Plots.plot(xs, ys_local./ys_default, label="Local search")
Plots.xlabel!("Decay rate")
Plots.ylabel!("Cost")
Plots.ylabel!("Cost relative to default")
# different print speeds
......@@ -70,14 +71,14 @@ for speed in print_speeds
k = 150
# Load data
f_name = Symbol("cost_" * obj)
construct_cost(cdata, vd, ABS, td, f_name)
construct_cost(cdata, vd, mater, td, f_name)
cost_func = getfield(Main, f_name)
construct_best_neighbor(cdata, cost_func, k)
results = Dict()
# default rollout cost
rl_d = Vector(1:length(cdata.contours))
@eval c = cost_func(rl_d)
c = cost_func(rl_d)
update_result(results, obj, rl_d, c, :default)
# greedy rollout cost
......@@ -137,7 +138,7 @@ for i in 1:length(models)#obj in models[3:end]
c.time *= speed
end
f_name = Symbol("cost_" * obj)
construct_cost(cdata, vd, ABS, td, f_name)
construct_cost(cdata, vd, mater, td, f_name)
cost_func = getfield(Main, f_name)
construct_best_neighbor(cdata, cost_func, k)
results = Dict()
......
......@@ -2,7 +2,7 @@ include("utils.jl")
import Plots: histogram
### ABS material properties
α_ABS = 63e-6
α_ABS = 10e-5
E_ABS = 2.5e9 # 1.19e9 - 2.9e9
σ̄ = 6e7 # mega
Tcutoff = 100 # temperature above which strain isn't happening
......@@ -18,6 +18,20 @@ tdfast = tempdecay(215, 25, 0.08)
visualise_tempdecay(tdfast)
td=tdfast
### Aluminium material properties
α_Al = 23.1e-6
E_Al = 70e9
Tcutoff = 600
σ̄ = 90e6
σ̄_Al = [
[σ̄ σ̄*0.5 σ̄*0.375]
[σ̄*0.5 σ̄ σ̄*0.375]
[σ̄*0.375 σ̄*0.375 σ̄*0.75 ]
]
Al = material(α_Al, E_Al, σ̄_Al ,Tcutoff)
Al_tdfast = tempdecay(1300, 25, 0.08)
Al_tdmed = tempdecay(1300, 25, 0.04)
visualise_tempdecay(Al_tdmed)
add = "/Users/jayant/phd/tempaware/models/"
......@@ -27,7 +41,7 @@ n_local_searches = 100
max_iterations = 250
k = 150
obj = "M3"
obj = "M1"
# Load data
f_name = Symbol("cost_" * obj)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment