From aa0d10a33fccf380fd495eef4a064da971d12073 Mon Sep 17 00:00:00 2001 From: odow Date: Tue, 12 Sep 2023 13:54:27 +1200 Subject: [PATCH] Fix formatting --- src/nlp_expr.jl | 12 ++---------- test/test_nlp_expr.jl | 4 ++-- 2 files changed, 4 insertions(+), 12 deletions(-) diff --git a/src/nlp_expr.jl b/src/nlp_expr.jl index acf294984f9..975914f1269 100644 --- a/src/nlp_expr.jl +++ b/src/nlp_expr.jl @@ -409,11 +409,7 @@ function _MA.operate!!( return +(x, *(args...)) end -function _MA.operate( - ::typeof(*), - x::Real, - y::GenericNonlinearExpr{V}, -) where {V} +function _MA.operate(::typeof(*), x::Real, y::GenericNonlinearExpr{V}) where {V} if iszero(x) return zero(value_type(V)) elseif isone(x) @@ -423,11 +419,7 @@ function _MA.operate( end end -function _MA.operate( - ::typeof(*), - x::GenericNonlinearExpr{V}, - y::Real, -) where {V} +function _MA.operate(::typeof(*), x::GenericNonlinearExpr{V}, y::Real) where {V} if iszero(y) return zero(value_type(V)) elseif isone(y) diff --git a/test/test_nlp_expr.jl b/test/test_nlp_expr.jl index bc2673df6ab..9237f113e41 100644 --- a/test/test_nlp_expr.jl +++ b/test/test_nlp_expr.jl @@ -932,10 +932,10 @@ function test_simplification_of_add_and_mul_with_one_or_zero() model = Model() @variable(model, x[1:2, 1:3]) @expression(model, f[a in 1:2], sum(x[a, b]^σ[b] * p[a, b] for b in 1:3)) - f2 = [x[1,1]^0.5 + (x[1,3]^0.25 * 3.0), x[2, 2]^0.75 * 5.0] + f2 = [x[1, 1]^0.5 + (x[1, 3]^0.25 * 3.0), x[2, 2]^0.75 * 5.0] @test isequal_canonical(f, f2) @expression(model, g[a in 1:2], sum(p[a, b] * x[a, b]^σ[b] for b in 1:3)) - g2 = [x[1,1]^0.5 + (3.0 * x[1,3]^0.25), 5.0 * x[2, 2]^0.75] + g2 = [x[1, 1]^0.5 + (3.0 * x[1, 3]^0.25), 5.0 * x[2, 2]^0.75] @test isequal_canonical(g, g2) return end