|
| 1 | +# Dembo GP Problem Rebuild Workflow |
| 2 | + |
| 3 | +## Overview |
| 4 | +Rebuilt Dembo geometric programming problems 2-7 from original 1976 paper source to replace incorrect implementations. |
| 5 | + |
| 6 | +**Reference:** Dembo, R.S. (1976). *A set of geometric programming test problems and their solutions.* Mathematical Programming, 10(1), 192-213. |
| 7 | + |
| 8 | +## What Was Implemented |
| 9 | +- **GP2**: Colville's problem #3 (5 vars, 6 constraints) |
| 10 | +- **GP3**: Alkylation process (7 vars, 14 constraints) |
| 11 | +- **GP4A/4B**: Reactor design (8 vars, 4 constraints) |
| 12 | +- **GP5**: Heat exchanger (8 vars, 6 constraints) |
| 13 | +- **GP6**: 3-stage membrane (13 vars, 13 constraints) |
| 14 | +- **GP7**: 5-stage membrane (16 vars, 19 constraints) |
| 15 | + |
| 16 | +**Excluded** (due to OCR corruption in PDF): |
| 17 | +- GP1A, GP1B, GP8A: Unreadable exponents in source |
| 18 | + |
| 19 | +## Files Modified |
| 20 | +``` |
| 21 | +src/ADNLPProblems/dembo_gp{2,3,4a,4b,5,6,7}.jl (6 files) |
| 22 | +src/PureJuMP/dembo_gp{2,3,4a,4b,5,6,7}.jl (6 files) |
| 23 | +src/Meta/dembo_gp{2,3,4a,4b,5,6,7}.jl (6 files) |
| 24 | +``` |
| 25 | + |
| 26 | +## Implementation Steps |
| 27 | + |
| 28 | +### 1. Extract from PDF |
| 29 | +Extract coefficient tables from Dembo (1976) Tables 2.1–7.2: |
| 30 | +- Coefficients → arrays `c[1]`, `c[2]`, ... |
| 31 | +- Bounds (lower/upper) → from table footnotes |
| 32 | +- Starting points → from table rows |
| 33 | +- Constraint structure → from problem description |
| 34 | + |
| 35 | +**Tools:** pdftotext, manual verification |
| 36 | + |
| 37 | +### 2. ADNLP Implementation |
| 38 | +Template in `src/ADNLPProblems/dembo_gp<N>.jl`: |
| 39 | + |
| 40 | +```julia |
| 41 | +function dembo_gp<N>(; n=default_nvar, kwargs...) |
| 42 | + c = [...coefficients...] |
| 43 | + |
| 44 | + f(x) = objective_formula(c, x) |
| 45 | + |
| 46 | + function cons!(nlp, x) |
| 47 | + nlp.cons[1] = constraint_1(c, x) |
| 48 | + ... |
| 49 | + end |
| 50 | + |
| 51 | + return ADNLPModel!(f, x0, lvar, uvar, cons!, |
| 52 | + lcon=-Inf*ones(m), ucon=zeros(m), ...) |
| 53 | +end |
| 54 | + |
| 55 | +export dembo_gp<N> |
| 56 | +``` |
| 57 | + |
| 58 | +**Key:** Constraints as `g(x) ≤ 0` form. |
| 59 | + |
| 60 | +### 3. PureJuMP Implementation |
| 61 | +Template in `src/PureJuMP/dembo_gp<N>.jl`: |
| 62 | + |
| 63 | +```julia |
| 64 | +function dembo_gp<N>(; n=default_nvar, kwargs...) |
| 65 | + model = Model() |
| 66 | + @variable(model, lvar[i] <= x[i=1:n] <= uvar[i], start=x0[i]) |
| 67 | + @objective(model, Min, objective_expr(c, x)) |
| 68 | + @constraint(model, constraint_exprs(c, x)) |
| 69 | + return model |
| 70 | +end |
| 71 | + |
| 72 | +export dembo_gp<N> |
| 73 | +``` |
| 74 | + |
| 75 | +### 4. Metadata Registry |
| 76 | +Template in `src/Meta/dembo_gp<N>.jl`: |
| 77 | + |
| 78 | +```julia |
| 79 | +dembo_gp<N>_meta = Dict( |
| 80 | + :nvar => <n>, |
| 81 | + :ncon => <m>, |
| 82 | + :minimize => true, |
| 83 | + :name => "dembo_gp<N>", |
| 84 | + :objtype => :other, |
| 85 | + :contype => :general, |
| 86 | + :origin => :academic, |
| 87 | +) |
| 88 | + |
| 89 | +get_dembo_gp<N>_nvar(; kwargs...) = <n> |
| 90 | +get_dembo_gp<N>_ncon(; kwargs...) = <m> |
| 91 | +``` |
| 92 | + |
| 93 | +Auto-loaded by [src/OptimizationProblems.jl](src/OptimizationProblems.jl#L67). |
| 94 | + |
| 95 | +## Reproducible via API |
| 96 | + |
| 97 | +**Input format (JSON):** |
| 98 | +```json |
| 99 | +{ |
| 100 | + "name": "dembo_gp2", |
| 101 | + "nvar": 5, |
| 102 | + "ncon": 6, |
| 103 | + "coefficients": [c1, c2, ...], |
| 104 | + "bounds": {"lower": [...], "upper": [...]}, |
| 105 | + "start_point": [...], |
| 106 | + "objective_terms": [ |
| 107 | + {"coeff_idx": 1, "vars": [2]}, |
| 108 | + {"coeff_idx": 2, "vars": [1, 5]} |
| 109 | + ], |
| 110 | + "constraints": [ |
| 111 | + {"type": "rational", "numerator_coeff": 11, |
| 112 | + "denominator_vars": [2, 5], "rhs": 1.0} |
| 113 | + ] |
| 114 | +} |
| 115 | +``` |
| 116 | + |
| 117 | +**Process:** |
| 118 | +1. Parse spec JSON |
| 119 | +2. Generate ADNLP boilerplate with `Template(ADNLPProblems/dembo_template.jl)` |
| 120 | +3. Generate PureJuMP boilerplate with `Template(PureJuMP/dembo_template.jl)` |
| 121 | +4. Generate metadata with `Template(Meta/dembo_template.jl)` |
| 122 | +5. Validate syntax with `get_errors(filenames)` |
| 123 | + |
| 124 | +## Testing Notes |
| 125 | + |
| 126 | +**Current limitation:** `Pkg.test()` distributed worker precompile cache may show false negatives (arrays display identically but comparison fails). Workaround: |
| 127 | +```bash |
| 128 | +rm -rf ~/.julia/compiled/v1.12/OptimizationProblems |
| 129 | +julia --project=. -e 'using Pkg; Pkg.precompile()' |
| 130 | +``` |
| 131 | + |
| 132 | +**Simple validation (no distributed workers):** |
| 133 | +```bash |
| 134 | +julia --project=. verify_dembo.jl |
| 135 | +``` |
| 136 | + |
| 137 | +## Adding New Problems |
| 138 | + |
| 139 | +1. Create problem spec (coefficients, bounds, constraints) |
| 140 | +2. Run code generator for each backend → 3 files |
| 141 | +3. Validate syntax |
| 142 | +4. Add to benchmark suite if needed |
| 143 | + |
| 144 | +## Verification Checklist |
| 145 | + |
| 146 | +- [ ] All coefficients match paper tables |
| 147 | +- [ ] Bounds are tight by design (not arbitrary) |
| 148 | +- [ ] Constraint form is `g(x) ≤ 0` |
| 149 | +- [ ] `export <function>` present in each backend file |
| 150 | +- [ ] Metadata `<name>_meta` Dict and getter functions present |
| 151 | +- [ ] No syntax errors: `get_errors()` |
| 152 | +- [ ] Problem instantiates: `nlp = dembo_gp<N>()` |
0 commit comments