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

deprecate + on constraints #659

Merged
merged 7 commits into from
May 14, 2024
Merged

Conversation

ericphanson
Copy link
Collaborator

@ericphanson ericphanson commented May 14, 2024

IMO it is kind of goofy, and doesn't match how the rest of Julia works which can make it confusing. There is also not much of a mathematical or translation purpose; I've never seen constraints written that way in a paper.

Also, I've updated the Problem constructors to be less picky about the types, which makes manual construction of the constraints vector (like constraints = []; push!(...) less annoying). I suspect the p = minimize(...); p.constraints += ... thing was partly to make the constructors work.

Lastly, I fixed a small bug: the field constraints was typed as an Array, which meant you could construct a Matrix{Constraint} as the constraints field in Problem, which would then break the new printing code. Here I've typed it as a Vector.

@warn(
"Adding constraints together (with `+` or `+=`) to produce a list of constraints is deprecated. Instead, construct a list of constraints via `[constraint1, constraint2]`",
maxlog = 1
)
Copy link
Member

Choose a reason for hiding this comment

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

Does this need a separate warning? You can still use vcat(x, y)

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 thought it might be confusing to share an error, since someone doing x + y might not think of it that way

Copy link

codecov bot commented May 14, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 97.96%. Comparing base (68e9efc) to head (90016a6).
Report is 5 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #659      +/-   ##
==========================================
+ Coverage   97.88%   97.96%   +0.07%     
==========================================
  Files          89       89              
  Lines        5205     5203       -2     
==========================================
+ Hits         5095     5097       +2     
+ Misses        110      106       -4     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@ericphanson ericphanson merged commit 5b968d1 into master May 14, 2024
10 checks passed
@ericphanson ericphanson deleted the eph/deprecate-+-on-constraints branch May 14, 2024 22:00
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