Skip to content

Commit

Permalink
Fix for Julia v1.9 by adding check_belongs_to_model (#316)
Browse files Browse the repository at this point in the history
* Fix for Julia v1.9 by adding check_belongs_to_model

* Change location and scope

* Use InfiniteVariableRef instead of DispatchVariableRef

---------

Co-authored-by: pulsipher <joshuapulsipher13@gmail.com>
  • Loading branch information
odow and pulsipher authored May 25, 2023
1 parent b1c835d commit ba79f48
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/infinite_variables.jl
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,21 @@ function _set_core_variable_object(
return
end

################################################################################
# MODEL CHECKING
################################################################################
# TODO(odow): this is a work-around for a bug in Julia v1.9. I've no idea why it
# is necessary.
function JuMP.check_belongs_to_model(
x::InfiniteVariableRef,
model::InfiniteModel
)
if JuMP.owner_model(x) !== model
throw(JuMP.VariableNotOwned(x))
end
return
end

################################################################################
# DEFINTION HELPER METHODS
################################################################################
Expand Down

0 comments on commit ba79f48

Please sign in to comment.