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

MOI Constraint jacobian-vector fixes #845

Merged
merged 3 commits into from
Oct 30, 2024

Conversation

aml5600
Copy link
Contributor

@aml5600 aml5600 commented Oct 21, 2024

Checklist

  • Appropriate tests were added
  • Any code changes were done in a way that does not break public API
  • All documentation related to code changes were updated
  • The new code follows the
    contributor guidelines, in particular the SciML Style Guide and
    COLPRAC.
  • Any new documentation only uses public API

Additional context

It seems that the methods MOI.eval_constraint_jacobian_transpose_product and MOI.eval_constraint_jacobian_product were incorrectly both evaluating the products and erroring when the evaluator possessed cons_vjp or cons_jvp functions.

Add any other context about the problem here.

@aml5600
Copy link
Contributor Author

aml5600 commented Oct 21, 2024

FYI @baggepinnen

@ChrisRackauckas
Copy link
Member

Can you add a test which catches this?

@Vaibhavdixit02
Copy link
Member

@aml5600 can you add the test, happy to merge it right away once that's added

@aml5600
Copy link
Contributor Author

aml5600 commented Oct 29, 2024

@Vaibhavdixit02 sorry for the delay, please let me know if the tests are sufficient. They failed before, passed after the changes.

y = zeros(2)
w = ones(1)
@test MathOptInterface.eval_constraint_jacobian_transpose_product(
evaluator, y, x, w) isa Any
Copy link
Member

Choose a reason for hiding this comment

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

Is it really Any here? I guess since it's inplace it returns nothing?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I guess it should return nothing? I just have used isa Any on tests that modify inputs to verify that they don't fail. I figured checking the correctness of the return values in y was a bit out of scope for this PR.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

made it explicitly return nothing.

@Vaibhavdixit02 Vaibhavdixit02 merged commit 5cb17b6 into SciML:master Oct 30, 2024
18 of 25 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants