Skip to content

Commit 763e55b

Browse files
committed
doc files
1 parent f428189 commit 763e55b

4 files changed

Lines changed: 158 additions & 0 deletions

File tree

docs/RULES_hs85_hs89.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# OptimizationProblems.jl Rules — HS85 & HS89 Example
2+
3+
| Rule | HS85 | HS89 | How to Check |
4+
|------|------|------|--------------|
5+
| File Structure | src/ADNLPProblems/hs85.jl, src/PureJuMP/hs85.jl, src/Meta/hs85.md | src/ADNLPProblems/hs89.jl, src/PureJuMP/hs89.jl, src/Meta/hs89.md | Check for all three files per problem |
6+
| Header | HS-style header: source, classification, implementation date | Same | Parse header comments for required fields |
7+
| Mathematical Expressions | All intermediates, constraints, objective explicit, match paper | Same | Compare expressions to paper and extracted JSON |
8+
| Variable Bounds | Explicit bounds and x0 in ADNLP and PureJuMP | Same | Check for bounds and x0 in both files |
9+
| Metadata | References, classification, origin, scalable, etc. in Meta file | Same | Parse Meta file for required metadata |
10+
| Naming | hs85.jl, hs85_jump.jl, hs85.md | hs89.jl, hs89_jump.jl, hs89.md | Check file/function names |
11+
| Allocation | Constraint function minimizes allocations (relaxed for complex) | Same | Run allocation test or allow allocation |
12+
| Ipopt Solve | Problem solves with Ipopt (PureJuMP) | Same | Run Ipopt solver and check for solution |
13+
| Reviewer Markdown | Summary, PDF screenshot, extraction uncertainties, test results | Same | Generate reviewer markdown file |
14+
| Duplication | No duplicate (by name, structure, metadata) | Same | Check for similar names/metadata |
15+
| Traceability | Origin clear and referenced in header/Meta | Same | Check Meta/header |
16+
| Scalability | Marked if scalable (not for hs85/hs89) | Same | Check Meta/implementation |
17+
| Multiple Problems | One PDF = one problem (for hs85/hs89) | Same | Allow multiple if needed |
18+
| Uncertainty | Warn if extraction unclear (not for hs85/hs89) | Same | Parse extraction JSON for uncertainties |
19+
20+
---
21+
22+
This table is tailored to HS85 and HS89. Use as a checklist for similar problems and PRs.

docs/check_rules.jl

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# Script to check OptimizationProblems.jl rules for HS85/HS89
2+
using JSON
3+
4+
function check_problem(problem::String)
5+
result = Dict()
6+
# File structure
7+
result["ADNLP"] = isfile("src/ADNLPProblems/$problem.jl")
8+
result["PureJuMP"] = isfile("src/PureJuMP/$problem.jl")
9+
result["Meta"] = isfile("src/Meta/$problem.md")
10+
# Header
11+
header_ok = false
12+
if result["ADNLP"]
13+
header = readlines("src/ADNLPProblems/$problem.jl")[1:10]
14+
header_ok = any(occursin("Hock and Schittkowski", h) for h in header)
15+
end
16+
result["Header"] = header_ok
17+
# Bounds/x0
18+
bounds_ok = false
19+
if result["ADNLP"]
20+
file = String(read("src/ADNLPProblems/$problem.jl"))
21+
bounds_ok = occursin("lvar", file) && occursin("uvar", file) && occursin("x0", file)
22+
end
23+
result["Bounds"] = bounds_ok
24+
# Metadata
25+
meta_ok = false
26+
if result["Meta"]
27+
meta = String(read("src/Meta/$problem.md"))
28+
meta_ok = occursin("Source", meta) && occursin("classification", meta)
29+
end
30+
result["Metadata"] = meta_ok
31+
# Allocation (relaxed)
32+
result["Allocation"] = false
33+
# Ipopt solve (not checked here)
34+
result["IpoptSolve"] = "manual"
35+
# Reviewer markdown
36+
result["ReviewerMarkdown"] = isfile("docs/review_$problem.md")
37+
return result
38+
end
39+
40+
function main()
41+
problems = ["hs85", "hs89"]
42+
results = Dict()
43+
for p in problems
44+
results[p] = check_problem(p)
45+
end
46+
println(JSON.json(results))
47+
end
48+
49+
main()

