Commit 1fff6d4a authored by Jayant Khatkar's avatar Jayant Khatkar
Browse files

minor edits

parent 6e0967bf
......@@ -12,17 +12,18 @@ Tcutoff = 100 # temperature above which strain isn't happening
[σ̄*0.375 σ̄*0.375 σ̄*0.75 ]
]
ABS = material(α_ABS, E_ABS, σ̄_ABS, Tcutoff)
td = tempdecay(215, 25, 0.04) # extrusion temp, room temp, decay rate
tdmed = tempdecay(215, 25, 0.04) # extrusion temp, room temp, decay rate
tdslow = tempdecay(215, 25, 0.01)
tdfast = tempdecay(215, 25, 0.08)
# visualise_tempdecay(tdfast)
visualise_tempdecay(tdslow)
td=tdmed
add = "/Users/jayant/phd/tempaware/models/"
### MAIN LOOP
results = JSON.parse(open(add * "results.json"))
results = Dict()# JSON.parse(open(add * "results.json"))
n_local_searches = 100
max_iterations = 250
k = 150
......@@ -36,6 +37,7 @@ obj_add = add * obj
contours = clean_contour.(contour.(JSON.parse(open(obj_add * "contours.json"))))
cdata = contourdata(contours, 40, 2) # contour data
@time vd = voxdata(obj_add * "_voxels.csv", cdata)
stress_multiplier!(vd.voxels,10)
println("Constructing Cost function...")
construct_cost(cdata, vd, ABS, td, f_name)
construct_cost_hist(cdata, vd, ABS, td)
......@@ -57,15 +59,15 @@ plot(rl_g)
println("Doing local search " * string(n_local_searches) * " times")
#Threads.@threads
for i in 1:n_local_searches
rl = random_rollout(cdata)
rl = greedish_rollout(cdata)
random_cost = cost_func(rl) # change to random
println("RANDOM COST: " * string(random_cost))
update_result(results, obj, rl, random_cost, :random)
# println("RANDOM COST: " * string(random_cost))
update_result(results, obj, rl, random_cost, :greedish)
local_cost = local_search!(rl, max_iterations)
println("LOCAL COST: " * string(local_cost))
# println("LOCAL COST: " * string(local_cost))
update_result(results, obj, rl, local_cost, :local)
end
results[obj]
println(results[obj])
save_result(results, add * "results.json")
......@@ -99,28 +101,28 @@ plot(rl_l, cdata)
plot(results)
# plot before and after histograms
c_d = cost_hist(rl_d)
c_d = cost_hist(rl_d)
histogram(
c_d,
bins=50,
label="Default " * string(sum(c_d)),
title=obj,
opacity=0.5,
opacity=0.3,
c=:blue)
vline!([maximum(c_d)], c=:blue)
vline!([maximum(c_d)], c=:blue, label="Max Default")
c_g = cost_hist(rl_g)
histogram!(
c_g,
bins=50,
label="greedy " * string(sum(c_g)),
opacity=0.5,
opacity=0.3,
c=:orange)
vline!([maximum(c_g)], c=:orange)
vline!([maximum(c_g)], c=:orange, label="Max Greedy")
c_l = cost_hist(rl_l)
histogram!(
c_l,
bins=50,
label="local_search " * string(sum(c_l)),
opacity=0.5,
opacity=0.3,
c=:green)
vline!([maximum(c_l)], c=:green)
\ No newline at end of file
vline!([maximum(c_l)], c=:green, label="Max Local")
\ No newline at end of file
......@@ -739,6 +739,7 @@ function construct_cost_hist(cdata::contourdata, vd::voxdata, mat::material, td:
println(size(rel_voxels)[1])
relmaps = vd.maps
vox_area_scaling = min.(abs.(1 ./ rel_voxels.AreaRatio),1)
#vox_area_scaling = ones(length(1 ./ rel_voxels.AreaRatio))
# voxtimes vectorize
max_contours_per_voxel = maximum([length(r.seglen) for r in relmaps])
......
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