Skip to content

Commit 84b230c

Browse files
committed
refactor(api)!: standardize dimensional keyword arguments
Use nvar and nobj across benchmark constructors, dimension metadata and catalog filters. Preserve DTLZ k and coupled dimensions, and expose SLCDT1 lambda with an ASCII keyword. Update tests, examples and concise scientific docstrings. BREAKING CHANGE: positional dimension arguments and legacy n, m and λ keywords are no longer supported. Rename min_vars/max_vars and min_objs/max_objs filters to min_nvar/max_nvar and min_nobj/max_nobj; metadata fields default_n/default_m become default_nvar/default_nobj.
1 parent a08facc commit 84b230c

29 files changed

Lines changed: 340 additions & 318 deletions

‎docs/src/guides/catalog.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ julia> small_defaults = filter_problems(
6161
name_pattern = r"^ZDT",
6262
has_bounds = true,
6363
has_jacobian = true,
64-
max_vars = 10,
64+
max_nvar = 10,
6565
)
6666
2-element Vector{String}:
6767
"ZDT4"
@@ -78,7 +78,7 @@ The [`ZDT1`](@ref) constructor accepts `n >= 2`, so it can still be used in the
7878
ten-variable experiment:
7979

8080
```jldoctest catalog_workflow
81-
julia> prob = ZDT1(10);
81+
julia> prob = ZDT1(nvar = 10);
8282
8383
julia> prob.nvar
8484
10

‎docs/src/guides/evaluation.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ Construct the benchmark and evaluate all of its objectives with `eval_f`:
1111
```jldoctest evaluation_workflow
1212
julia> using MOProblems
1313
14-
julia> prob = ZDT1(10);
14+
julia> prob = ZDT1(nvar = 10);
1515
1616
julia> x = fill(0.5, prob.nvar);
1717

‎docs/src/problems/dtlz.md‎

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,21 +7,23 @@ Theoretical Advances and Applications* [DTLZ2005](@cite).
77

88
## Overview
99

10-
For all five constructors, `k >= 1`, `m >= 2`, `nvar = k + m - 1`, and
11-
`nobj = m`. Here, `k` is the number of trailing variables `x_m, ..., x_n` used
12-
by `g(x)`; equivalently, `k = nvar - m + 1`. The first `m - 1` variables
10+
For all five constructors, `k >= 1`, `nobj >= 2`, and `nvar = k + nobj - 1`.
11+
The public keyword is `nobj` by package convention; the mathematical
12+
formulation below retains the usual `m`, with `m = nobj`. Here, `k` is the
13+
number of trailing variables `x_m, ..., x_n` used by `g(x)`; equivalently,
14+
`k = nvar - m + 1`. The first `m - 1` variables
1315
determine the objective trade-off, whereas these `k` variables determine
1416
`g(x)`. Thus, `k` changes the number of decision variables without changing
1517
the number of objectives. DTLZ4 additionally requires `alpha > 0`. The default
1618
dimensions and componentwise bounds are shown below.
1719

18-
| Problem | `k` | `m` | `alpha` | `nvar` | `nobj` | Lower bound | Upper bound |
19-
|:---|---:|---:|---:|---:|---:|---:|---:|
20-
| `DTLZ1` | 5 | 3 | — | 7 | 3 | 0.0 | 1.0 |
21-
| `DTLZ2` | 10 | 3 | — | 12 | 3 | 0.0 | 1.0 |
22-
| `DTLZ3` | 10 | 3 | — | 12 | 3 | 0.0 | 1.0 |
23-
| `DTLZ4` | 10 | 3 | 100.0 | 12 | 3 | 0.0 | 1.0 |
24-
| `DTLZ5` | 10 | 5 | — | 14 | 5 | 0.0 | 1.0 |
20+
| Problem | `k` | `nobj` | `alpha` | `nvar` | Lower bound | Upper bound |
21+
|:---|---:|---:|---:|---:|---:|---:|
22+
| `DTLZ1` | 5 | 3 | — | 7 | 0.0 | 1.0 |
23+
| `DTLZ2` | 10 | 3 | — | 12 | 0.0 | 1.0 |
24+
| `DTLZ3` | 10 | 3 | — | 12 | 0.0 | 1.0 |
25+
| `DTLZ4` | 10 | 3 | 100.0 | 12 | 0.0 | 1.0 |
26+
| `DTLZ5` | 10 | 5 | — | 14 | 0.0 | 1.0 |
2527

