Skip to content

Fix named constraints Error with Gurobi/CPLEX#109

Merged
guilhermebodin merged 5 commits intomasterfrom
rb/fix_ctrs_names
Jul 14, 2022
Merged

Fix named constraints Error with Gurobi/CPLEX#109
guilhermebodin merged 5 commits intomasterfrom
rb/fix_ctrs_names

Conversation

@rafabench
Copy link
Copy Markdown
Collaborator

@rafabench rafabench commented Jul 8, 2022

Close #105

@codecov
Copy link
Copy Markdown

codecov bot commented Jul 8, 2022

Codecov Report

Merging #109 (115ae92) into master (7106bd9) will decrease coverage by 0.86%.
The diff coverage is 72.22%.

@@            Coverage Diff             @@
##           master     #109      +/-   ##
==========================================
- Coverage   95.77%   94.90%   -0.87%     
==========================================
  Files           4        4              
  Lines         922      942      +20     
==========================================
+ Hits          883      894      +11     
- Misses         39       48       +9     
Impacted Files Coverage Δ
src/ParametricOptInterface.jl 91.49% <72.22%> (-1.44%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 7106bd9...115ae92. Read the comment docs.

name::String,
)
MOI.set(model.optimizer, attr, c, name)
if typeof(c).parameters[1] ==
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is very misterious, I think you should parametrize the type to get the information that you want

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, we should create three separate functions? Like for scalar quadratic function:

MOI.set(
    model::Optimizer,
    attr::MOI.ConstraintName,
    c::MOI.ConstraintIndex{F,S},
    name::String,
) where {S<:MOI.AbstractSet, F <: MOI.ScalarQuadraticFunction{T}}  where {T}

And so on...

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thinnk that tis is a better approach than manually doing the runtime dispatch. We leave it to the julia compiler.

c::MOI.ConstraintIndex,
)
return MOI.get(model.optimizer, attr, c)
if typeof(c).parameters[1] ==
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same thing

@rafabench rafabench requested a review from guilhermebodin July 14, 2022 01:23
@guilhermebodin guilhermebodin merged commit 81c8729 into master Jul 14, 2022
@odow odow deleted the rb/fix_ctrs_names branch April 12, 2023 03:13
ianfiske pushed a commit to ianfiske/ParametricOptInterface.jl that referenced this pull request Oct 12, 2023
Fix named constraints Error with Gurobi/CPLEX
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

Named Constraints Error with Gurobi

2 participants