From 2ad444d690110396059d38fb318e4a1185940657 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Legat?= Date: Mon, 26 Nov 2018 12:18:36 +0100 Subject: [PATCH 1/5] Implement model printing --- src/print.jl | 89 +++++++++++++++++++++++++++----- test/old/print.jl | 107 -------------------------------------- test/print.jl | 129 ++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 205 insertions(+), 120 deletions(-) diff --git a/src/print.jl b/src/print.jl index 71faaedf5b4..9f35e9d1267 100644 --- a/src/print.jl +++ b/src/print.jl @@ -147,9 +147,20 @@ wrap_in_inline_math_mode(str) = "\$ $str \$" ## Model #------------------------------------------------------------------------ function Base.show(io::IO, model::Model) + plural(n) = (n==1 ? "" : "s") println(io, "A JuMP Model") + sense = objective_sense(model) + if sense == MOI.MaxSense + print(io, "Maximization") + elseif sense == MOI.MinSense + print(io, "Minimization") + else + print(io, "Feasibility") + end + println(io, " problem with:") # TODO: Consider allowing a JuMP model to have a string name. - println(io, "Variables: ", num_variables(model)) + println(io, "Variable", plural(num_variables(model)), ": ", + num_variables(model)) # https://github.com/JuliaOpt/JuMP.jl/issues/1556 # TODO: This doesn't account for nonlinear objectives # println(io, "\tObjective function type:", @@ -157,10 +168,12 @@ function Base.show(io::IO, model::Model) constraint_types = MOI.get(model, MOI.ListOfConstraints()) for (F, S) in MOI.get(model, MOI.ListOfConstraints()) num_constraints = MOI.get(model, MOI.NumberOfConstraints{F, S}()) - println(io, "`$F`-in-`$S`: $num_constraints constraints") + println(io, "`$F`-in-`$S`: $num_constraints constraint", + plural(num_constraints)) end if !iszero(num_nl_constraints(model)) - println(io, "Nonlinear: ", num_nl_constraints(model), " constraints") + println(io, "Nonlinear: ", num_nl_constraints(model), " constraint", + plural(num_nl_constraints(model))) end model_mode = mode(model) println(io, "Model mode: ", model_mode) @@ -168,13 +181,58 @@ function Base.show(io::IO, model::Model) println(io, "CachingOptimizer state: ", MOIU.state(backend(model))) end - println(io, "Solver name: ", solver_name(model)) + # The last print shouldn't have a new line + print(io, "Solver name: ", solver_name(model)) names_in_scope = collect(keys(object_dictionary(model))) if !isempty(names_in_scope) - println(io, "Names registered in the model: ", - join(string.(names_in_scope), ", ")) + println(io) + print(io, "Names registered in the model: ", + join(string.(names_in_scope), ", ")) + end +end + +function Base.print(io::IO, model::Model) + print(io, model_string(REPLMode, model)) +end +function Base.show(io::IO, ::MIME"text/latex", model::Model) + print(io, wrap_in_math_mode(model_string(IJuliaMode, model))) +end +function model_string(print_mode, model::Model) + ijl = print_mode == IJuliaMode + sep = ijl ? " & " : " " + eol = ijl ? "\\\\\n" : "\n" + sense = objective_sense(model) + str = "" + if sense == MOI.MaxSense + str *= ijl ? "\\max" : "Max" + elseif sense == MOI.MinSense + str *= ijl ? "\\min" : "Min" + else + str *= ijl ? "\\text{feasibility}" : "Feasibility" end - # TODO: The last print shouldn't have a new line + if sense != MOI.FeasibilitySense + if ijl + str *= "\\quad" + end + str *= sep + str *= function_string(print_mode, + objective_function(model, QuadExpr)) + end + str *= eol + str *= ijl ? "\\text{Subject to} \\quad" : "Subject to" * eol + for (F, S) in MOI.get(model, MOI.ListOfConstraints()) + for idx in MOI.get(model, MOI.ListOfConstraintIndices{F, S}()) + # FIXME the shape may be incorrect here + shape = S <: MOI.AbstractScalarSet ? ScalarShape() : VectorShape() + cref = ConstraintRef(model, idx, shape) + con = constraint_object(cref) + str *= sep * constraint_string(print_mode, con) * eol + end + end + if ijl + str = "\\begin{alignat*}{1}" * str * "\\end{alignat*}\n" + end + return str end #------------------------------------------------------------------------ @@ -308,10 +366,10 @@ end # `JuMP.jump_function` or `JuMP.function_string` and either `JuMP.moi_set` or # `JuMP.in_set_string` should be implemented. function Base.show(io::IO, ref::ConstraintRef) - print(io, constraint_string(REPLMode, name(ref), constraint_object(ref))) + print(io, constraint_string(REPLMode, ref)) end function Base.show(io::IO, ::MIME"text/latex", ref::ConstraintRef) - print(io, constraint_string(IJuliaMode, name(ref), constraint_object(ref))) + print(io, constraint_string(IJuliaMode, ref)) end """ @@ -404,12 +462,14 @@ function in_set_string(print_mode, constraint::AbstractConstraint) return in_set_string(print_mode, moi_set(constraint)) end -# constraint_object is a JuMP constraint object like AffExprConstraint. -# Assumes a .func and .set member. -function constraint_string(print_mode, constraint_name, constraint_object) +function constraint_string(print_mode, constraint_object::AbstractConstraint) func_str = function_string(print_mode, constraint_object) in_set_str = in_set_string(print_mode, constraint_object) - constraint_without_name = func_str * " " * in_set_str + return func_str * " " * in_set_str +end +function constraint_string(print_mode, constraint_name, + constraint_object::AbstractConstraint) + constraint_without_name = constraint_string(print_mode, constraint_object) if print_mode == IJuliaMode constraint_without_name = wrap_in_inline_math_mode(constraint_without_name) end @@ -419,6 +479,9 @@ function constraint_string(print_mode, constraint_name, constraint_object) return constraint_name * " : " * constraint_without_name end end +function constraint_string(print_mode, ref::ConstraintRef) + return constraint_string(print_mode, name(ref), constraint_object(ref)) +end #------------------------------------------------------------------------ ## NonlinearExprData diff --git a/test/old/print.jl b/test/old/print.jl index 510bd270adb..34adb2100bc 100644 --- a/test/old/print.jl +++ b/test/old/print.jl @@ -336,113 +336,6 @@ end end - - @testset "Model" begin - le, ge, eq, fa = repl[:leq], repl[:geq], repl[:eq], repl[:for_all] - inset, dots = repl[:in], repl[:dots] - infty, union = repl[:infty], repl[:union] - Vert, sub2 = repl[:Vert], repl[:sub2] - - #------------------------------------------------------------------ - - mod_1 = Model() - @variable(mod_1, a>=1) - @variable(mod_1, b<=1) - @variable(mod_1, -1<=c<=1) - @variable(mod_1, a1>=1,Int) - @variable(mod_1, b1<=1,Int) - @variable(mod_1, -1<=c1<=1,Int) - @variable(mod_1, x, Bin) - @variable(mod_1, y) - @variable(mod_1, z, Int) - @variable(mod_1, sos[1:3], Bin) - @variable(mod_1, 2 <= si <= 3, SemiInt) - @variable(mod_1, 2 <= sc <= 3, SemiCont) - @variable(mod_1, fi == 9) - @objective(mod_1, Max, a - b + 2a1 - 10x) - @constraint(mod_1, a + b - 10c - 2x + c1 <= 1) - @constraint(mod_1, a*b <= 2) - addSOS1(mod_1, [i*sos[i] for i in 1:3]) - @constraint(mod_1, norm(sos) + a <= 1) - - io_test(REPLMode, mod_1, """ - Max a - b + 2 a1 - 10 x - Subject to - a + b - 10 c - 2 x + c1 $le 1 - a*b - 2 $le 0 - SOS1: {1 sos[1], 2 sos[2], 3 sos[3]} - $(Vert)[sos[1],sos[2],sos[3]]$(Vert)$(sub2) $le -a + 1 - sos[i] $inset {0,1} $fa i $inset {1,2,3} - a $ge 1 - b $le 1 - -1 $le c $le 1 - a1 $ge 1, integer - b1 $le 1, integer - -1 $le c1 $le 1, integer - x $inset {0,1} - y - z, integer - si $inset {2,$dots,3} $union {0} - sc $inset [2,3] $union {0} - fi = 9 - """, repl=:print) - - io_test(REPLMode, mod_1, """ - Maximization problem with: - * 1 linear constraint - * 1 quadratic constraint - * 1 SOS constraint - * 1 SOC constraint - * 15 variables: 4 binary, 4 integer, 1 semicontinuous, 1 semi-integer - Solver is default solver""", repl=:show) - - io_test(IJuliaMode, mod_1, """ - \\begin{alignat*}{1}\\max\\quad & a - b + 2 a1 - 10 x\\\\ - \\text{Subject to} \\quad & a + b - 10 c - 2 x + c1 \\leq 1\\\\ - & a\\times b - 2 \\leq 0\\\\ - & SOS1: \\{1 sos[1], 2 sos[2], 3 sos[3]\\}\\\\ - & \\Vert[sos_{1},sos_{2},sos_{3}]\\Vert_2 $le -a + 1\\\\ - & sos_{i} \\in \\{0,1\\} \\quad\\forall i \\in \\{1,2,3\\}\\\\ - & a \\geq 1\\\\ - & b \\leq 1\\\\ - & -1 \\leq c \\leq 1\\\\ - & a1 \\geq 1, \\in \\mathbb{Z}\\\\ - & b1 \\leq 1, \\in \\mathbb{Z}\\\\ - & -1 \\leq c1 \\leq 1, \\in \\mathbb{Z}\\\\ - & x \\in \\{0,1\\}\\\\ - & y\\\\ - & z, \\in \\mathbb{Z}\\\\ - & si \\in \\{2,\\dots,3\\} \\cup \\{0\\}\\\\ - & sc \\in \\[2,3\\] \\cup \\{0\\}\\\\ - & fi = 9\\\\ - \\end{alignat*} - """) - - #------------------------------------------------------------------ - - mod_2 = Model() - @variable(mod_2, x, Bin) - @variable(mod_2, y, Int) - @constraint(mod_2, x*y <= 1) - - io_test(REPLMode, mod_2, """ - Feasibility problem with: - * 0 linear constraints - * 1 quadratic constraint - * 2 variables: 1 binary, 1 integer - Solver is default solver""", repl=:show) - - mod_2 = Model() - @variable(mod_2, x) - @constraint(mod_2, x <= 3) - - io_test(REPLMode, mod_2, """ - Feasibility problem with: - * 1 linear constraint - * 1 variable - Solver is default solver""", repl=:show) - end - @testset "changing variable categories" begin le, ge, fa = repl[:leq], repl[:geq], repl[:for_all] inset, dots = repl[:in], repl[:dots] diff --git a/test/print.jl b/test/print.jl index 26137801c1a..f8c3f5727e5 100644 --- a/test/print.jl +++ b/test/print.jl @@ -10,6 +10,7 @@ # test/print.jl # Testing $fa pretty-printing-related functionality ############################################################################# +using MathOptInterface using JuMP using Compat using Compat.Test @@ -348,6 +349,134 @@ function printing_test(ModelType::Type{<:JuMP.AbstractModel}) io_test(REPLMode, quad_constr, "2 x$sq $le 1.0") # TODO: Test in IJulia mode. end + @testset "Model" begin + repl(s) = JuMP.math_symbol(REPLMode, s) + le, ge, eq, fa = repl(:leq), repl(:geq), repl(:eq), repl(:for_all) + inset, dots = repl(:in), repl(:dots) + infty, union = repl(:infty), repl(:union) + Vert, sub2 = repl(:Vert), repl(:sub2) + for_all = repl(:for_all) + + #------------------------------------------------------------------ + + model_1 = Model() + @variable(model_1, a>=1) + @variable(model_1, b<=1) + @variable(model_1, -1<=c<=1) + @variable(model_1, a1>=1,Int) + @variable(model_1, b1<=1,Int) + @variable(model_1, -1<=c1<=1,Int) + @variable(model_1, x, Bin) + @variable(model_1, y) + @variable(model_1, z, Int) + @variable(model_1, u[1:3], Bin) + @variable(model_1, fi == 9) + @objective(model_1, Max, a - b + 2a1 - 10x) + @constraint(model_1, a + b - 10c - 2x + c1 <= 1) + @constraint(model_1, a*b <= 2) + @constraint(model_1, [1 - a; u] in SecondOrderCone()) + + io_test(REPLMode, model_1, """ + Max a - b + 2 a1 - 10 x + Subject to + x $inset MathOptInterface.ZeroOne() + u[1] $inset MathOptInterface.ZeroOne() + u[2] $inset MathOptInterface.ZeroOne() + u[3] $inset MathOptInterface.ZeroOne() + a1 $inset MathOptInterface.Integer() + b1 $inset MathOptInterface.Integer() + c1 $inset MathOptInterface.Integer() + z $inset MathOptInterface.Integer() + fi = 9.0 + a $ge 1.0 + c $ge -1.0 + a1 $ge 1.0 + c1 $ge -1.0 + b $le 1.0 + c $le 1.0 + b1 $le 1.0 + c1 $le 1.0 + a + b - 10 c - 2 x + c1 $le 1.0 + a*b $le 2.0 + [-a + 1, u[1], u[2], u[3]] $inset MathOptInterface.SecondOrderCone(4) + """, repl=:print) + + + io_test(REPLMode, model_1, """ + A JuMP Model + Maximization problem with: + Variables: 13 + `MathOptInterface.SingleVariable`-in-`MathOptInterface.ZeroOne`: 4 constraints + `MathOptInterface.SingleVariable`-in-`MathOptInterface.Integer`: 4 constraints + `MathOptInterface.SingleVariable`-in-`MathOptInterface.EqualTo{Float64}`: 1 constraint + `MathOptInterface.SingleVariable`-in-`MathOptInterface.GreaterThan{Float64}`: 4 constraints + `MathOptInterface.SingleVariable`-in-`MathOptInterface.LessThan{Float64}`: 4 constraints + `MathOptInterface.ScalarAffineFunction{Float64}`-in-`MathOptInterface.LessThan{Float64}`: 1 constraint + `MathOptInterface.ScalarQuadraticFunction{Float64}`-in-`MathOptInterface.LessThan{Float64}`: 1 constraint + `MathOptInterface.VectorAffineFunction{Float64}`-in-`MathOptInterface.SecondOrderCone`: 1 constraint + Model mode: Automatic + CachingOptimizer state: NoOptimizer + Solver name: No optimizer attached. + Names registered in the model: b, c, c1, b1, a1, x, fi, z, u, a, y""", repl=:show) + + io_test(IJuliaMode, model_1, """ + \\begin{alignat*}{1}\\max\\quad & a - b + 2 a1 - 10 x\\\\ + \\text{Subject to} \\quad & x \\in MathOptInterface.ZeroOne()\\\\ + & u_{1} \\in MathOptInterface.ZeroOne()\\\\ + & u_{2} \\in MathOptInterface.ZeroOne()\\\\ + & u_{3} \\in MathOptInterface.ZeroOne()\\\\ + & a1 \\in MathOptInterface.Integer()\\\\ + & b1 \\in MathOptInterface.Integer()\\\\ + & c1 \\in MathOptInterface.Integer()\\\\ + & z \\in MathOptInterface.Integer()\\\\ + & fi = 9.0\\\\ + & a \\geq 1.0\\\\ + & c \\geq -1.0\\\\ + & a1 \\geq 1.0\\\\ + & c1 \\geq -1.0\\\\ + & b \\leq 1.0\\\\ + & c \\leq 1.0\\\\ + & b1 \\leq 1.0\\\\ + & c1 \\leq 1.0\\\\ + & a + b - 10 c - 2 x + c1 \\leq 1.0\\\\ + & a\\times b \\leq 2.0\\\\ + & [-a + 1, u_{1}, u_{2}, u_{3}] \\in MathOptInterface.SecondOrderCone(4)\\\\ + \\end{alignat*} + """) + + #------------------------------------------------------------------ + + model_2 = Model() + @variable(model_2, x, Bin) + @variable(model_2, y, Int) + @constraint(model_2, x*y <= 1) + + io_test(REPLMode, model_2, """ + A JuMP Model + Feasibility problem with: + Variables: 2 + `MathOptInterface.SingleVariable`-in-`MathOptInterface.ZeroOne`: 1 constraint + `MathOptInterface.SingleVariable`-in-`MathOptInterface.Integer`: 1 constraint + `MathOptInterface.ScalarQuadraticFunction{Float64}`-in-`MathOptInterface.LessThan{Float64}`: 1 constraint + Model mode: Automatic + CachingOptimizer state: NoOptimizer + Solver name: No optimizer attached. + Names registered in the model: y, x""", repl=:show) + + model_2 = Model() + @variable(model_2, x) + @constraint(model_2, x <= 3) + + io_test(REPLMode, model_2, """ + A JuMP Model + Feasibility problem with: + Variable: 1 + `MathOptInterface.ScalarAffineFunction{Float64}`-in-`MathOptInterface.LessThan{Float64}`: 1 constraint + Model mode: Automatic + CachingOptimizer state: NoOptimizer + Solver name: No optimizer attached. + Names registered in the model: x""", repl=:show) + end end @testset "Printing for JuMP.Model" begin From 67a98d2d4283e9192ac1241edf183cb80fc4597f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Legat?= Date: Wed, 28 Nov 2018 19:07:24 +0100 Subject: [PATCH 2/5] Fix doctests --- docs/src/quickstart.md | 5 +++++ docs/src/variables.md | 1 + src/macros.jl | 1 + src/objective.jl | 1 + 4 files changed, 8 insertions(+) diff --git a/docs/src/quickstart.md b/docs/src/quickstart.md index 3da3da51c98..a6236d2d74d 100644 --- a/docs/src/quickstart.md +++ b/docs/src/quickstart.md @@ -28,6 +28,11 @@ used to specify the optimizer to be used: ```julia julia> model = Model(with_optimizer(GLPK.Optimizer)) A JuMP Model +Feasibility problem with: +Variables: 0 +Model mode: Automatic +CachingOptimizer state: NoOptimizer +Solver name: No optimizer attached. ``` ```@meta diff --git a/docs/src/variables.md b/docs/src/variables.md index 6a46b42ef3a..40b95df7ee5 100644 --- a/docs/src/variables.md +++ b/docs/src/variables.md @@ -28,6 +28,7 @@ To illustrate these three types of variables, consider the following JuMP code ```jldoctest variables julia> model = Model() A JuMP Model +Feasibility problem with: Variables: 0 Model mode: Automatic CachingOptimizer state: NoOptimizer diff --git a/src/macros.jl b/src/macros.jl index 00f960b31df..127758970ce 100644 --- a/src/macros.jl +++ b/src/macros.jl @@ -990,6 +990,7 @@ To minimize the value of the variable `x`, do as follows: ```jldoctest @objective; setup = :(using JuMP) julia> model = Model() A JuMP Model +Feasibility problem with: Variables: 0 Model mode: Automatic CachingOptimizer state: NoOptimizer diff --git a/src/objective.jl b/src/objective.jl index 59817ba802f..f4088a75163 100644 --- a/src/objective.jl +++ b/src/objective.jl @@ -90,6 +90,7 @@ Error if the objective is not convertible to type `T`. ```jldoctest objective_function; setup = :(using JuMP) julia> model = Model() A JuMP Model +Feasibility problem with: Variables: 0 Model mode: Automatic CachingOptimizer state: NoOptimizer From 5b95bd075f436bc035dc5e5d3059f4807d1bda90 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Legat?= Date: Wed, 28 Nov 2018 21:54:13 +0100 Subject: [PATCH 3/5] =?UTF-8?q?=F0=9F=8F=81=20Windows=20print=20fix=20:=20?= =?UTF-8?q?=3D=3D=20vs=20=3D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- test/print.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/print.jl b/test/print.jl index f8c3f5727e5..884a45d9772 100644 --- a/test/print.jl +++ b/test/print.jl @@ -387,7 +387,7 @@ function printing_test(ModelType::Type{<:JuMP.AbstractModel}) b1 $inset MathOptInterface.Integer() c1 $inset MathOptInterface.Integer() z $inset MathOptInterface.Integer() - fi = 9.0 + fi $eq 9.0 a $ge 1.0 c $ge -1.0 a1 $ge 1.0 From 8d23e9966cc1a17a45802be1554924b4dd3be8ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Legat?= Date: Wed, 5 Dec 2018 15:10:53 +0100 Subject: [PATCH 4/5] Fix printing difference with 32 vs 64 bits --- test/print.jl | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/test/print.jl b/test/print.jl index 884a45d9772..58878dd30ff 100644 --- a/test/print.jl +++ b/test/print.jl @@ -402,6 +402,9 @@ function printing_test(ModelType::Type{<:JuMP.AbstractModel}) """, repl=:print) + names_in_scope = Set([:b, :c, :c1, :b1, :a1, :x, :fi, :z, :u, :a, :y]) + # The order in which they appear varies between 32-bit and 64-bit + names_in_scope_str = join(names_in_scope, ", ") io_test(REPLMode, model_1, """ A JuMP Model Maximization problem with: @@ -417,7 +420,7 @@ function printing_test(ModelType::Type{<:JuMP.AbstractModel}) Model mode: Automatic CachingOptimizer state: NoOptimizer Solver name: No optimizer attached. - Names registered in the model: b, c, c1, b1, a1, x, fi, z, u, a, y""", repl=:show) + Names registered in the model: $names_in_scope_str""", repl=:show) io_test(IJuliaMode, model_1, """ \\begin{alignat*}{1}\\max\\quad & a - b + 2 a1 - 10 x\\\\ @@ -451,6 +454,9 @@ function printing_test(ModelType::Type{<:JuMP.AbstractModel}) @variable(model_2, y, Int) @constraint(model_2, x*y <= 1) + names_in_scope = Set([:x, :y]) + # The order in which they appear varies between 32-bit and 64-bit + names_in_scope_str = join(names_in_scope, ", ") io_test(REPLMode, model_2, """ A JuMP Model Feasibility problem with: @@ -461,7 +467,7 @@ function printing_test(ModelType::Type{<:JuMP.AbstractModel}) Model mode: Automatic CachingOptimizer state: NoOptimizer Solver name: No optimizer attached. - Names registered in the model: y, x""", repl=:show) + Names registered in the model: $names_in_scope_str""", repl=:show) model_2 = Model() @variable(model_2, x) From 2fc482efa50aa4324ad6dd3b04df7a8ce838d9d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Legat?= Date: Thu, 6 Dec 2018 12:21:01 +0100 Subject: [PATCH 5/5] Sort object_dictionary key in printing --- src/print.jl | 2 +- test/print.jl | 10 ++-------- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/src/print.jl b/src/print.jl index 9f35e9d1267..f1190f71b0b 100644 --- a/src/print.jl +++ b/src/print.jl @@ -183,7 +183,7 @@ function Base.show(io::IO, model::Model) end # The last print shouldn't have a new line print(io, "Solver name: ", solver_name(model)) - names_in_scope = collect(keys(object_dictionary(model))) + names_in_scope = sort(collect(keys(object_dictionary(model)))) if !isempty(names_in_scope) println(io) print(io, "Names registered in the model: ", diff --git a/test/print.jl b/test/print.jl index 58878dd30ff..1910617a592 100644 --- a/test/print.jl +++ b/test/print.jl @@ -402,9 +402,6 @@ function printing_test(ModelType::Type{<:JuMP.AbstractModel}) """, repl=:print) - names_in_scope = Set([:b, :c, :c1, :b1, :a1, :x, :fi, :z, :u, :a, :y]) - # The order in which they appear varies between 32-bit and 64-bit - names_in_scope_str = join(names_in_scope, ", ") io_test(REPLMode, model_1, """ A JuMP Model Maximization problem with: @@ -420,7 +417,7 @@ function printing_test(ModelType::Type{<:JuMP.AbstractModel}) Model mode: Automatic CachingOptimizer state: NoOptimizer Solver name: No optimizer attached. - Names registered in the model: $names_in_scope_str""", repl=:show) + Names registered in the model: a, a1, b, b1, c, c1, fi, u, x, y, z""", repl=:show) io_test(IJuliaMode, model_1, """ \\begin{alignat*}{1}\\max\\quad & a - b + 2 a1 - 10 x\\\\ @@ -454,9 +451,6 @@ function printing_test(ModelType::Type{<:JuMP.AbstractModel}) @variable(model_2, y, Int) @constraint(model_2, x*y <= 1) - names_in_scope = Set([:x, :y]) - # The order in which they appear varies between 32-bit and 64-bit - names_in_scope_str = join(names_in_scope, ", ") io_test(REPLMode, model_2, """ A JuMP Model Feasibility problem with: @@ -467,7 +461,7 @@ function printing_test(ModelType::Type{<:JuMP.AbstractModel}) Model mode: Automatic CachingOptimizer state: NoOptimizer Solver name: No optimizer attached. - Names registered in the model: $names_in_scope_str""", repl=:show) + Names registered in the model: x, y""", repl=:show) model_2 = Model() @variable(model_2, x)