-
Notifications
You must be signed in to change notification settings - Fork 23
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
Wrap MOI.Complements to Knitro complementarity constraints #130
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice! I like how easily this fits. Does it pass the linear mixed complementarity test? (With bridges to convert from VectorAffineTerm to VectorOfVariables?)
Currently, I have tested only with a MOI version of examples/mpec1.jl (btw, let me know if you want me to add this test to MOI). I was planning to test the linear mixed complementarity test this evening! |
Yes, please! I'm considering writing a simple MPEC solver which just does the transformation and passes off to an NLP solver. |
@odow I made a PR directly on your development branch. I can write other tests if you think that could prove useful :) |
The more the merrier. |
# (x_aux complements x) | ||
# | ||
function MOI.add_constraint(model::Optimizer, | ||
func::MOI.VectorAffineFunction, set::MOI.Complements) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think you need to support this. You can leave a bridge to convert VectorAffineFunction
into VectorOfVariables
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree. However, for some reason, the bridged optimizer is unable to formulate the complementarity constraint in a valid manner. We are calling the function
KN_set_compcons(m::Model, ccTypes::Vector{Cint}, indexComps1::Vector{Cint}, indexComps2::Vector{Cint})
with vectors indexComps{1,2}
having different length, resulting in an error in Knitro.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm. That sounds like a bug. Can you make a simple reproducible example?
CC jump-dev/MathOptInterface.jl#913