Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "PolyJuMP"
uuid = "ddf597a6-d67e-5340-b84c-e37d84115374"
repo = "https://github.com/jump-dev/PolyJuMP.jl.git"
version = "0.5.1"
version = "0.6.0"

[deps]
JuMP = "4076af6c-e467-56ae-b986-b466b2749572"
Expand All @@ -14,14 +14,14 @@ MutableArithmetics = "d8a4904e-b15c-11e9-3269-09a3773c0cb0"
SemialgebraicSets = "8e049039-38e8-557d-ae3a-bc521ccf6204"

[compat]
JuMP = "0.22"
MathOptInterface = "0.10"
JuMP = "0.23"
MathOptInterface = "1"
MultivariateBases = "0.1.4"
MultivariateMoments = "0.3"
MultivariatePolynomials = "0.4"
MutableArithmetics = "0.3"
MutableArithmetics = "1"
SemialgebraicSets = "0.2"
julia = "1"
julia = "1.6"

[extras]
DynamicPolynomials = "7c1d4256-1411-5781-91ec-d7bc3513ac07"
Expand Down
4 changes: 2 additions & 2 deletions src/constraint.jl
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ struct ZeroPoly <: PolynomialSet end
struct NonNegPoly <: PolynomialSet end
struct PosDefPolyMatrix <: PolynomialSet end

function JuMP.function_string(::Type{JuMP.REPLMode},
function JuMP.function_string(::MIME"text/plain",
p::MultivariatePolynomials.APL)
return sprint(show, MIME"text/plain"(), p)
end
function JuMP.function_string(::Type{JuMP.IJuliaMode},
function JuMP.function_string(::MIME"text/latex",
p::MultivariatePolynomials.APL)
# `show` prints `$$` around what `_show` prints.
return sprint(MultivariatePolynomials._show, MIME"text/latex"(), p)
Expand Down
10 changes: 5 additions & 5 deletions test/constraint.jl
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,12 @@ _canon(model, p::Matrix) = _canon.(model, p)
set = set.set
end
p_canon = _canon(m, p)
expected_str = string(JuMP.function_string(REPLMode, p_canon), ' ',
JuMP._math_symbol(REPLMode, :in), ' ', jump_set)
expected_str = string(JuMP.function_string(MIME"text/plain"(), p_canon), ' ',
JuMP._math_symbol(MIME"text/plain"(), :in), ' ', jump_set)
con = JuMP.constraint_object(cref)
@test sprint(show, MIME"text/plain"(), cref) == expected_str
expected_str = string("\$\$ ", JuMP.function_string(IJuliaMode, p_canon), ' ',
JuMP._math_symbol(IJuliaMode, :in), ' ', jump_set,
expected_str = string("\$\$ ", JuMP.function_string(MIME"text/latex"(), p_canon), ' ',
JuMP._math_symbol(MIME"text/latex"(), :in), ' ', jump_set,
" \$\$")
@test sprint(show, MIME"text/latex"(), cref) == expected_str
@test set.basis == basis
Expand Down Expand Up @@ -82,7 +82,7 @@ _canon(model, p::Matrix) = _canon.(model, p)
dom = @set x^2 + y^2 == 1 && x^3 + x*y^2 + y >= 1

@testset "Printing" begin
in_sym = JuMP._math_symbol(REPLMode, :in)
in_sym = JuMP._math_symbol(MIME"text/plain"(), :in)
eqref = @constraint(m, p == q)
@test sprint(show, MIME"text/plain"(), eqref) == "(-α + β)x² + (α - β)xy + (-α)y² $in_sym PolyJuMP.ZeroPoly()"
@test sprint(show, MIME"text/latex"(), eqref) == "\$\$ (-α + β)x^{2} + (α - β)xy + (-α)y^{2} \\in PolyJuMP.ZeroPoly() \$\$"
Expand Down
4 changes: 2 additions & 2 deletions test/testpolymodule.jl
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ end
# TODO the function in JuMP should not require the eltype to be
# `AbstractJuMPScalar` so that we don't have to define this
# These methods are just copy-paste from JuMP/src/print.jl
function JuMP.function_string(::Type{REPLMode},
function JuMP.function_string(::MIME"text/plain",
A::AbstractMatrix{<:AbstractPolynomialLike})
str = sprint(show, MIME"text/plain"(), A)
lines = split(str, '\n')
Expand All @@ -119,7 +119,7 @@ function JuMP.function_string(::Type{REPLMode},
end
return join(lines, '\n')
end
function JuMP.function_string(print_mode::Type{IJuliaMode},
function JuMP.function_string(print_mode::MIME"text/latex",
A::AbstractMatrix{<:AbstractPolynomialLike})
str = sprint(show, MIME"text/plain"(), A)
str = "\\begin{bmatrix}\n"
Expand Down