Skip to content
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

Merged
merged 3 commits into from
Oct 26, 2019

Conversation

frapac
Copy link
Collaborator

@frapac frapac commented Oct 9, 2019

Copy link
Member

@odow odow left a 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?)

@frapac
Copy link
Collaborator Author

frapac commented Oct 9, 2019

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!

@odow
Copy link
Member

odow commented Oct 9, 2019

btw, let me know if you want me to add this test to MOI

Yes, please! I'm considering writing a simple MPEC solver which just does the transformation and passes off to an NLP solver.

@frapac
Copy link
Collaborator Author

frapac commented Oct 9, 2019

@odow I made a PR directly on your development branch. I can write other tests if you think that could prove useful :)

@odow
Copy link
Member

odow commented Oct 9, 2019

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)
Copy link
Member

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.

Copy link
Collaborator Author

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.

Copy link
Member

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?

@frapac frapac merged commit f68bc54 into master Oct 26, 2019
@frapac frapac deleted the fp/complementarity branch October 26, 2019 10:29
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.

2 participants