wangjie212 / TSSOS

A sparse polynomial optimization tool based on the moment-SOS hierarchy.
MIT License
38 stars 13 forks source link

InexactError when trying to compute Groebner basis #4

Closed IzicTemi closed 2 years ago

IzicTemi commented 2 years ago

Here's the code I ran

using TSSOS
using DynamicPolynomials
@polyvar x[1:15]

f = x[14]+x[15]
g_1 = 2*x[2]^2*x[13] + 2*x[1]*x[2]*x[9] + x[4]*x[9]*x[14]^2 - 4*x[1]*x[4]^2*x[6]*x[9] - 4*x[2]*x[4]^2*x[9]*x[10] + x[4]*x[5]*x[9]*x[14]^2 + 2*x[4]^2*x[6]*x[9]*x[14] - 4*x[1]*x[4]^2*x[5]*x[9]^2 + 2*x[4]^2*x[5]*x[9]^2*x[14] - 2*x[1]*x[3]*x[7]*x[9] - 2*x[2]*x[3]*x[7]*x[13] - 2*x[2]*x[4]*x[6]*x[13] - 2*x[2]*x[4]*x[9]*x[10] - 2*x[1]*x[4]*x[9]*x[14] - 2*x[2]*x[4]*x[9]*x[14] - 4*x[1]*x[4]^2*x[5]^2*x[9]^2 + 2*x[4]^2*x[5]^2*x[9]^2*x[14] + 4*x[1]*x[3]*x[4]*x[7]*x[9] + 4*x[2]*x[3]*x[4]*x[9]*x[11] - 2*x[1]*x[4]*x[5]*x[9]*x[14] + 2*x[3]*x[4]*x[6]*x[7]*x[13] + 2*x[3]*x[4]*x[7]*x[9]*x[10] - 2*x[2]*x[4]*x[5]*x[9]*x[14] - 2*x[3]*x[4]*x[9]*x[11]*x[14] - 4*x[3]*x[4]^2*x[5]^2*x[9]^2*x[11] - 4*x[1]*x[4]^2*x[5]*x[6]*x[9] - 4*x[2]*x[4]^2*x[5]*x[9]*x[10] - 4*x[2]*x[4]^2*x[5]*x[9]*x[13] - 4*x[3]*x[4]^2*x[6]*x[9]*x[11] + 4*x[3]*x[4]^2*x[7]*x[9]*x[10] + 2*x[4]^2*x[5]*x[6]*x[9]*x[14] - 4*x[3]*x[4]^2*x[5]*x[9]^2*x[11] - 4*x[2]*x[4]^2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[6]^2 + x[10]^2 - 1
g_21 = x[7]^2 + x[11]^2 - 1
g_22 = x[8]^2 + x[12]^2 - 1
g_23 = x[9]^2 + x[13]^2 - 1
g_24 = x[3]*x[6] - x[2] + x[4]*x[7] + x[4]*x[5]*x[9]
g_25 = x[1] + x[3]*x[10] + x[4]*x[11] + x[4]*x[5]*x[13]
g_26 = x[4]^2 - x[3]^2 + (x[3]*x[7] - x[4]*x[6])^2 + (x[3]*x[11] - x[4]*x[10])^2 + 2*x[4]*x[9]*(x[3]*x[7] - x[4]*x[6]) + 2*x[4]*x[13]*(x[3]*x[11] - x[4]*x[10])

pop = [f, g_1, g_2, g_3, g_4, g_5, g_6, g_7, g_8, g_9, g_10, g_11, g_12, g_13, g_14, g_15, g_16, g_17, g_18, g_19, g_20, g_21, g_22, g_23, g_24, g_25, g_26]
d = 14
opt,sol,data = tssos_first(pop, x, d, numeq=7, TS="MD")

And here's the error I got:

