-
Notifications
You must be signed in to change notification settings - Fork 20
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
Update mcp.jl #62
Update mcp.jl #62
Conversation
Force the sparse Jacobian matrix dimensions to match the number of constraints
Thanks! |
Sorry I am new to Julia. |
@andyYaoR Thanks. The above example produces the following error:
@solliolli any idea? |
Hi! Looking at it quickly, I think commit 4d0be88 might have undone my fix to the sparse Jacobian representation. The problem is, I'm not very familiar with this side of MOI, but if I understand correctly, the line Line 154 in cd4fa31
|
The value nc should be the number of constraints in the model, and to fix the issue, I would need to figure out how to extract that number. I'm a bit busy these days, it might take a while for me to familiarize myself with these evaluators, but if anyone feels like they want to try fixing it, please go ahead. |
It seems like replacing the line I mentioned with |
Came across a weird bug when helping a friend who has very little experience on Julia or complementarity modelling. If for some reason, the last variable defined in the model does not appear in any of the complementarity expressions/mappings, that will cause a bug with the sparse Jacobian where the dimensions of that matrix become smaller than the number of constraints. This will then lead to a BoundsError later in the code. A similar bug would happen if the last complementarity constraint had a constant value for the expression/mapping. My proposed fix is to force the correct dimensions for the sparse Jacobian matrix.
Minimal working example modified from the README example: