From 4311ef9bcae3fead2866d7291132f74638f6e7b1 Mon Sep 17 00:00:00 2001 From: Oscar Dowson Date: Thu, 22 Apr 2021 18:36:05 +1200 Subject: [PATCH] Fix printing (#193) * Fix printing * Fix coefficient --- Project.toml | 2 +- examples/scaled_perm.jl | 2 +- test/constraint.jl | 10 +++++----- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Project.toml b/Project.toml index c809e72cc..17805385c 100644 --- a/Project.toml +++ b/Project.toml @@ -22,7 +22,7 @@ SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf" ComplexOptInterface = "0.0.2" DataStructures = "0.18" DynamicPolynomials = "0.3.6" -JuMP = "0.21" +JuMP = "0.21.7" MathOptInterface = "0.9.18" MultivariateBases = "0.1.2" MultivariateMoments = "0.3" diff --git a/examples/scaled_perm.jl b/examples/scaled_perm.jl index 914e327fd..84ea22f96 100644 --- a/examples/scaled_perm.jl +++ b/examples/scaled_perm.jl @@ -45,5 +45,5 @@ end Base.:^(p::ScaledPerm, k::Integer) = Base.power_by_squaring(p, k) function SymbolicWedderburn.permutation(ehom::SymbolicWedderburn.ExtensionHomomorphism{<:AbstractMonomial}, terms::Vector{<:AbstractTerm}) - return ScaledPerm([ehom[monomial(term)] => coefficient(term) for term in terms]) + return ScaledPerm([ehom[monomial(term)] => MP.coefficient(term) for term in terms]) end diff --git a/test/constraint.jl b/test/constraint.jl index 21a760a7e..99727f185 100644 --- a/test/constraint.jl +++ b/test/constraint.jl @@ -15,19 +15,19 @@ end @variable(model, a) cref = @constraint(model, a * x^2 >= 1) @test sprint(show, MIME"text/plain"(), cref) == "(a)x² + (-1) is SOS" - @test sprint(show, MIME"text/latex"(), cref) == "\$ (a)x^{2} + (-1) \\text{ is SOS} \$" + @test sprint(show, MIME"text/latex"(), cref) == "\$\$ (a)x^{2} + (-1) \\text{ is SOS} \$\$" sdref = @constraint(model, a * x^2 in SDSOSCone()) @test sprint(show, MIME"text/plain"(), sdref) == "(a)x² is SDSOS" - @test sprint(show, MIME"text/latex"(), sdref) == "\$ (a)x^{2} \\text{ is SDSOS} \$" + @test sprint(show, MIME"text/latex"(), sdref) == "\$\$ (a)x^{2} \\text{ is SDSOS} \$\$" dref = @constraint(model, a * x^2 in DSOSCone()) @test sprint(show, MIME"text/plain"(), dref) == "(a)x² is DSOS" - @test sprint(show, MIME"text/latex"(), dref) == "\$ (a)x^{2} \\text{ is DSOS} \$" + @test sprint(show, MIME"text/latex"(), dref) == "\$\$ (a)x^{2} \\text{ is DSOS} \$\$" for sparsity in [NoSparsity(), VariableSparsity()] cref_fix = @constraint(model, a * x^2 >= 1, domain = (@set x == 1), sparsity = sparsity) @test sprint(show, MIME"text/plain"(), cref_fix) == "(a)x² + (-1) is SOS" - @test sprint(show, MIME"text/latex"(), cref_fix) == "\$ (a)x^{2} + (-1) \\text{ is SOS} \$" + @test sprint(show, MIME"text/latex"(), cref_fix) == "\$\$ (a)x^{2} + (-1) \\text{ is SOS} \$\$" cref_fix = @constraint(model, a * x^2 >= 1, domain = (@set x >= 1), sparsity = sparsity) @test sprint(show, MIME"text/plain"(), cref_fix) == "(a)x² + (-1) is SOS" - @test sprint(show, MIME"text/latex"(), cref_fix) == "\$ (a)x^{2} + (-1) \\text{ is SOS} \$" + @test sprint(show, MIME"text/latex"(), cref_fix) == "\$\$ (a)x^{2} + (-1) \\text{ is SOS} \$\$" end end