Skip to content

Conversation

@odow
Copy link
Member

@odow odow commented Jan 28, 2026

Closes #2922

@odow odow merged commit 7f1c089 into master Jan 28, 2026
31 checks passed
@odow odow deleted the od/indicator-distance branch January 28, 2026 22:42
@MagicMuscleMan
Copy link

Thanks a lot, @odow, to implement this so quickly!

Just do double check: Is it correct, that the distance is now limited to the interval [0, 1] if the indicator variable behaves well? I.e. independent of how large the distance of set.set is, due to the min, this will never exceed 1.
This feels incorrect, but might be irrelevant, if it's guaranteed that distances are always below 1 in all relevant cases.

Additionally: Is it on purpose that x is defined differently in both new methods? I would have expected either x::AbstractVector{<:Real} or x::AbstractVector for both methods, but neither of the two variants with where which you used, as T is not used and I currently don't see which extra specialization hint could be needed.

My thoughts might be incorrect as I don't know the package well enough, but maybe a comment would help the uninformed reader if the code stays as it is.

@odow
Copy link
Member Author

odow commented Jan 29, 2026

Is it correct, that the distance is now limited to the interval [0, 1] if the indicator variable behaves well?

Yes. That follows from the definition of the set, since we can trivially satisfy feasibility by fixing the z variable to the "off" state. Our distance is "what is the L2 distance we can change the input vector by to satisfy feasibility, not what is the distance to the indicated constraint, conditional on the binary"

Is it on purpose that x is defined differently in both new methods?

Oops. No. I'l make a follow-up PR. I meant to add tests for the complex case, but I obviously forgot.

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.

primal_feasibility_report fails with indicator constraints in distance_to_set

3 participants