Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
odow committed Aug 15, 2023
1 parent a5125c5 commit 71b3f5f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
14 changes: 9 additions & 5 deletions src/macros.jl
Original file line number Diff line number Diff line change
Expand Up @@ -944,6 +944,13 @@ function model_convert(model::AbstractModel, con::VectorConstraint)
)
end

function model_convert(model::AbstractModel, x::VariableConstrainedOnCreation)
return VariableConstrainedOnCreation(
x.scalar_variable,
model_convert(model, x.set),
)
end

# TODO: update 3-argument @constraint macro to pass through names like @variable

"""
Expand Down Expand Up @@ -2737,12 +2744,9 @@ macro variable(args...)
)
end
end
buildcall = :(build_variable(
$_error,
$scalar_variables,
model_convert($model, $set),
))
buildcall = :(build_variable($_error, $scalar_variables, $set))
end
buildcall = :(model_convert($model, $buildcall))
new_name_code = if isempty(set_string_name_kw_args)
Expr(:if, :(set_string_names_on_creation($model)), name_code, "")
else
Expand Down
4 changes: 0 additions & 4 deletions src/sets.jl
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,3 @@ end
function moi_set(set::Parameter{T}) where {T}
return MOI.Parameter{T}(set.value)
end

function model_convert(model::AbstractModel, set::Parameter)
return Parameter(convert(value_type(typeof(model)), set.value))
end

0 comments on commit 71b3f5f

Please sign in to comment.