Comments (9)
See https://jump.dev/JuMP.jl/stable/manual/constraints/#Set-inequality-syntax
The set defines the partial ordering of >=
.
@constraint(model, X >= Y, Nonpositives()
means X - Y in Nonpositives()
, or X - Y <= 0
.
from jump.jl.
Sure. We intentionally conflate the two because ⪰
is hard to type in ASCII.
from jump.jl.
We can probably make this work
@constraint(model, Symmetric(A) == Symmetric(B))
by adding something like
function build_constraint(error_fn, Q::Symmetric, set::Union{Zeros,Nonnegatives,Nonpositives})
n = LinearAlgebra.checksquare(Q)
shape = SymmetricMatrixShape(n)
return VectorConstraint(
vectorize(Q, shape),
set,
shape,
)
end
For the inequality, I'd prefer an explicit:
@constraint(model, Symmetric(A) >= Symmetric(B), Nonnegatives())
because most user would actually expect a PSD constraint, not elementwise inequality when you do an inequality between matrices so it would be too confusing to make it work without the extra argument.
Currently, Nonnegatives
will be added by default and you get an error:
Lines 575 to 582 in 56b186f
Adding the
build_constraint
I suggest above wouldn't distinguish between the case where Nonnegatives
is added explicitly. We would need a way to distinguish it before allow Nonnegatives
in build_constraint
.from jump.jl.
We can probably make this work
@constraint(model, Symmetric(A) == Symmetric(B))
Err, note that for equality, it already works.
For the inequality, I'd prefer an explicit:
@constraint(model, Symmetric(A) >= Symmetric(B), Nonnegatives())
Without ever having used the PSD side of things,
this syntax looks kinda weird to me.
What happens if the wrong set is specified?
from jump.jl.
because most user would actually expect a PSD constraint
Agreed. We discussed this, see #3281 (comment)
@constraint(model, Symmetric(A) >= Symmetric(B), Nonnegatives())
👍 this solves a lot of issues.
What happens if the wrong set is specified?
There is no such thing as the "wrong" set. The constraint is rewritten to Symmetric(A) - Symmetric(B) in Set()
from jump.jl.
What happens if the wrong set is specified?
There is no such thing as the "wrong" set. The constraint is rewritten to
Symmetric(A) - Symmetric(B) in Set()
What i mean is, there's both the inequality comparison between A
and B
,
and a statement about the set to which the A-B
belong to.
One of these is redundant.
A >= B,
is A - B >= 0
aka A - B in Nonnegatives
, sure, absolutely.
But what would A - B >= 0, Nonpositives
aka A - B in Nonnegatives in Nonpositives
mean?
That's a bogus constraint (it should be an equality-with-zero constraint), that is not exactly easy to spot,
so i would very much hope that it would be invalid and rejected with a diagnostic.
And by that point, what's the point of accepting both the set and the inequality operator?
It's a footgun. (At most, perhaps it should be some syntactic sugar placeholder set that is otherwise unused.)
from jump.jl.
Oh wow, that is the most exquisite design decision (strictly from the user-facing view,
i'm sure it makes sense from the internal implementation detail) i've seen in last few years...
from jump.jl.
I might be misinterpreting your comment, but this is not a design decision that is unique to JuMP.
It follows from the syntax for the generalized inequality of a cone:
See, e.g., Section 2.4.1 of Boyd and Vandenberghe.
from jump.jl.
I might be misinterpreting your comment,
It is more that i'm failing to fully convey my point :)
It follows from the syntax for the generalized inequality of a cone:
x⪰Ky⟺x−y∈K
See, e.g., Section 2.4.1 of Boyd and Vandenberghe.
Yes, but that's ⪰
, which is not the same symbol as ≥
,
though they may look similar in small font size.
I just feel like that ≥
have a very well defined meaning,
so reusing them in this context is confusing.
Anyways, that would be better than nothing i suppose :)
from jump.jl.
Related Issues (20)
- Documentation Request: List whether a solver supports Indicator Constraints HOT 4
- Bullet point alignment in bibliography HOT 9
- Multiplication of matrix expression and variables leads to stack overflow and matmul error HOT 4
- Multiple Ranges for variables HOT 3
- Y' when Y is of type ::Matrix{NonlinearExpr} HOT 1
- Poor performance in complementarity models HOT 23
- Add a method for Complex(a,b) HOT 8
- MethodError with empty summations HOT 1
- Nonlinear subexpressions HOT 4
- Should error when trying to mix `NonlinearExpression` and `GenericNonlinearExpr` HOT 1
- Support normalized_coefficient for vector-valued constraints
- Precompilation in CI fails on v1.22 HOT 7
- Fuzzy search on unrecognized keyword arguments to give suggestions HOT 2
- Track failures on nightly HOT 3
- Possibly missing diagnostics for vector of vector of variables HOT 3
- Printing of large vectorized constraints should probably cause output eliding? HOT 5
- Deleting part of containerized constraints makes whole constraint unprintable HOT 2
- function_string of Symmetric matrix includes the entire matrix HOT 7
- Set inequality syntax suggestion HOT 28
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jump.jl.