2628
Analytical Jacobians are registered for all five constructors. **Hessians are
2729
not registered**. The catalog metadata classifies every objective in `DTLZ1` through `DTLZ5`
@@ -175,7 +177,7 @@ g(x) = \sum_{r=m}^{n}(x_r-0.5)^2.
175177
```jldoctest dtlz_usage
176178
julia> using MOProblems
177179
178-
julia> prob = DTLZ2(k = 10, m = 4);
180+
julia> prob = DTLZ2(k = 10, nobj = 4);
179181
180182
julia> x = fill(0.5, prob.nvar);
181183

‎docs/src/problems/fds.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ was introduced in "Newton's Method for Multiobjective Optimization"
66

77
## Overview
88

9-
`FDS(n)` requires `n >= 1` and has `nvar = n` and `nobj = 3`; the default is
9+
`FDS(; nvar)` requires `nvar >= 1` and has `nobj = 3`; the default is
1010
`n = 5`. Its componentwise bounds are shown below.
1111

1212
| Problem | `n` | `nvar` | `nobj` | Lower bound | Upper bound |

‎docs/src/problems/jos.md‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ How?" by Jin, Olhofer, and Sendhoff [JOS2001](@cite).
2020

2121
## Overview
2222

23-
Both constructors have `n` variables and two objectives. `JOS1` requires
24-
`n >= 1`, whereas `JOS4` requires `n >= 2`. The default dimension of 50 matches
23+
Both constructors have two objectives. `JOS1` requires
24+
`nvar >= 1`, whereas `JOS4` requires `nvar >= 2`. The default dimension of 50 matches
2525
the dimension used for the `JOS1a` and `JOS4a` experiment instances reported
2626
by Fliege, Drummond, and Svaiter [FDS2009](@cite). Both constructors retain the
2727
componentwise domain ``[0,1]^n`` specified for the source test functions
@@ -96,7 +96,7 @@ g(x)=1+\frac{9}{n-1}\sum_{i=2}^{n}x_i.
9696
```jldoctest jos_usage
9797
julia> using MOProblems
9898
99-
julia> prob = JOS4(50);
99+
julia> prob = JOS4(nvar = 50);
100100
101101
julia> x = fill(0.5, prob.nvar);
102102

‎docs/src/problems/mgh.md‎

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -22,32 +22,33 @@ are fixed, coupled, or independently configurable.
2222

2323
`MGH9` has fixed dimensions: the package exposes no dimension parameter and
2424
constructs a problem with `nvar = 3` and `nobj = 15`. These dimensions agree
25-
with `n = 3` and `m = 15` in both [MGH1981](@cite) and [Mita2019](@cite).
25+
with both [MGH1981](@cite) and [Mita2019](@cite).
2626

27-
`MGH16` fixes `nvar = 4` and accepts `m >= 4`, with `nobj = m`; its default is
28-
`m = 5`. The original problem fixes `n = 4` and allows `m >= n`
29-
[MGH1981](@cite), while [Mita2019](@cite) uses `n = 4` and `m = 5`.
27+
`MGH16` fixes `nvar = 4` and accepts `nobj >= 4`; its default is
28+
`nobj = 5`. The original problem fixes four variables and allows at least four
29+
objectives [MGH1981](@cite), while [Mita2019](@cite) uses the same package
30+
defaults.
3031

31-
`MGH26` accepts `n >= 1` and couples the dimensions as
32-
`nvar = nobj = n`; its default is `n = 4`. The original problem allows `n` to
33-
vary and defines `m = n` [MGH1981](@cite), while [Mita2019](@cite) uses
34-
`n = m = 4`.
32+
`MGH26` accepts `nvar >= 1` and couples the dimensions as
33+
`nobj = nvar`; its default is `nvar = 4`. The original problem
34+
[MGH1981](@cite) permits a
35+
variable number of variables and couples the number of objectives to it, while [Mita2019](@cite) uses `nvar = nobj = 4`.
3536

