Skip to content

Commit

Permalink
Add Scaled set (#30)
Browse files Browse the repository at this point in the history
  • Loading branch information
odow authored Sep 7, 2023
1 parent 83c9731 commit aba1e78
Show file tree
Hide file tree
Showing 4 changed files with 1,189 additions and 2 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ called _MathOptFormat_ with the file extension `.mof.json`.

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

It is intended for the schema to be self-documenting. Instead of modifying or
adding to this documentation, clarifying edits should be made to the
Expand Down Expand Up @@ -266,6 +266,7 @@ Here is a summary of the sets defined by MathOptFormat.
| `"HyperRectangle"` | x ∈ {R^d: x_i ∈ [lower_i, upper_i]} | {"type": "HyperRectangle", "lower": [0, 0], "upper": [1, 1]} |
| `"HermitianPositiveSemidefiniteConeTriangle"` | The (vectorized) cone of Hermitian positive semidefinite matrices, with non-negative side_dimension rows and columns. | {"type": "HermitianPositiveSemidefiniteConeTriangle", "side_dimension": 3} |
| `"NormCone"` | The p-norm cone (t, x) ∈ {R^d : t ≥ (Σᵢ\|xᵢ\|^p)^(1/p)}. | {"type": "NormCone", "dimension": 3, "p": 1.5} |
| `"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}} |

### Nonlinear functions

Expand Down
18 changes: 18 additions & 0 deletions examples/scaled.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"version": {"major": 1, "minor": 5},
"variables": [{"name": "x"}, {"name": "y"}, {"name": "z"}],
"objective": {"sense": "feasibility"},
"constraints": [{
"function": {
"type": "VectorOfVariables",
"variables": ["x", "y", "z"]
},
"set": {
"type": "Scaled",
"set": {
"type": "PositiveSemidefiniteConeTriangle",
"side_dimension": 2
}
}
}]
}
2 changes: 1 addition & 1 deletion python/mof.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import os


SCHEMA_FILENAME = '../schemas/mof.1.4.schema.json'
SCHEMA_FILENAME = '../schemas/mof.1.5.schema.json'

def validate(filename):
with open(filename, 'r', encoding='utf-8') as io:
Expand Down
Loading

0 comments on commit aba1e78

Please sign in to comment.