-
-
Notifications
You must be signed in to change notification settings - Fork 421
Refactor moi_function and jump_function into separate file #4190
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
b44aa05
4786d15
a1c482c
1453209
fcc0f22
fc6234a
44f2498
f9cc382
e037eb1
1ac0a78
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -757,28 +757,6 @@ function add_constraint( | |
| return add_constraint(model, con.constraint, name) | ||
| end | ||
|
|
||
| """ | ||
| jump_function(constraint::AbstractConstraint) | ||
|
|
||
| Return the function of the constraint `constraint` in the function-in-set form | ||
| as a `AbstractJuMPScalar` or `Vector{AbstractJuMPScalar}`. | ||
| """ | ||
| jump_function(constraint::AbstractConstraint) = constraint.func | ||
|
|
||
| """ | ||
| moi_function(constraint::AbstractConstraint) | ||
|
|
||
| Return the function of the constraint `constraint` in the function-in-set form | ||
| as a `MathOptInterface.AbstractFunction`. | ||
| """ | ||
| function moi_function(constraint::AbstractConstraint) | ||
| return moi_function(jump_function(constraint)) | ||
| end | ||
|
|
||
| function moi_function(model, constraint::AbstractConstraint) | ||
| return moi_function(model, jump_function(constraint)) | ||
| end | ||
|
|
||
| """ | ||
| moi_set(constraint::AbstractConstraint) | ||
|
|
||
|
|
@@ -1045,11 +1023,6 @@ function check_belongs_to_model(f::Vector, model) | |
| return | ||
| end | ||
|
|
||
| function moi_function(model, f) | ||
| check_belongs_to_model(f, model) | ||
| return moi_function(f) | ||
| end | ||
|
|
||
|
odow marked this conversation as resolved.
|
||
| """ | ||
| add_constraint( | ||
| model::GenericModel, | ||
|
|
@@ -1066,6 +1039,7 @@ function add_constraint( | |
| name::String = "", | ||
| ) | ||
| con = model_convert(model, con) | ||
| check_belongs_to_model(con, model) | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We just do it explicitly here now instead.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If we're going to call |
||
| func, set = moi_function(model, con), moi_set(con) | ||
| # The type of backend(model) is unknown so we directly redirect to another | ||
| # function. | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.