Skip to content

Commit aba1e78

Browse files
authored
Add Scaled set (#30)
1 parent 83c9731 commit aba1e78

File tree

4 files changed

+1189
-2
lines changed

4 files changed

+1189
-2
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ called _MathOptFormat_ with the file extension `.mof.json`.
55

66
MathOptFormat is rigidly defined by the [JSON schema](http://json-schema.org/)
77
available at
8-
[`https://jump.dev/MathOptFormat/schemas/mof.1.4.schema.json`](https://jump.dev/MathOptFormat/schemas/mof.1.4.schema.json).
8+
[`https://jump.dev/MathOptFormat/schemas/mof.1.5.schema.json`](https://jump.dev/MathOptFormat/schemas/mof.1.5.schema.json).
99

1010
It is intended for the schema to be self-documenting. Instead of modifying or
1111
adding to this documentation, clarifying edits should be made to the
@@ -266,6 +266,7 @@ Here is a summary of the sets defined by MathOptFormat.
266266
| `"HyperRectangle"` | x ∈ {R^d: x_i ∈ [lower_i, upper_i]} | {"type": "HyperRectangle", "lower": [0, 0], "upper": [1, 1]} |
267267
| `"HermitianPositiveSemidefiniteConeTriangle"` | The (vectorized) cone of Hermitian positive semidefinite matrices, with non-negative side_dimension rows and columns. | {"type": "HermitianPositiveSemidefiniteConeTriangle", "side_dimension": 3} |
268268
| `"NormCone"` | The p-norm cone (t, x) ∈ {R^d : t ≥ (Σᵢ\|xᵢ\|^p)^(1/p)}. | {"type": "NormCone", "dimension": 3, "p": 1.5} |
269+
| `"Scaled"` | The set in the `set` field, scaled such that the inner product of two elements in the set is the same as the dot product of the two vector functions. This is most useful for solvers which require PSD matrices in _scaled_ form. | {"type": "Scaled", "set": {"type": "PositiveSemidefiniteConeTriangle", "side_dimension": 2}} |
269270

270271
### Nonlinear functions
271272

examples/scaled.json

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"version": {"major": 1, "minor": 5},
3+
"variables": [{"name": "x"}, {"name": "y"}, {"name": "z"}],
4+
"objective": {"sense": "feasibility"},
5+
"constraints": [{
6+
"function": {
7+
"type": "VectorOfVariables",
8+
"variables": ["x", "y", "z"]
9+
},
10+
"set": {
11+
"type": "Scaled",
12+
"set": {
13+
"type": "PositiveSemidefiniteConeTriangle",
14+
"side_dimension": 2
15+
}
16+
}
17+
}]
18+
}

python/mof.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import os
44

55

6-
SCHEMA_FILENAME = '../schemas/mof.1.4.schema.json'
6+
SCHEMA_FILENAME = '../schemas/mof.1.5.schema.json'
77

88
def validate(filename):
99
with open(filename, 'r', encoding='utf-8') as io:

0 commit comments

Comments
 (0)