Skip to content
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

Allow tracking several Statistics during the computation #4

Open
sumiya11 opened this issue Jan 7, 2022 · 7 comments
Open

Allow tracking several Statistics during the computation #4

sumiya11 opened this issue Jan 7, 2022 · 7 comments
Labels
enhancement New feature or request

Comments

@sumiya11
Copy link
Owner

sumiya11 commented Jan 7, 2022

No description provided.

@sumiya11 sumiya11 added the enhancement New feature or request label Jan 21, 2022
@sumiya11
Copy link
Owner Author

This and #8 are top priority

@aabouman
Copy link
Contributor

aabouman commented Jul 1, 2022

I don't have much knowledge of the f4 algorithm but do you have a recommendation for a quick way to measure progress? I just want to get a feel for when the problem becomes infeasible.

@sumiya11
Copy link
Owner Author

sumiya11 commented Jul 2, 2022

Do you mean some kind of progress bar ?

@aabouman
Copy link
Contributor

aabouman commented Jul 5, 2022

Yeah it doesn't need to be that advanced but just somewhere I can print an iterator or something of the like to understand the progress

@sumiya11
Copy link
Owner Author

sumiya11 commented Jul 7, 2022

That's a cool idea! Ive never heard anyone doing that with Groebner bases before; I'll investigate what can be done 😄

@sumiya11
Copy link
Owner Author

@aabouman The simplest solution would be to compute the basis incrementally, starting from the basis of [f1,f2], then [f1,f2,f3], and so on:

groebner([f1...fn]) = groebner(groebner(groebner([f1, f2]), f3)... fn)

Something like

julia> function iterativegroebner(system)
           gb = [system[1]]
           for i in 2:length(system)
               push!(gb, system[i])
               @info "$i/$(length(system)) step"
               @time gb = Groebner.groebner(gb)
           end
           gb
       end

Which produces

# system noon with 8 polynomials
julia> system = Groebner.change_ordering(Groebner.noonn(8), :degrevlex)

julia> iterativegroebner(system);
[ Info: 2/8 step
  0.000816 seconds (2.15 k allocations: 940.922 KiB)
[ Info: 3/8 step
  0.002860 seconds (14.05 k allocations: 2.932 MiB)
[ Info: 4/8 step
  0.016764 seconds (64.50 k allocations: 8.450 MiB)
[ Info: 5/8 step
  0.085297 seconds (262.17 k allocations: 30.699 MiB)
[ Info: 6/8 step
  0.543022 seconds (1.18 M allocations: 151.607 MiB, 5.17% gc time)
# e.g., stop somewhere here, when the time goes up
[ Info: 7/8 step
  3.378745 seconds (4.55 M allocations: 644.938 MiB, 10.05% gc time)
[ Info: 8/8 step
 13.478732 seconds (13.13 M allocations: 1.904 GiB, 5.44% gc time)

This will be slower in general, but allows you to stop earlier, when the time on the current step becomes too large

julia> @time groebner(system);
  9.691641 seconds (11.32 M allocations: 1.458 GiB, 6.46% gc time)

julia> iterativegroebner(system) == groebner(system)
  true

Other than that, F4 is not very suitable for tracking the progress, since the computation times can (and usually will) blow up unexpectedly. I will think about it though

@aabouman
Copy link
Contributor

That's funny I had hacked together something similar where I just added additional polynomials bit by bit. Thanks so much for your help!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants