@@ -106,7 +106,7 @@ MOI.Utilities.@model(
106
106
# Reified is handled by UniversalFallback.
107
107
# Scaled is handled by UniversalFallback.
108
108
109
- const Model = MOI. Utilities. UniversalFallback{InnerModel{Float64 }}
109
+ const Model{T} = MOI. Utilities. UniversalFallback{InnerModel{T }}
110
110
111
111
struct Options
112
112
print_compact:: Bool
@@ -124,29 +124,43 @@ function get_options(m::Model)
124
124
end
125
125
126
126
"""
127
- Model(; kwargs...)
127
+ Model(;
128
+ print_compact::Bool = false,
129
+ warn::Bool = false,
130
+ differentiation_backend::MOI.Nonlinear.AbstractAutomaticDifferentiation =
131
+ MOI.Nonlinear.SparseReverseMode(),
132
+ use_nlp_block::Union{Bool,Nothing} = nothing,
133
+ coefficient_type::Type{T} = Float64,
134
+ ) where {T}
128
135
129
136
Create an empty instance of FileFormats.MOF.Model.
130
137
131
138
Keyword arguments are:
132
139
133
140
- `print_compact::Bool=false`: print the JSON file in a compact format without
134
141
spaces or newlines.
142
+
135
143
- `warn::Bool=false`: print a warning when variables or constraints are renamed
144
+
136
145
- `differentiation_backend::MOI.Nonlinear.AbstractAutomaticDifferentiation = MOI.Nonlinear.SparseReverseMode()`:
137
146
automatic differentiation backend to use when reading models with nonlinear
138
147
constraints and objectives.
139
- - `use_nlp_block::Bool=true`: if `true` parse `"ScalarNonlinearFunction"`
148
+
149
+ `use_nlp_block::Bool=true`: if `true` parse `"ScalarNonlinearFunction"`
140
150
into an `MOI.NLPBlock`. If `false`, `"ScalarNonlinearFunction"` are parsed as
141
151
`MOI.ScalarNonlinearFunction` functions.
152
+
153
+ - `coefficient_type::Type{T} = Float64`: the supported type to use when reading
154
+ and writing files.
142
155
"""
143
156
function Model (;
144
157
print_compact:: Bool = false ,
145
158
warn:: Bool = false ,
146
159
differentiation_backend:: MOI.Nonlinear.AbstractAutomaticDifferentiation = MOI. Nonlinear. SparseReverseMode (),
147
160
use_nlp_block:: Union{Bool,Nothing} = nothing ,
148
- )
149
- model = MOI. Utilities. UniversalFallback (InnerModel {Float64} ())
161
+ coefficient_type:: Type{T} = Float64,
162
+ ) where {T}
163
+ model = MOI. Utilities. UniversalFallback (InnerModel {T} ())
150
164
model. model. ext[:MOF_OPTIONS ] =
151
165
Options (print_compact, warn, differentiation_backend, use_nlp_block)
152
166
return model
0 commit comments