This repository has been archived by the owner on Apr 21, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 9
[MOF] Begin formal JSON schema #47
Merged
Changes from 17 commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
4ebfb45
[MOF] Begin formal JSON schema
odow d3f4c39
More updates to the schema
odow be8fce2
Finish Base MOI schema
odow 7270d65
A few minor fixes
odow 4c8b173
Add nonlinear schema
odow dc29b84
Update schema
odow 06a35f2
Add JSONSchema to validate models
odow 9b63d2d
Remove Manifest file
odow 3e71257
Add manifest to .gitignore
odow 7a5e331
Add minimum values to some integer fields
odow c3bee72
Split functions into scalar and vector types
odow cc20d39
Re-order top-level properties of schema
odow 32a4507
Update field names after #49
odow 3fbfa3c
Add top-level `name` field and minor comment fixes
odow ef34904
Tidy schema
odow 895bacb
Add (validated) example files
odow eeda915
Add more examples
odow 485e80f
Fix coefficients
odow a18aee3
Add descriptions to schema
odow adc73cb
Add VariablePrimalStart attribute
odow File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
*.jl.cov | ||
*.jl.*.cov | ||
*.jl.mem | ||
Manifest.toml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
name = "MathOptFormat" | ||
uuid = "f4570300-c277-12e8-125c-4912f86ce65d" | ||
authors = ["Oscar Dowson <[email protected]"] | ||
version = "0.0.0" | ||
|
||
[deps] | ||
DataStructures = "864edb3b-99cc-5e75-8d2d-829cb0a9cfe8" | ||
GZip = "92fee26a-97fe-5a0c-ad85-20a5f3185b63" | ||
JSON = "682c06a0-de6a-54ab-a142-c8b1cf79cde6" | ||
JSONSchema = "7d188eb4-7ad8-530c-ae41-71a32a6d4692" | ||
MathOptInterface = "b8f27783-ece8-5eb3-8dc8-9495eed66fee" | ||
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" | ||
|
||
[compat] | ||
julia = "1.0" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
{ | ||
"description": "The problem: [min{2x - y + 1}, max{y}]", | ||
"version": 0, | ||
"variables": [{ | ||
"name": "x" | ||
}, { | ||
"name": "y" | ||
}], | ||
"objectives": [{ | ||
"sense": "min", | ||
"function": { | ||
"head": "ScalarAffineFunction", | ||
"terms": [{ | ||
"coefficient": 2, | ||
"variable": "x" | ||
}, | ||
{ | ||
"coefficient": -1, | ||
"variable": "y" | ||
} | ||
], | ||
"constant": 1 | ||
} | ||
}, { | ||
"sense": "max", | ||
"function": { | ||
"head": "SingleVariable", | ||
"variable": "y" | ||
} | ||
}], | ||
"constraints": [] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
{ | ||
"description": "The problem: min{x | x + y >= 1, x ∈ [0, 1], y ∈ {0, 1}}", | ||
"version": 0, | ||
"variables": [{ | ||
"name": "x" | ||
}, { | ||
"name": "y" | ||
}], | ||
"objectives": [{ | ||
"sense": "min", | ||
"function": { | ||
"head": "SingleVariable", | ||
"variable": "x" | ||
} | ||
}], | ||
"constraints": [{ | ||
"name": "x + y >= 1", | ||
"function": { | ||
"head": "ScalarAffineFunction", | ||
"terms": [{ | ||
"coefficient": 1, | ||
"variable": "x" | ||
}, | ||
{ | ||
"coefficient": 1, | ||
"variable": "y" | ||
} | ||
], | ||
"constant": 0 | ||
}, | ||
"set": { | ||
"head": "GreaterThan", | ||
"lower": 1 | ||
} | ||
}, { | ||
"name": "x ∈ [0, 1]", | ||
"function": { | ||
"head": "SingleVariable", | ||
"variable": "x" | ||
}, | ||
"set": { | ||
"head": "Interval", | ||
"lower": 0, | ||
"upper": 1 | ||
} | ||
}, { | ||
"name": "y ∈ {0, 1}", | ||
"function": { | ||
"head": "SingleVariable", | ||
"variable": "y" | ||
}, | ||
"set": { | ||
"head": "ZeroOne" | ||
} | ||
}] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
{ | ||
"description": "The problem: min{2x + sin(x)^2 + y}.", | ||
"version": 0, | ||
"variables": [{ | ||
"name": "x" | ||
}, { | ||
"name": "y" | ||
}], | ||
"objectives": [{ | ||
"sense": "min", | ||
"function": { | ||
"head": "Nonlinear", | ||
"root": { | ||
"head": "node", | ||
"index": 4 | ||
}, | ||
"node_list": [{ | ||
"head": "*", | ||
"args": [{ | ||
"head": "real", | ||
"value": 2 | ||
}, { | ||
"head": "variable", | ||
"name": "x" | ||
}] | ||
}, { | ||
"head": "sin", | ||
"args": [{ | ||
"head": "variable", | ||
"name": "x" | ||
}] | ||
}, { | ||
"head": "^", | ||
"args": [{ | ||
"head": "node", | ||
"index": 2 | ||
}, { | ||
"head": "real", | ||
"value": 2 | ||
}] | ||
}, { | ||
"head": "+", | ||
"args": [{ | ||
"head": "node", | ||
"index": 1 | ||
}, { | ||
"head": "node", | ||
"index": 3 | ||
}, { | ||
"head": "variable", | ||
"name": "y" | ||
}] | ||
}] | ||
} | ||
}], | ||
"constraints": [] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
{ | ||
"description": "The problem: min{x^2 + x * y + y^2}", | ||
"version": 0, | ||
"variables": [{ | ||
"name": "x" | ||
}, { | ||
"name": "y" | ||
}], | ||
"objectives": [{ | ||
"sense": "min", | ||
"function": { | ||
"head": "ScalarQuadraticFunction", | ||
"affine_terms": [], | ||
"quadratic_terms": [{ | ||
"coefficient": 1, | ||
"variable_1": "x", | ||
"variable_2": "x" | ||
}, | ||
{ | ||
"coefficient": 2, | ||
"variable_1": "x", | ||
"variable_2": "y" | ||
}, | ||
{ | ||
"coefficient": 1, | ||
"variable_1": "y", | ||
"variable_2": "y" | ||
} | ||
], | ||
"constant": 0 | ||
} | ||
}], | ||
"constraints": [] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
{ | ||
"description": "The problem: min{0 | [1 2; 3 4][x, y] + [5, 6] ∈ R+.", | ||
"version": 0, | ||
"variables": [{ | ||
"name": "x" | ||
}, { | ||
"name": "y" | ||
}], | ||
"objectives": [], | ||
"constraints": [{ | ||
"function": { | ||
"head": "VectorAffineFunction", | ||
"terms": [{ | ||
"output_index": 1, | ||
"scalar_term": { | ||
"coefficient": 1, | ||
"variable": "x" | ||
} | ||
}, { | ||
"output_index": 1, | ||
"scalar_term": { | ||
"coefficient": 2, | ||
"variable": "y" | ||
} | ||
}, { | ||
"output_index": 2, | ||
"scalar_term": { | ||
"coefficient": 3, | ||
"variable": "x" | ||
} | ||
}, { | ||
"output_index": 2, | ||
"scalar_term": { | ||
"coefficient": 4, | ||
"variable": "y" | ||
} | ||
}], | ||
"constants": [5, 6] | ||
}, | ||
"set": { | ||
"head": "Nonnegatives", | ||
"dimension": 2 | ||
} | ||
}] | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Based on
it should be
min{x^2 + 2 * x * y + y^2}
, right?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.
Oops. You're right that there is a mistake but that is the wrong one. I doubled the wrong value.
This is an annoying point that has come up a few times (e.g., JuliaOpt/LinQuadOptInterface.jl#22).
MOI defines the ScalarQuadraticFunction as
0.5 x' Q x
.