docs/extract_hs85.json

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
{
2+
"problem": "hs85",
3+
"source": "Hock and Schittkowski, Problem 85",
4+
"variables": ["x1", "x2", "x3", "x4", "x5"],
5+
"bounds": {
6+
"lvar": [704.4148, 68.6, 0.0, 193.0, 25.0],
7+
"uvar": [906.3855, 288.88, 134.75, 287.0966, 84.1988],
8+
"x0": [900.0, 80.0, 115.0, 267.0, 27.0]
9+
},
10+
"objective": "-5.843e-7 * y17 + 1.17e-4 * y14 + 2.358e-5 * y13 + 1.502e-6 * y16 + 0.0321 * y12 + 0.004324 * y5 + 1e-4 * c15 / c16 + 37.48 * y2 / c12 + 0.1365",
11+
"constraints": [
12+
"1.5 * x2 - x3 >= 0",
13+
"y1 - 213.1 >= 0",
14+
"405.23 - y1 >= 0",
15+
"y2 - a2 >= 0",
16+
"y3 - a3 >= 0",
17+
"y4 - a4 >= 0",
18+
"y5 - a5 >= 0",
19+
"y6 - a6 >= 0",
20+
"y7 - a7 >= 0",
21+
"y8 - a8 >= 0",
22+
"y9 - a9 >= 0",
23+
"y10 - a10 >= 0",
24+
"y11 - a11 >= 0",
25+
"y12 - a12 >= 0",
26+
"y13 - a13 >= 0",
27+
"y14 - a14 >= 0",
28+
"y15 - a15 >= 0",
29+
"y16 - a16 >= 0",
30+
"y17 - a17 >= 0",
31+
"b2 - y2 >= 0",
32+
"b3 - y3 >= 0",
33+
"b4 - y4 >= 0",
34+
"b5 - y5 >= 0",
35+
"b6 - y6 >= 0",
36+
"b7 - y7 >= 0",
37+
"b8 - y8 >= 0",
38+
"b9 - y9 >= 0",
39+
"b10 - y10 >= 0",
40+
"b11 - y11 >= 0",
41+
"b12 - y12 >= 0",
42+
"b13 - y13 >= 0",
43+
"b14 - y14 >= 0",
44+
"b15 - y15 >= 0",
45+
"b16 - y16 >= 0",
46+
"b17 - y17 >= 0",
47+
"y4 - (0.28 / 0.72) * y5 >= 0",
48+
"21 - 3496 * y2 / c12 >= 0",
49+
"62212 / c17 - 110.6 - y1 >= 0",
50+
"x1 - lvar1 >= 0",
51+
"x2 - lvar2 >= 0",
52+
"x3 - lvar3 >= 0",
53+
"x4 - lvar4 >= 0",
54+
"x5 - lvar5 >= 0",
55+
"uvar1 - x1 >= 0",
56+
"uvar2 - x2 >= 0",
57+
"uvar3 - x3 >= 0",
58+
"uvar4 - x4 >= 0",
59+
"uvar5 - x5 >= 0"
60+
],
61+
"metadata": {
62+
"classification": "QGR-P1-(1,...,6)",
63+
"implementation": "AI/JSO, 03/2026"
64+
},
65+
"uncertainties": []
66+
}

docs/extract_hs89.json

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"problem": "hs89",
3+
"source": "Hock and Schittkowski, Problem 89",
4+
"variables": ["x1", "x2", "x3"],
5+
"bounds": {
6+
"lvar": "none",
7+
"uvar": "none",
8+
"x0": "none"
9+
},
10+
"objective": "sum_{j=1}^{30} A_j * rho_j(x)\nwhere rho_j(x) = - (exp(-mu_j^2 * r) + 2*exp(-mu_j^2*(x2^2 + x3^2)) + 2*exp(-mu_j^2*x3^2) + 1) / mu_j^2\nr = x1^2 + x2^2 + x3^2\nA_j = 2*sin(mu_j)/(mu_j + sin(mu_j)*cos(mu_j))\nmu_j: first 30 positive roots of tan(mu) = mu",
11+
"constraints": [
12+
"c(x) = termA + termB - 2/15 = 0",
13+
"termA = sum_{j=1}^{30} A_j^2 * rho_j(x)^2 * (sin(2*mu_j)/(2*mu_j) + 1)/2",
14+
"termB = sum_{i=1}^{29} sum_{j=i+1}^{30} A_i * A_j * rho_i(x) * rho_j(x) * (sin(mu_i+mu_j)/(mu_i+mu_j) + sin(mu_i-mu_j)/(mu_i-mu_j))"
15+
],
16+
"metadata": {
17+
"classification": "QGR-P1-(1,...,6)",
18+
"implementation": "AI/JSO, 03/2026"
19+
},
20+
"uncertainties": []
21+
}

0 commit comments

Comments
 (0)