Skip to content

Commit

Permalink
Update variables.jl
Browse files Browse the repository at this point in the history
  • Loading branch information
odow authored Oct 31, 2024
1 parent 655bc7a commit 83076c9
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/variables.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2013,11 +2013,14 @@ function _moi_add_variable(
if info.integer
index = _moi_add_constrained_variable(moi_backend, index, MOI.Integer())
end
if index === nothing
index = MOI.add_variable(moi_backend)
end
x = GenericVariableRef(model, index::MOI.VariableIndex)
if info.has_start && info.start !== nothing
start = _to_value(T, info.start, "start value")
MOI.set(moi_backend, MOI.VariablePrimalStart(), index, start)
end
x = GenericVariableRef(model, index)
if !isempty(name)
if MOI.supports(moi_backend, MOI.VariableName(), MOI.VariableIndex)
set_name(x, name)
Expand Down

0 comments on commit 83076c9

Please sign in to comment.