36-
`MGH33` accepts `n >= 2` and `m >= 2` independently, with `nvar = n` and
37-
`nobj = m`; its defaults are `n = m = 10`. The original problem allows `n` to
38-
vary but requires `m >= n` [MGH1981](@cite), while [Mita2019](@cite) uses
39-
`n = 10` and `m = 4`. Thus, the package supports the dimensions independently
40-
and includes `(n, m) = (10, 4)` as a nondefault configuration.
37+
`MGH33` accepts `nvar >= 2` and `nobj >= 2` independently; its defaults are
38+
`nvar = nobj = 10`. The original problem [MGH1981](@cite) permits a variable number of
39+
variables but requires at least as many objectives, while
40+
[Mita2019](@cite) uses `nvar = 10` and `nobj = 4`. Thus, the package supports
41+
the dimensions independently.
4142

4243
The following table summarizes the dimension behavior implemented by the
4344
constructors.
4445

4546
| Problem | Dimension behavior | Configurable parameters | Default `nvar` | Default `nobj` |
4647
|:---|:---|:---|---:|---:|
4748
| `MGH9` | Fixed | — | 3 | 15 |
48-
| `MGH16` | Fixed `nvar`, variable `nobj` | `m >= 4` | 4 | 5 |
49-
| `MGH26` | Coupled | `n >= 1`, with `nvar = nobj = n` | 4 | 4 |
50-
| `MGH33` | Independent | `n >= 2`, `m >= 2` | 10 | 10 |
49+
| `MGH16` | Fixed `nvar`, variable `nobj` | `nobj >= 4` | 4 | 5 |
50+
| `MGH26` | Coupled | `nvar >= 1`, with `nobj = nvar` | 4 | 4 |
51+
| `MGH33` | Independent | `nvar >= 2`, `nobj >= 2` | 10 | 10 |
5152

