From 01ae1acc13151ed9221526a9888f164391ffb9fa Mon Sep 17 00:00:00 2001 From: Ilia Ilmer Date: Sun, 21 Nov 2021 10:50:44 -0500 Subject: [PATCH 01/11] try using Oscar for GB --- Project.toml | 3 +-- src/StructuralIdentifiability.jl | 2 +- src/global_identifiability.jl | 2 +- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/Project.toml b/Project.toml index fae730da8..6cf0ead40 100644 --- a/Project.toml +++ b/Project.toml @@ -7,13 +7,13 @@ version = "0.3.1" AbstractAlgebra = "c3fe647b-3220-5bb0-a1ea-a7954cac585d" DataStructures = "864edb3b-99cc-5e75-8d2d-829cb0a9cfe8" Dates = "ade2ca70-3891-5945-98fb-dc099432e06a" -GroebnerBasis = "e39c9192-ea4d-5e15-9584-a488c6d614bd" IterTools = "c8e1da08-722c-5040-9ed9-7db0dc04731e" LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" Logging = "56ddb016-857b-54e1-b83d-db4d58db5568" MacroTools = "1914dd2f-81c6-5fcd-8719-6d5c9610ff09" ModelingToolkit = "961ee093-0014-501f-94e3-6117800e7a78" Nemo = "2edaba10-b0f1-5616-af89-8c11ac63239a" +Oscar = "f1435218-dba5-11e9-1e4d-f1a5fab5fc13" Primes = "27ebfcd6-29c5-5fa9-bf4b-fb8fc14df3ae" Singular = "bcd08a7b-43d2-5ff7-b6d4-c458787f915c" SpecialFunctions = "276daf66-3868-5448-9aa4-cd146d93841b" @@ -23,7 +23,6 @@ TestSetExtensions = "98d24dd4-01ad-11ea-1b02-c9a08f80db04" [compat] AbstractAlgebra = "0.13, 0.18, 0.19, 0.20, 0.21, 0.22" DataStructures = "0.18" -GroebnerBasis = "0.1, 0.2, 0.3" IterTools = "1" MacroTools = "0.5" ModelingToolkit = "7" diff --git a/src/StructuralIdentifiability.jl b/src/StructuralIdentifiability.jl index 2990c86a0..2759a359b 100644 --- a/src/StructuralIdentifiability.jl +++ b/src/StructuralIdentifiability.jl @@ -13,7 +13,7 @@ using DataStructures # Algebra packages using AbstractAlgebra using Nemo -using GroebnerBasis +# using GroebnerBasis using Singular # For testing (TODO: move to the test-specific dependencies) diff --git a/src/global_identifiability.jl b/src/global_identifiability.jl index 810b7d06d..53a921baf 100644 --- a/src/global_identifiability.jl +++ b/src/global_identifiability.jl @@ -82,7 +82,7 @@ function check_field_membership( if method == :Singular gb = Singular.std(Singular.Ideal(ring_sing, eqs_sing)) elseif method == :GroebnerBasis - gb = GroebnerBasis.f4(Singular.Ideal(ring_sing, eqs_sing)) + gb = Oscar.groebner_basis(Oscar.MPolyIdeal(ring_sing, eqs_sing)) else throw(Base.ArgumentError("Unknown method $method")) end From fafad6e30c6d5e9025ddd8bdb128ce8af6d275c5 Mon Sep 17 00:00:00 2001 From: Ilia Ilmer Date: Sun, 21 Nov 2021 11:03:02 -0500 Subject: [PATCH 02/11] add using Oscar --- src/StructuralIdentifiability.jl | 1 + 1 file changed, 1 insertion(+) diff --git a/src/StructuralIdentifiability.jl b/src/StructuralIdentifiability.jl index 2759a359b..72a324707 100644 --- a/src/StructuralIdentifiability.jl +++ b/src/StructuralIdentifiability.jl @@ -14,6 +14,7 @@ using DataStructures using AbstractAlgebra using Nemo # using GroebnerBasis +using Oscar using Singular # For testing (TODO: move to the test-specific dependencies) From 33c73c75eb9689059395d629b0b8567c0a528ec9 Mon Sep 17 00:00:00 2001 From: Ilia Ilmer Date: Tue, 23 Nov 2021 20:27:46 -0500 Subject: [PATCH 03/11] adding oscar version --- Project.toml | 1 + src/global_identifiability.jl | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/Project.toml b/Project.toml index 6cf0ead40..b4086e85c 100644 --- a/Project.toml +++ b/Project.toml @@ -28,6 +28,7 @@ MacroTools = "0.5" ModelingToolkit = "7" Nemo = "0.24, 0.25, 0.26, 0.27" Primes = "0.5" +"Oscar" = "0.6, 0.7" Singular = "0.4, 0.5, 0.6, 0.7, 0.8, 0.9" SpecialFunctions = "1" TestSetExtensions = "2" diff --git a/src/global_identifiability.jl b/src/global_identifiability.jl index 53a921baf..0acca97d1 100644 --- a/src/global_identifiability.jl +++ b/src/global_identifiability.jl @@ -82,7 +82,7 @@ function check_field_membership( if method == :Singular gb = Singular.std(Singular.Ideal(ring_sing, eqs_sing)) elseif method == :GroebnerBasis - gb = Oscar.groebner_basis(Oscar.MPolyIdeal(ring_sing, eqs_sing)) + gb = f4Oscar.MPolyIdeal(ring_sing, eqs_sing)) else throw(Base.ArgumentError("Unknown method $method")) end From ebfd7b7a6c2d138d2a43fb6528ede3d78d6d2036 Mon Sep 17 00:00:00 2001 From: Ilia Ilmer Date: Tue, 23 Nov 2021 20:29:12 -0500 Subject: [PATCH 04/11] adding Oscar.f4 in GB computation --- src/global_identifiability.jl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/global_identifiability.jl b/src/global_identifiability.jl index 0acca97d1..c5dbf8317 100644 --- a/src/global_identifiability.jl +++ b/src/global_identifiability.jl @@ -82,7 +82,8 @@ function check_field_membership( if method == :Singular gb = Singular.std(Singular.Ideal(ring_sing, eqs_sing)) elseif method == :GroebnerBasis - gb = f4Oscar.MPolyIdeal(ring_sing, eqs_sing)) + gb = Oscar.f4(Singular.Ideal(ring_sing, eqs_sing)) + else throw(Base.ArgumentError("Unknown method $method")) end From 0b0898825a190aaf91ed0f74b3fe0d6ee6403c7d Mon Sep 17 00:00:00 2001 From: Ilia Ilmer Date: Tue, 23 Nov 2021 20:38:48 -0500 Subject: [PATCH 05/11] msolve works? --- src/global_identifiability.jl | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/global_identifiability.jl b/src/global_identifiability.jl index c5dbf8317..ec9b58610 100644 --- a/src/global_identifiability.jl +++ b/src/global_identifiability.jl @@ -82,12 +82,10 @@ function check_field_membership( if method == :Singular gb = Singular.std(Singular.Ideal(ring_sing, eqs_sing)) elseif method == :GroebnerBasis - gb = Oscar.f4(Singular.Ideal(ring_sing, eqs_sing)) - + gb = Oscar.msolve(Oscar.ideal(ring_sing, eqs_sing)) else throw(Base.ArgumentError("Unknown method $method")) end - # @debug gens(gb) @debug "Producing the result" flush(stdout) From 3882fc232f68f6e5385f094f25fa1a3f76f03c09 Mon Sep 17 00:00:00 2001 From: Ilia Date: Thu, 6 Jan 2022 13:29:22 +0300 Subject: [PATCH 06/11] QQ => GF(2^31-1) --- src/global_identifiability.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/global_identifiability.jl b/src/global_identifiability.jl index ec9b58610..d65473e7f 100644 --- a/src/global_identifiability.jl +++ b/src/global_identifiability.jl @@ -54,7 +54,7 @@ function check_field_membership( @debug "Constructing the equations" eqs_sing = Array{Singular.spoly{Singular.n_Q},1}() ring_sing, vars_sing = Singular.PolynomialRing( - Singular.QQ, + GF(2^31-1)#Singular.QQ, vcat(map(var_to_str, gens(ring)), ["sat_aux$i" for i in 1:length(generators)]); # vcat(map(var_to_str, gens(ring)), ["sat_aux"]); ordering=:degrevlex From e98866e29ef7ee934b4cf254d72cb4ba9aef0857 Mon Sep 17 00:00:00 2001 From: Ilia Date: Thu, 6 Jan 2022 15:13:47 +0300 Subject: [PATCH 07/11] missing comma --- src/global_identifiability.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/global_identifiability.jl b/src/global_identifiability.jl index d65473e7f..b76d0ed17 100644 --- a/src/global_identifiability.jl +++ b/src/global_identifiability.jl @@ -54,7 +54,7 @@ function check_field_membership( @debug "Constructing the equations" eqs_sing = Array{Singular.spoly{Singular.n_Q},1}() ring_sing, vars_sing = Singular.PolynomialRing( - GF(2^31-1)#Singular.QQ, + GF(2^31-1), #Singular.QQ, vcat(map(var_to_str, gens(ring)), ["sat_aux$i" for i in 1:length(generators)]); # vcat(map(var_to_str, gens(ring)), ["sat_aux"]); ordering=:degrevlex From 7fe2d0c2d6a314de07c77034a73520bec7f3c25a Mon Sep 17 00:00:00 2001 From: Ilia Date: Thu, 6 Jan 2022 15:28:59 +0300 Subject: [PATCH 08/11] GF => Singular.GF --- src/global_identifiability.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/global_identifiability.jl b/src/global_identifiability.jl index b76d0ed17..6a9788d6f 100644 --- a/src/global_identifiability.jl +++ b/src/global_identifiability.jl @@ -54,7 +54,7 @@ function check_field_membership( @debug "Constructing the equations" eqs_sing = Array{Singular.spoly{Singular.n_Q},1}() ring_sing, vars_sing = Singular.PolynomialRing( - GF(2^31-1), #Singular.QQ, + Singluar.GF(2^31-1), #Singular.QQ, vcat(map(var_to_str, gens(ring)), ["sat_aux$i" for i in 1:length(generators)]); # vcat(map(var_to_str, gens(ring)), ["sat_aux"]); ordering=:degrevlex From 45b89c731275c3f4adfa7045b24859ae1f14f7b8 Mon Sep 17 00:00:00 2001 From: Ilia Date: Thu, 6 Jan 2022 16:03:43 +0300 Subject: [PATCH 09/11] another typo --- src/global_identifiability.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/global_identifiability.jl b/src/global_identifiability.jl index 6a9788d6f..e84cdc1ad 100644 --- a/src/global_identifiability.jl +++ b/src/global_identifiability.jl @@ -54,7 +54,7 @@ function check_field_membership( @debug "Constructing the equations" eqs_sing = Array{Singular.spoly{Singular.n_Q},1}() ring_sing, vars_sing = Singular.PolynomialRing( - Singluar.GF(2^31-1), #Singular.QQ, + Singular.GF(2^31-1), #Singular.QQ, vcat(map(var_to_str, gens(ring)), ["sat_aux$i" for i in 1:length(generators)]); # vcat(map(var_to_str, gens(ring)), ["sat_aux"]); ordering=:degrevlex From 94b35073f566e33859ca07190bc6d1e1e5489f89 Mon Sep 17 00:00:00 2001 From: Ilia Date: Sun, 9 Jan 2022 20:55:06 +0300 Subject: [PATCH 10/11] GF->FiniteField --- Project.toml | 2 +- src/global_identifiability.jl | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Project.toml b/Project.toml index 7cf2200e6..c14c50790 100644 --- a/Project.toml +++ b/Project.toml @@ -28,8 +28,8 @@ IterTools = "1" MacroTools = "0.5" ModelingToolkit = "7, 8" Nemo = "0.24, 0.25, 0.26, 0.27, 0.28" +Oscar = "0.7" Primes = "0.5" -"Oscar" = "0.6, 0.7" Singular = "0.4, 0.5, 0.6, 0.7, 0.8, 0.9" SpecialFunctions = "1, 2" TestSetExtensions = "2" diff --git a/src/global_identifiability.jl b/src/global_identifiability.jl index e84cdc1ad..706196e9d 100644 --- a/src/global_identifiability.jl +++ b/src/global_identifiability.jl @@ -54,7 +54,7 @@ function check_field_membership( @debug "Constructing the equations" eqs_sing = Array{Singular.spoly{Singular.n_Q},1}() ring_sing, vars_sing = Singular.PolynomialRing( - Singular.GF(2^31-1), #Singular.QQ, + Oscar.FiniteField(2^31-1), #Singular.QQ, vcat(map(var_to_str, gens(ring)), ["sat_aux$i" for i in 1:length(generators)]); # vcat(map(var_to_str, gens(ring)), ["sat_aux"]); ordering=:degrevlex @@ -82,7 +82,7 @@ function check_field_membership( if method == :Singular gb = Singular.std(Singular.Ideal(ring_sing, eqs_sing)) elseif method == :GroebnerBasis - gb = Oscar.msolve(Oscar.ideal(ring_sing, eqs_sing)) + gb = Oscar.f4(Oscar.ideal(ring_sing, eqs_sing)) else throw(Base.ArgumentError("Unknown method $method")) end From 253add314eaaf661599c3892c4dffb01c9fafe01 Mon Sep 17 00:00:00 2001 From: Ilia Date: Mon, 10 Jan 2022 10:46:49 +0300 Subject: [PATCH 11/11] typing errors --- examples/CRN.jl | 4 ++-- src/global_identifiability.jl | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/examples/CRN.jl b/examples/CRN.jl index 568b14df6..8ecce73e9 100644 --- a/examples/CRN.jl +++ b/examples/CRN.jl @@ -5,8 +5,8 @@ using Logging using StructuralIdentifiability -logger = Logging.SimpleLogger(stdout, Logging.Info) -global_logger(logger) +# logger = Logging.SimpleLogger(stdout, Logging.Info) +# global_logger(logger) ode = @ODEmodel( x1'(t) = -k1 * x1(t) * x2(t) + k2 * x4(t) + k4 * x6(t), diff --git a/src/global_identifiability.jl b/src/global_identifiability.jl index 706196e9d..4b9fcb3e8 100644 --- a/src/global_identifiability.jl +++ b/src/global_identifiability.jl @@ -52,9 +52,9 @@ function check_field_membership( @debug "\tPoint is $point" @debug "Constructing the equations" - eqs_sing = Array{Singular.spoly{Singular.n_Q},1}() - ring_sing, vars_sing = Singular.PolynomialRing( - Oscar.FiniteField(2^31-1), #Singular.QQ, + eqs_sing = Array{Nemo.gfp_mpoly,1}() + ring_sing, vars_sing = Oscar.PolynomialRing( + Oscar.FiniteField(536870909), #Singular.QQ, vcat(map(var_to_str, gens(ring)), ["sat_aux$i" for i in 1:length(generators)]); # vcat(map(var_to_str, gens(ring)), ["sat_aux"]); ordering=:degrevlex @@ -94,7 +94,7 @@ function check_field_membership( num, den = unpack_fraction(f) poly = num * evaluate(den, point) - den * evaluate(num, point) poly_sing = parent_ring_change(poly, ring_sing) - push!(result, iszero(Singular.reduce(poly_sing, gb))) + push!(result, iszero(Oscar.reduce(poly_sing, gb))) end return result end