ParameterHandling.jl icon indicating copy to clipboard operation
ParameterHandling.jl copied to clipboard

[Feature request] `bounded` with equality (ie `[low, high]` rather than `(low, high)`)

Open theo-brown opened this issue 1 year ago • 3 comments

It would be great to add an option to bounded so that it supports interval constraints with equality.

Current behaviour:

julia> bounded(0., 0., 1.)
ERROR: ArgumentError: Value, 0.0, outside of specified bounds (0.0, 1.0).
Stacktrace:
 [1] bounded(val::Float64, lower_bound::Float64, upper_bound::Float64)
   @ ParameterHandling ~/.julia/packages/ParameterHandling/QaqXk/src/parameters_scalar.jl:54

theo-brown avatar Feb 09 '24 11:02 theo-brown

This would be nice, but I'm not sure how you could achieve this in practice. Do you have any thoughts?

willtebbutt avatar Feb 09 '24 12:02 willtebbutt

(The reason that we only support open intervals at the minute is because the bijections that we use map the bounds to -Inf and Inf )

willtebbutt avatar Feb 09 '24 12:02 willtebbutt

Agree - I've just had a look at the code for how it's currently implemented, and it's tricky to see how we'd adapt it to this. I'll have a think.

theo-brown avatar Feb 09 '24 12:02 theo-brown