5253
Analytical Jacobians are registered for all four constructors. Hessians are
5354
not registered. The catalog metadata classifies every objective in each
@@ -125,7 +126,7 @@ The following example uses the linear rank-1 dimensions reported in
125126
```jldoctest mgh_usage
126127
julia> using MOProblems
127128
128-
julia> prob = MGH33(n = 10, m = 4);
129+
julia> prob = MGH33(nvar = 10, nobj = 4);
129130
130131
julia> x = zeros(prob.nvar);
131132

‎docs/src/problems/qv.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ parameter domain under the `QV1` name [Huband2006](@cite).
88

99
## Overview
1010

11-
`QV1(n)` requires `n >= 1` and has `nvar = n` and `nobj = 2`. The default
11+
`QV1(; nvar)` requires `nvar >= 1` and has `nobj = 2`. The default
1212
`n = 16` is the dimension used by Quagliarella and Vicini. The constructor
1313
retains the componentwise domain specified in both sources.
1414

‎docs/src/problems/slcdt.md‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@ Schütze, Laumanns, Coello Coello, Dellnitz, and Talbi [SLCDT2008](@cite).
66
## Overview
77

88
Both constructors have fixed dimensions and registered componentwise variable
9-
bounds. `SLCDT1` takes a perturbation coefficient `λ`, which selects the
10-
bounds; `SLCDT2` takes no parameters.
9+
bounds. `SLCDT1` takes perturbation coefficient `λ`, which selects the bounds; `SLCDT2` takes no parameters.
1110

1211
| Problem | `λ` | `nvar` | `nobj` | Lower bound | Upper bound |
1312
|:---|:---|---:|---:|---:|---:|
@@ -75,7 +74,7 @@ julia> values1 = eval_f(prob1, x1);
7574
7675
julia> J1 = eval_jacobian(prob1, x1);
7776
78-
julia> prob1b = SLCDT1(λ = 0.0);
77+
julia> prob1b = SLCDT1(lambda = 0.0);
7978
8079
julia> prob2 = SLCDT2();
8180

‎docs/src/problems/toi.md‎

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -27,17 +27,17 @@ numbering.
2727
and therefore two objectives, matching the instance of [Mita2019](@cite).
2828

2929
`Toi8`, `Toi9`, and `Toi10` are stated for a variable dimension in
30-
[Toi1983](@cite), and the constructors accept `n >= 2` and couple the
31-
dimensions accordingly: `nvar = nobj = n` for `Toi8` and `Toi9`, and
32-
`nvar = n`, `nobj = n - 1` for `Toi10`. Their defaults reproduce the instances
33-
of [Mita2019](@cite), namely `n = 3` for `Toi8` and `n = 4` for the other two.
34-
35-
| Problem | Dimension behavior | Configurable parameters | Default `nvar` | Default `nobj` | Bounds |
36-
|:---|:---|:---|---:|---:|:---|
37-
| `Toi4` | Fixed | — | 4 | 2 | ``[-2,5]^4`` |
38-
| `Toi8` | Coupled | `n >= 2`, with `nvar = nobj = n` | 3 | 3 | ``[-1,1]^n`` |
39-
| `Toi9` | Coupled | `n >= 2`, with `nvar = nobj = n` | 4 | 4 | ``[-1,1]^n`` |
40-
| `Toi10` | Coupled | `n >= 2`, with `nvar = n` and `nobj = n - 1` | 4 | 3 | ``[-2,2]^n`` |
30+
[Toi1983](@cite), and the constructors accept `nvar >= 2` and couple the
31+
dimensions accordingly: `nobj = nvar` for `Toi8` and `Toi9`, and
32+
`nobj = nvar - 1` for `Toi10`. Their defaults reproduce the instances
33+
of [Mita2019](@cite), namely `nvar = 3` for `Toi8` and `nvar = 4` for the other two.
34+
35+
| Problem | Dimension behavior | Configurable parameters | Default `nvar` | Default `nobj` | Lower bound | Upper bound |
36+
|:---|:---|:---|---:|---:|---:|---:|
37+
| `Toi4` | Fixed | — | 4 | 2 | -2 | 5 |
38+
| `Toi8` | Coupled | `nvar >= 2`, with `nobj = nvar` | 3 | 3 | -1 | 1 |
39+
| `Toi9` | Coupled | `nvar >= 2`, with `nobj = nvar` | 4 | 4 | -1 | 1 |
40+
| `Toi10` | Coupled | `nvar >= 2`, with `nobj = nvar - 1` | 4 | 3 | -2 | 2 |
4141

4242
Analytical Jacobians are registered for all four constructors. Hessians are not
4343
registered. The catalog metadata classifies every objective in each default
@@ -99,7 +99,7 @@ f_i(x)=100\left(x_{i+1}-x_i^2\right)^2+\left(x_{i+1}-1\right)^2,
9999
```jldoctest toi_usage
100100
julia> using MOProblems
101101
102-
julia> prob = Toi9(n = 4);
102+
julia> prob = Toi9(nvar = 4);
103103
104104
julia> x = fill(0.5, prob.nvar);
105105

‎docs/src/problems/zdt.md‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ the package provides no constructor for it.
1616

1717
## Overview
1818

19-
Every constructor takes the number of variables `n` as its only parameter and
20-
requires `n >= 2`, giving `nvar = n` and `nobj = 2`. The default dimensions and
19+
Every constructor takes the number of variables `nvar` as its only parameter and requires
20+
`nvar >= 2`, giving `nobj = 2`. The default dimensions and
2121
componentwise bounds are shown below.
2222

2323
| Problem | Source function | Default `nvar` | `nobj` | Lower bounds | Upper bounds |
@@ -175,7 +175,7 @@ g(x) = 1 + 9\left(\frac{1}{n-1}\sum_{i=2}^{n}x_i\right)^{0.25}.
175175
```jldoctest zdt_usage
176176
julia> using MOProblems
177177
178-
julia> prob = ZDT1(30);
178+
julia> prob = ZDT1(nvar = 30);
179179
180180
julia> x = fill(0.5, prob.nvar);
181181

0 commit comments

Comments
 (0)