From 1b6485b2a12d90feb92d9f73bcaf3216763506a3 Mon Sep 17 00:00:00 2001 From: odow Date: Wed, 9 Feb 2022 14:33:53 +1300 Subject: [PATCH] [Bridges] convert GeoMeanBridge to inner constructor --- src/Bridges/Constraint/geomean.jl | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/Bridges/Constraint/geomean.jl b/src/Bridges/Constraint/geomean.jl index 337a1c8531..e13bf540cf 100644 --- a/src/Bridges/Constraint/geomean.jl +++ b/src/Bridges/Constraint/geomean.jl @@ -40,6 +40,23 @@ struct GeoMeanBridge{T,F,G,H} <: AbstractBridge Nothing, MOI.ConstraintIndex{H,MOI.Nonnegatives}, } + # We use an internal constructor here so that users cannot pass + # GeoMeanBridge(args..., nothing) can cause a `H not defined` error. + function GeoMeanBridge{T,F,G,H}( + d, + xij, + t_upper_bound_constraint, + rsoc, + x_nonnegative_constraint, + ) where {T,F,G,H} + return new{T,F,G,H}( + d, + xij, + t_upper_bound_constraint, + rsoc, + x_nonnegative_constraint, + ) + end end _ilog2(n, i = 0) = n <= (1 << i) ? i : _ilog2(n, i + 1)