algebraicjulia / combinatorialchains.jl Goto Github PK
View Code? Open in Web Editor NEWHome Page: https://www.algebraicjulia.org
Home Page: https://www.algebraicjulia.org
This issue is reminder, if work continues on this repo, to replace ConjunctiveQueryHomomorphism.jl
with the upstreamed functionality in Catlab (AlgebraicJulia/Catlab.jl#506), when that functionality is tagged and released.
J₀ = @acset IsingModel begin
V1 = 9
L1 = 12
src1 = [1,2,5,5,5,5,7,8,3,6,1,4]
tgt1 = [2,3,2,4,6,8,8,9,6,9,4,7]
end
m = homomorphisms(codom(rule(4)[1]), J₀, monic=true)[1]
J₁ = rewrite_match(rule(4)..., m)
to_graphviz(J₁)
function rewrite_ising(j::IsingCats.AbstractIsingModel, T, maxtries=100)
# choose a random rule
for i in 1:maxtries
l,r = rule(rand(0:4))
if rand(Bool)
r,l = l,r
end
# l,r = rule(4)
qₗ = homomorphism_query(codom(l))
matches = query(j, qₗ)
@show length(matches)
αs = map(ρ -> make_homomorphism(matches[ρ], codom(l), j),
1:length(matches))
# quick hack for "monic on V1"
αs = filter(αs) do α
length(unique(collect(components(α).V1))) == length(collect(components(α).V1))
end
@show length(αs)
for α in αs
println(components(α).V1)
end
αs = filter(α->valid_dpo(l, α), αs)
@show length(αs)
if length(αs) > 0
for i in 1:maxtries
# compute table of matches
# pick random match
@show ρ = rand(1:length(αs))
α = αs[ρ]
@show components(α)
@show valid_dpo(l, α)
@show accept_rewrite(Span(l, r), T)
if valid_dpo(l, α) && accept_rewrite(Span(l, r), T)
α₂ = rewrite_match(l, r, α)
return α₂
end
end
end
end
error("Could not find a valid match in $maxtries attempts")
end
K = rewrite_ising(J₀, 2, 80)
to_graphviz(K)
One of the problems with our current implementation is that the rule are oriented but the underlying phenomenon isn't oriented this means that after you match a rule you might not be able to match other rules, because of the changes to the orientation. We should be using the SymmetricIsingModel schema, but before we do that, we can just make the systems and rules symmetric by adding in all the reciprocal edges.
In order to present results, we should probably:
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.