-
Notifications
You must be signed in to change notification settings - Fork 94
Closed
Description
I have no idea how you'd fix this besides removing value_type(T, ::Type{ScalarNonlinearFunction})
, but currently it is misleading since it just returns T
:
using MathOptInterface
# make a nonlinear function with a Float64 in it
model = MathOptInterface.Utilities.Model{Float64}()
x = MathOptInterface.add_variable(model)
expr = convert(MathOptInterface.ScalarNonlinearFunction, MathOptInterface.VariableIndex(1) + 2.0)
# ask jump what the type will be if we eval with Float32
VT = MathOptInterface.Utilities.value_type(Float32, typeof(expr))
# Float32
# check the real type
RT = typeof(MathOptInterface.Utilities.eval_variables(x -> 3.0f0, model, expr))
# Float64
@assert VT === RT
# AssertionError: VT === RT
It would be nice to have a function that converts all the constants in a nonlinear function to a given type
Metadata
Metadata
Assignees
Labels
No labels