diff --git a/src/reformulations/log1p.jl b/src/reformulations/log1p.jl new file mode 100644 index 000000000..acf3d2f8e --- /dev/null +++ b/src/reformulations/log1p.jl @@ -0,0 +1,6 @@ +# Copyright (c) 2014: Madeleine Udell and contributors +# +# Use of this source code is governed by a BSD-style license that can be found +# in the LICENSE file or at https://opensource.org/license/bsd-2-clause + +Base.log1p(x::AbstractExpr) = log(1 + x) diff --git a/test/test_atoms.jl b/test/test_atoms.jl index f198c7a02..1f48f325a 100644 --- a/test/test_atoms.jl +++ b/test/test_atoms.jl @@ -2272,6 +2272,20 @@ function test_inner_product() return end +### reformulations/log1p + +function test_log1p() + target = """ + variables: t, x + minobjective: 1.0 * t + 0.0 + [1.0 * t, 1.0, 1.0 * x + 1.0] in ExponentialCone() + """ + _test_reformulation(target) do context + return log1p(Variable(1)) + end + return +end + ### reformulations/norm function test_norm()