ERROR: InexactError: Int64(-0.5)
Stacktrace:
  [1] Int64
    @ .\float.jl:812 [inlined]
  [2] convert
    @ .\number.jl:7 [inlined]
  [3] setindex!
    @ .\array.jl:903 [inlined]
  [4] _unsafe_copyto!(dest::Vector{Int64}, doffs::Int64, src::Vector{Float64}, soffs::Int64, n::Int64)
    @ Base .\array.jl:253
  [5] unsafe_copyto!
    @ .\array.jl:307 [inlined]
  [6] _copyto_impl!
    @ .\array.jl:331 [inlined]
  [7] copyto!
    @ .\array.jl:317 [inlined]
  [8] copyto!
    @ .\array.jl:343 [inlined]
  [9] copyto_axcheck!
    @ .\abstractarray.jl:1104 [inlined]
 [10] Vector{Int64}(x::Vector{Float64})
    @ Base .\array.jl:563
 [11] convert
    @ .\array.jl:554 [inlined]
 [12] convert
    @ C:\Users\iomol\.julia\packages\DynamicPolynomials\TP85p\src\poly.jl:40 [inlined]
 [13] push!(a::Vector{Polynomial{true, Int64}}, item::Polynomial{true, Float64})
    @ Base .\array.jl:994
 [14] gröbnerbasis!(F::Vector{Polynomial{true, Int64}}, algo::SemialgebraicSets.Buchberger)
    @ SemialgebraicSets C:\Users\iomol\.julia\packages\SemialgebraicSets\UizQL\src\groebner.jl:124 
 [15] gröbnerbasis!
    @ C:\Users\iomol\.julia\packages\SemialgebraicSets\UizQL\src\groebner.jl:113 [inlined]
 [16] tssos_first(pop::Vector{Polynomial{true, Int64}}, x::Vector{PolyVar{true}}, d::Int64; nb::Int64, numeq::Int64, quotient::Bool, basis::Vector{Any}, reducebasis::Bool, TS::String, merge::Bool, md::Int64, solver::String, QUIET::Bool, solve::Bool, MomentOne::Bool, Gram::Bool, solution::Bool, tol::Float64)
    @ TSSOS C:\Users\iomol\.julia\packages\TSSOS\rnmHS\src\blockpop_cons.jl:57
 [17] top-level scope
    @ d:\Desktop\Optimization\test_TSSOS.jl:49
wangjie212 commented 2 years ago

The following codes fix your error:

@polyvar x[1:15]
f = x[14] + x[15]
g_1 = 2.0*x[2]^2*x[13] + 2*x[1]*x[2]*x[9] + x[4]*x[9]*x[14]^2 - 4*x[1]*x[4]^2*x[6]*x[9] - 4*x[2]*x[4]^2*x[9]*x[10] + x[4]*x[5]*x[9]*x[14]^2 + 2*x[4]^2*x[6]*x[9]*x[14] - 4*x[1]*x[4]^2*x[5]*x[9]^2 + 2*x[4]^2*x[5]*x[9]^2*x[14] - 2*x[1]*x[3]*x[7]*x[9] - 2*x[2]*x[3]*x[7]*x[13] - 2*x[2]*x[4]*x[6]*x[13] - 2*x[2]*x[4]*x[9]*x[10] - 2*x[1]*x[4]*x[9]*x[14] - 2*x[2]*x[4]*x[9]*x[14] - 4*x[1]*x[4]^2*x[5]^2*x[9]^2 + 2*x[4]^2*x[5]^2*x[9]^2*x[14] + 4*x[1]*x[3]*x[4]*x[7]*x[9] + 4*x[2]*x[3]*x[4]*x[9]*x[11] - 2*x[1]*x[4]*x[5]*x[9]*x[14] + 2*x[3]*x[4]*x[6]*x[7]*x[13] + 2*x[3]*x[4]*x[7]*x[9]*x[10] - 2*x[2]*x[4]*x[5]*x[9]*x[14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x[5]^2*x[6]*x[9]*x[11]*x[13]
g_9 = x[4]*x[9]*x[15] + x[1]*x[3]*x[7]*x[9] + x[2]*x[3]*x[7]*x[13] + x[4]*x[5]*x[9]*x[15] - x[3]*x[4]*x[6]*x[7]*x[13] - x[3]*x[4]*x[7]*x[9]*x[10]
g_10 = x[6]^2 + x[10]^2 - 1
g_11 = x[7]^2 + x[11]^2 - 1
g_12 = x[8]^2 + x[12]^2 - 1
g_13 = x[9]^2 + x[13]^2 - 1
g_14 = x[3]*x[6] - x[2] + x[4]*x[7] + x[4]*x[5]*x[9]
g_15 = x[1] + x[3]*x[10] + x[4]*x[11] + x[4]*x[5]*x[13]
g_16 = x[4]^2 - x[3]^2 + (x[3]*x[7] - x[4]*x[6])^2 + (x[3]*x[11] - x[4]*x[10])^2 + 2*x[4]*x[9]*(x[3]*x[7] - x[4]*x[6]) + 2*x[4]*x[13]*(x[3]*x[11] - x[4]*x[10])

pop = [f, g_1, g_2, g_3, g_4, g_5, g_6, g_7, g_8, g_9, g_10, g_11, g_12, g_13, g_14, g_15, g_16]
d = 6
opt,sol,data = cs_tssos_first(pop, x, d, numeq=7, TS="MD")

Note that I have removed some redundant constraints from the POP. Also, the relaxation order d is set to the minimal value 6 (half of the degree).

IzicTemi commented 2 years ago

I had to to make a few formatting changes, but it works. Thank you very much. Could you please highlight what exactly was wrong so as to avoid it in the future?

wangjie212 commented 2 years ago

Computing Groebner basis needs polynomials with float coefficients. So I just replace 2 with 2.0 for the leading coefficient of g_1.