Skip to content

Commit 4f32cec

Browse files
authored
Merge pull request #9 from odow/od/v3
Add SemVer versions
2 parents d138167 + ddf58c1 commit 4f32cec

9 files changed

+46
-15
lines changed

Diff for: README.md

+8-3
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,10 @@ Encoded in our standard form, we have
3939
Encoded into the MathOptFormat file format, this example becomes:
4040
```json
4141
{
42-
"version": 1,
42+
"version": {
43+
"major": 0,
44+
"minor": 3
45+
},
4346
"variables": [{"name": "x"}],
4447
"objectives": [{
4548
"sense": "min",
@@ -73,8 +76,10 @@ required keys at the top level:
7376

7477
- `"version"`
7578

76-
An integer describing the minimum version of MathOptFormat needed to parse
77-
the file. This is included to safeguard against later revisions.
79+
An object describing the minimum version of MathOptFormat needed to parse
80+
the file. This is included to safeguard against later revisions. It contains
81+
two fields: `"major"` and `"minor"`. These fields should be interpreted
82+
using [SemVer](https://semver.org).
7883

7984
- `"variables"`
8085

Diff for: examples/biobjective.mof.json

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
{
22
"description": "The problem: [min{2x - y + 1}, max{y}]",
3-
"version": 0,
3+
"version": {
4+
"major": 0,
5+
"minor": 3
6+
},
47
"variables": [{
58
"name": "x"
69
}, {
@@ -29,4 +32,4 @@
2932
}
3033
}],
3134
"constraints": []
32-
}
35+
}

Diff for: examples/milp.mof.json

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
{
22
"description": "The problem: min{x | x + y >= 1, x ∈ [0, 1], y ∈ {0, 1}}",
3-
"version": 0,
3+
"version": {
4+
"major": 0,
5+
"minor": 3
6+
},
47
"variables": [{
58
"name": "x",
69
"primal_start": 0.0
@@ -55,4 +58,4 @@
5558
"head": "ZeroOne"
5659
}
5760
}]
58-
}
61+
}

Diff for: examples/nlp.json

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
{
22
"description": "The problem: min{2x + sin(x)^2 + y}.",
3-
"version": 0,
3+
"version": {
4+
"major": 0,
5+
"minor": 3
6+
},
47
"variables": [{
58
"name": "x"
69
}, {
@@ -54,4 +57,4 @@
5457
}
5558
}],
5659
"constraints": []
57-
}
60+
}

Diff for: examples/quadratic.mof.json

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
{
22
"description": "The problem: min{x^2 + x * y + y^2}",
3-
"version": 0,
3+
"version": {
4+
"major": 0,
5+
"minor": 3
6+
},
47
"variables": [{
58
"name": "x"
69
}, {
@@ -32,4 +35,4 @@
3235
}
3336
}],
3437
"constraints": []
35-
}
38+
}

Diff for: examples/vector.json

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
{
22
"description": "The problem: min{0 | [1 2; 3 4][x, y] + [5, 6] ∈ R+.",
3-
"version": 0,
3+
"version": {
4+
"major": 0,
5+
"minor": 3
6+
},
47
"variables": [{
58
"name": "x"
69
}, {
@@ -42,4 +45,4 @@
4245
"dimension": 2
4346
}
4447
}]
45-
}
48+
}

Diff for: mof.schema.json

+10-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,16 @@
77
"properties": {
88
"version": {
99
"description": "The version of MathOptFormat that this schema validates against.",
10-
"const": 0
10+
"type": "object",
11+
"required": ["minor", "major"],
12+
"properties": {
13+
"minor": {
14+
"const": 3
15+
},
16+
"major": {
17+
"const": 0
18+
}
19+
}
1120
},
1221
"name": {
1322
"description": "The name of the model.",

Diff for: mof/.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@
22
*.md
33
*.bat
44
*staticSchema.go
5+
mof

Diff for: mof/mof.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ import (
1414

1515
func main() {
1616
if len(os.Args) < 2 {
17-
fmt.Println("Invalid arguments to `mof`. Here is the help:\n")
17+
fmt.Println("Invalid arguments to `mof`. Here is the help:")
18+
fmt.Println()
1819
PrintHelp()
1920
} else {
2021
switch os.Args[1] {

0 commit comments

Comments
 (0)