-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enh/ml beneath beyond #7
base: master
Are you sure you want to change the base?
Conversation
…t an alias also properly fill the NodeMap and EdgeMap
51e4934
to
b943655
Compare
I rebased onto master;
If it were possible (with little effort) I'd keep it as a separate library (it's of very specialized use), but all solutions I could think of are rather elaborate, hence this pull. @benlorenz let me know what do you think. |
Please also update the corresponding branch in Polymake.jl for the tests to succeed. Apart from that it is fine I think, I will have a closer look later. For the name we could maybe use |
yes; maybe then
will do; will it automatically detect |
That's also fine yes, I just wanted something other than
Yes, it will look for a branch in Polymake.jl with the same name as the branch here and use that (or fall back to master), see https://github.com/oscar-system/libpolymake-julia/pull/7/checks?check_run_id=1358349236#step:11:15. |
ok, so now I get crashes in
or
|
I am slightly confused why |
oh, I see; I thought here's a snippet to stress-out using Polymake,Random
const N = 5
min_perm = collect(1:2^N)
min_size = let c = polytope.cube(N)
bb = Polymake.BeneathBeyond(deepcopy(c.VERTICES), perm=min_perm)
collect(bb)
Polymake.triangulation_size(bb)
end
while true
c = polytope.cube(N)
bb = GC.@preserve c begin
Polymake.BeneathBeyond(deepcopy(c.VERTICES))
end
perm = randperm(2^N)
for n in perm
bb = deepcopy(bb)
Polymake.add_point!(bb, n)
end
s = Polymake.triangulation_size(bb)
if s < min_size
min_perm = perm
min_size = s
println("")
@info Polymake.triangulation_size(bb)
else
print(".")
end
end this run endlessly without ERROR: Integer/Rational NaN
Stacktrace:^[[A
[1] _bb_add_point! at /home/kalmar/.julia/packages/CxxWrap/ZOkSN/src/CxxWrap.jl:590 [inlined]
[2] add_point!(::Polymake.BeneathBeyond{Polymake.Rational}, ::Int64) at /home/kalmar/.julia/dev/Polymake/src/beneath_beyond.jl:48
[3] top-level scope at ./REPL[5]:11 or signal (11): Segmentation fault
in expression starting at REPL[5]:1
operator* at /home/kalmar/.julia/artifacts/f115f08730885160f615c5575bccf08aa26eba76/include/polymake/next/Rational.h:959
operator() at /home/kalmar/.julia/artifacts/f115f08730885160f615c5575bccf08aa26eba76/include/polymake/internal/operations_basic_defs.h:123 [inlined]
operator* at /home/kalmar/.julia/artifacts/f115f08730885160f615c5575bccf08aa26eba76/include/polymake/internal/iterators.h:2565 [inlined]
accumulate<pm::TransformedContainerPair<pm::Vector<pm::Rational>&, pm::IndexedSlice<pm::masquerade<pm::ConcatRows, const pm::Matrix_base<pm::Rational>&>, const pm::Series<long int, true>, polymake::mlist<> >&, pm::BuildBinary<pm::operations::mul> >, pm::BuildBinary<pm::operations::add> > at /home/kalmar/.julia/artifacts/f115f08730885160f615c5575bccf08aa26eba76/include/polymake/internal/operations.h:1114 [inlined]
operator*<pm::Vector<pm::Rational>&, pm::IndexedSlice<pm::masquerade<pm::ConcatRows, const pm::Matrix_base<pm::Rational>&>, const pm::Series<long int, true>, polymake::mlist<> > > at /home/kalmar/.julia/artifacts/f115f08730885160f615c5575bccf08aa26eba76/include/polymake/GenericVector.h:531
coord_full_dim at /home/kalmar/.julia/artifacts/f115f08730885160f615c5575bccf08aa26eba76/include/polymake/polytope/beneath_beyond_impl.h:985
update_facets at /home/kalmar/.julia/artifacts/f115f08730885160f615c5575bccf08aa26eba76/include/polymake/polytope/beneath_beyond_impl.h:835
process_point at /home/kalmar/local/src/libpolymake-julia/src/beneath_beyond.cpp:183
operator() at /usr/include/c++/10.2.0/bits/std_function.h:622 [inlined]
operator() at /home/kalmar/.julia/artifacts/fd5dfb5dee87c41c238d98bd7ff2fdd4f307e824/include/jlcxx/module.hpp:58 [inlined]
apply at /home/kalmar/.julia/artifacts/fd5dfb5dee87c41c238d98bd7ff2fdd4f307e824/include/jlcxx
_bb_add_point! at /home/kalmar/.julia/packages/CxxWrap/ZOkSN/src/CxxWrap.jl:590 [inlined]
add_point! at /home/kalmar/.julia/dev/Polymake/src/beneath_beyond.jl:48
unknown function (ip: 0x7f665ef87109) the snippets crashing with |
Probably
- copy(bb.rays),
- copy(bb.lineality),
+ bb.rays,
+ bb.lineality, Or we need something like With this change it is running for a few minutes now (with the deepcopy in place). |
thanks! that's spot on and does the trick! After reading through code of |
|
On Mon, Nov 09, 2020 at 05:54:29AM -0800, Benjamin Lorenz wrote:
`finish`, `finalize` (is probably bad in the julia context?), `postprocess` ?
There is not much cleaning involved, it will make sure the facet normals are valid, add the empty facet and the missing simplex when the polytope is just a point and make sure that the graph has a sequential node numbers in the full-dimensional case (no gaps).
finish!
is what we use to finialze assembly of multivariate polynomials
(MPolyBuildCtx)...
… --
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
#7 (comment)
|
while true
let N = 5, c = polytope.cube(N)
@assert N >= 3
pts = c.VERTICES
bb = Polymake.BeneathBeyond(pts)
sizes = Vector{Int}(undef, 100)
for p in rand(1:2^(N-2))
Polymake.add_point!(bb, p)
end
Threads.@threads for i = 1:length(sizes)
bb_new = deepcopy(bb)
bb_new.perm = randperm(2^N)
collect(bb_new) # will only add new points
sizes[i] = Polymake.triangulation_size(bb_new)
end
@info "minimal size $(minimum(sizes))"
end
end on the corresponding Polymake.jl branch this crashes with rather short message, e.g.
(this runs just fine is you set |
Changes for the script:
Adjusted binaries for
When the binaries are uploaded you can try dev'ing those two repos. Then the above script might work with |
I pushed some extra locking to the Polymake.jl branch that should allow copying from inside the thread as well. while true
let N = 5, c = polytope.cube(N)
@assert N >= 3
pts = c.VERTICES
bb = Polymake.BeneathBeyond(pts)
sizes = Vector{Int}(undef, 100)
for p in rand(1:2^N,rand(1:2^(N-1)))
Polymake.add_point!(bb, p)
end
Threads.@threads for i = 1:length(sizes)
bbcopy = deepcopy(bb)
bbcopy.perm = randperm(2^N)
collect(bbcopy) # will only add new points
sizes[i] = Polymake.triangulation_size(bbcopy)
end
@info "minimal size $(minimum(sizes))"
end
end |
I kept
beneath_beyond_algo_for_ml
inpolymake::polytope
namespace, for it was much easier to overload methods without prefixing, but that can be changed if not desired.