-
Notifications
You must be signed in to change notification settings - Fork 121
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
Conversation
Co-authored-by: Oscar Dowson <[email protected]>
@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 | ||
) |
There was a problem hiding this comment.
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)
There was a problem hiding this comment.
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
Co-authored-by: Oscar Dowson <[email protected]>
docs/src/examples/optimization_with_complex_variables/povm_simulation.jl
Outdated
Show resolved
Hide resolved
Codecov ReportAll modified and coverable lines are covered by tests ✅
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. |
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 (likeconstraints = []; push!(...)
less annoying). I suspect thep = minimize(...); p.constraints += ...
thing was partly to make the constructors work.Lastly, I fixed a small bug: the field
constraints
was typed as anArray
, which meant you could construct aMatrix{Constraint}
as theconstraints
field inProblem
, which would then break the new printing code. Here I've typed it as aVector
.