Commit a7999e9f authored by Jayant Khatkar's avatar Jayant Khatkar
Browse files

valid swaps but dependencies only checked to a depth of 1

parent 076c6ace
......@@ -323,6 +323,39 @@ function random_rollout(prob::problem)
end
function valid_swap(rollout::Vector{Int}, i::Int, j::Int, prob::problem)
# would swapping indices i and j in rollout result in another valid rollout?
# NOTE THIS FUNCTION DOESNT WORK
# IT ONLY CHECKS DEPENDENCIES TO A DEPTH OF 1
if i>j
i,j = j,i
elseif i==j
return true
end
c1 = rollout[i]
c2 = rollout[j]
c2_dependson = inneighbors(prob.G, c2)
if c1 in c2_dependson
return false
end
c1_dependents = outneighbors(prob.G, c1)
c_between = rollout[i+1:j-1]
# method 2
for c in c_between
if c in c1_dependents || c in c2_dependson
return false
end
end
return true
end
#voxels = DataFrames.DataFrame(CSV.File("tensile-1-1.csv"))
contours = contour.(JSON.parse(open("tensilecontours.json")))
dt = problem(contours, 5, 5)
......
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