From fa5b6e1be7cfe5e8fff9e491522c1a7d32df5540 Mon Sep 17 00:00:00 2001 From: Elena <71965364+elenaraponi@users.noreply.github.com> Date: Mon, 20 Apr 2026 16:28:47 +0200 Subject: [PATCH 01/11] First problems --- .DS_Store | Bin 0 -> 6148 bytes code_snippets/call_bbob.py | 24 ++++++++++++++++++++++++ code_snippets/call_bbob_largescale.py | 24 ++++++++++++++++++++++++ code_snippets/call_bbob_mixint.py | 24 ++++++++++++++++++++++++ code_snippets/call_bbob_noisy.py | 24 ++++++++++++++++++++++++ code_snippets/call_mf2.py | 18 ++++++++++++++++++ code_snippets/call_sbox.py | 17 +++++++++++++++++ code_snippets/notes.txt | 8 ++++++++ 8 files changed, 139 insertions(+) create mode 100644 .DS_Store create mode 100644 code_snippets/call_bbob.py create mode 100644 code_snippets/call_bbob_largescale.py create mode 100644 code_snippets/call_bbob_mixint.py create mode 100644 code_snippets/call_bbob_noisy.py create mode 100644 code_snippets/call_mf2.py create mode 100644 code_snippets/call_sbox.py create mode 100644 code_snippets/notes.txt diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..6ccdef3ff50725da9d2d9301fcb424f68ee4959f GIT binary patch literal 6148 zcmeH~QA@)x5XUcbYKsi^pdda4d>uH)RK%B3=NGV|4=QuDMT@l=Yv&%updUcLkRQa) z<6V-8W9o|_IPS*fmnL@!`FA7@00@5=?E=&Rz(FTgTr9pY>L;JGifthZJw_LD$RL3} z{@DJ50`%@`a0?0|h~e}5i=lu#9OeBmRUt;bhW#|ji)QmpRF0tohg-u(|RvFPvTLxzJ9E-qL*axKqn+oj3HMSNfxP*uZCHa>)gO}IIiP% z>s#Y-YwzHoA$Oa5?MXw94_nQKZ11-x6W7_;-Z?t$KBSMCdNx7}{10lYSx)hSl^@pl z6b!OdWp@}g9buZuWCd6OR$ws|u)CeJwwTM~Rj~rBz%LY_{XwD=JG1q=V2i<2ZI^VQ(lx&yMX Date: Mon, 20 Apr 2026 16:38:53 +0200 Subject: [PATCH 02/11] Create README.md --- code_snippets/README.md | 53 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 code_snippets/README.md diff --git a/code_snippets/README.md b/code_snippets/README.md new file mode 100644 index 0000000..5e11d49 --- /dev/null +++ b/code_snippets/README.md @@ -0,0 +1,53 @@ +# OPL Code Snippets + +A collection of code snippets for evaluating optimization benchmark functions from the OPL library using [uv](https://docs.astral.sh/uv/) as the script runner. + +## Prerequisites + +Install **uv** (if not already installed): + +```bash +pip install uv +``` + +## Usage + +Each snippet is a self-contained script with inline dependency metadata ([PEP 723](https://peps.python.org/pep-0723/)). No virtual environment setup is needed — `uv` resolves dependencies automatically. + +Run any snippet with: + +```bash +uv run call_.py +``` + +## Available Snippets + +| Script | Benchmark | Description | +|--------|-----------|-------------| +| `call_cocoex.py` | [COCO/BBOB](https://github.com/numbbo/coco) | Evaluates function 1 from the BBOB suite (2D) | +| `call_mf2.py` | [mf2](https://github.com/sjvrijn/mf2) | Evaluates the Branin function at high and low fidelity | +| All other problems from the OPL Library | + +## Example + +```bash +# Run the COCO/BBOB snippet +uv run call_cocoex.py + +# Run the multi-fidelity mf2 snippet +uv run call_mf2.py +``` + +## Adding New Snippets + +1. Create a new file named `call_.py`. +2. Add the inline dependency block at the top of the file: + ```python + # /// script + # dependencies = [ + # "your-package", + # ] + # /// + ``` +3. Write your evaluation code below it. +4. Run with `uv run call_.py`. \ No newline at end of file From 84a038d19e27004c77965a24d79a06ec507b8e62 Mon Sep 17 00:00:00 2001 From: Elena <71965364+elenaraponi@users.noreply.github.com> Date: Mon, 20 Apr 2026 18:06:53 +0200 Subject: [PATCH 03/11] Updates + new CEC suites --- code_snippets/call_cec2013.py | 19 +++++++++++++++++++ code_snippets/call_cec2022.py | 19 +++++++++++++++++++ code_snippets/call_sbox.py | 1 + code_snippets/notes.txt | 8 +++++--- 4 files changed, 44 insertions(+), 3 deletions(-) create mode 100644 code_snippets/call_cec2013.py create mode 100644 code_snippets/call_cec2022.py diff --git a/code_snippets/call_cec2013.py b/code_snippets/call_cec2013.py new file mode 100644 index 0000000..ce2cfe1 --- /dev/null +++ b/code_snippets/call_cec2013.py @@ -0,0 +1,19 @@ +# /// script +# requires-python = "==3.10" +# dependencies = [ +# "ioh", +# ] +# /// + +import ioh + +### evaluation point +dim = 1 +eval_point = [0.0] * dim + +# Create a CEC2013 problem (e.g. EqualMaxima) +# {1101: 'FivePeaks1101', 1102: 'EqualMaxima1102', 1103: 'UnevenEqualMaxima1103', 1104: 'Himmelblau1104', 1105: 'SixHumpCamelback1105', 1106: 'Shubert1106', 1107: 'Vincent1107', 1108: 'Shubert1108', 1109: 'Vincent1109', 1110: 'ModifiedRastrigin1110', 1111: 'CompositionFunction1111', 1112: 'CompositionFunction1112', 1113: 'CompositionFunction1113', 1114: 'CompositionFunction1114', 1115: 'CompositionFunction1115', 1116: 'CompositionFunction1116', 1117: 'CompositionFunction1117', 1118: 'CompositionFunction1118', 1119: 'CompositionFunction1119', 1120: 'CompositionFunction1120'} +f = ioh.iohcpp.problem.CEC2013.create("EqualMaxima1102", 1, dim) + +print(f"Problem: {f.meta_data}") +print(f"Result: {f(eval_point)}") diff --git a/code_snippets/call_cec2022.py b/code_snippets/call_cec2022.py new file mode 100644 index 0000000..5ff94df --- /dev/null +++ b/code_snippets/call_cec2022.py @@ -0,0 +1,19 @@ +# /// script +# requires-python = "==3.10" +# dependencies = [ +# "ioh", +# ] +# /// + +from ioh import get_problem, ProblemClass + +### evaluation point +dim = 10 +eval_point = [0.0]*dim + +### input +# CEC2022 functions are numbered 1–12, dimensions must be 10 or 20 +f = get_problem("CEC2022Zakharov", instance=1, dimension=10, problem_class=ProblemClass.REAL) + +### print function value for eval_point +print(f(eval_point)) \ No newline at end of file diff --git a/code_snippets/call_sbox.py b/code_snippets/call_sbox.py index b9ec509..48b0c2b 100644 --- a/code_snippets/call_sbox.py +++ b/code_snippets/call_sbox.py @@ -1,4 +1,5 @@ # /// script +# requires-python = "==3.10" # dependencies = [ # "ioh", # ] diff --git a/code_snippets/notes.txt b/code_snippets/notes.txt index 37180cc..cfb1ceb 100644 --- a/code_snippets/notes.txt +++ b/code_snippets/notes.txt @@ -2,7 +2,9 @@ Thoughts: Task: write the minimum code snippets to call a function from the package/suite. -1) There are problem generators rather than functions. It cannot be called and directly evaluated by the optimizer +Currently working on: single-objective + unconstrained + +Encountered issues: 2) VehicleDynamics is not a problem, only dataset -3) AMVOP: no Github availabl according to database (haven't double-checked) -4) \ No newline at end of file +3) AMVOP: no Github available according to database (haven't double-checked) +4) AutomotiveCrashworthiness: Not integrated. The linked code is not generated aliases of the crashworthiness problems. It's a pipeline that extracts ELA features from generated problems. Problem generator is in a .py file. \ No newline at end of file From bd02bf2b0b14c3e624e473cdb56bf9c43976f8d0 Mon Sep 17 00:00:00 2001 From: Elena <71965364+elenaraponi@users.noreply.github.com> Date: Mon, 20 Apr 2026 18:28:00 +0200 Subject: [PATCH 04/11] Create call_dynamicbinval.py --- code_snippets/call_dynamicbinval.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 code_snippets/call_dynamicbinval.py diff --git a/code_snippets/call_dynamicbinval.py b/code_snippets/call_dynamicbinval.py new file mode 100644 index 0000000..2d18869 --- /dev/null +++ b/code_snippets/call_dynamicbinval.py @@ -0,0 +1,18 @@ +# /// script +# requires-python = "==3.10" +# dependencies = [ +# "ioh", +# ] +# /// + +from ioh import get_problem, ProblemClass + +### evaluation point +dim = 32 +eval_point = [0]*dim + +### input +f = get_problem("DynamicBinValUniform", 1, 32, ProblemClass.INTEGER) + +### print function value for eval_point +print(f(eval_point)) \ No newline at end of file From 18f40dd15936a025d1350c99418124e5615967ab Mon Sep 17 00:00:00 2001 From: Elena <71965364+elenaraponi@users.noreply.github.com> Date: Tue, 21 Apr 2026 10:00:14 +0200 Subject: [PATCH 05/11] More notes --- code_snippets/notes.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/code_snippets/notes.txt b/code_snippets/notes.txt index cfb1ceb..80525e4 100644 --- a/code_snippets/notes.txt +++ b/code_snippets/notes.txt @@ -7,4 +7,5 @@ Currently working on: single-objective + unconstrained Encountered issues: 2) VehicleDynamics is not a problem, only dataset 3) AMVOP: no Github available according to database (haven't double-checked) -4) AutomotiveCrashworthiness: Not integrated. The linked code is not generated aliases of the crashworthiness problems. It's a pipeline that extracts ELA features from generated problems. Problem generator is in a .py file. \ No newline at end of file +4) AutomotiveCrashworthiness: Not integrated. The linked code is not generated aliases of the crashworthiness problems. It's a pipeline that extracts ELA features from generated problems. Problem generator is in a .py file. +5) gbea: Not integrated. Needs repository cloning. \ No newline at end of file From cde888978ece36caaf5344c197f8c0cc2aaf860a Mon Sep 17 00:00:00 2001 From: Elena <71965364+elenaraponi@users.noreply.github.com> Date: Tue, 21 Apr 2026 12:14:42 +0200 Subject: [PATCH 06/11] Update README.md --- code_snippets/README.md | 58 ++++++++++++++++++++--------------------- 1 file changed, 28 insertions(+), 30 deletions(-) diff --git a/code_snippets/README.md b/code_snippets/README.md index 5e11d49..94ef931 100644 --- a/code_snippets/README.md +++ b/code_snippets/README.md @@ -1,53 +1,51 @@ # OPL Code Snippets -A collection of code snippets for evaluating optimization benchmark functions from the OPL library using [uv](https://docs.astral.sh/uv/) as the script runner. +A collection of minimal, self-contained code snippets for evaluating optimization benchmark functions from the OPL library. Each snippet uses [uv](https://docs.astral.sh/uv/) as the script runner and requires no manual virtual-environment setup. -## Prerequisites +## Repository Structure -Install **uv** (if not already installed): +Every benchmark problem has its own repository containing: -```bash -pip install uv -``` +- **`call_.py`** — the evaluation script, with inline dependency metadata ([PEP 723](https://peps.python.org/pep-0723/)) so `uv` resolves everything automatically. +- **`README.md`** — problem-specific instructions covering any prerequisites (cloning external repos, running setup scripts, downloading executables, etc.) and the usage example. -## Usage +**Always start by reading the README inside the problem's repository.** Some benchmarks need extra setup steps before the snippet will run. -Each snippet is a self-contained script with inline dependency metadata ([PEP 723](https://peps.python.org/pep-0723/)). No virtual environment setup is needed — `uv` resolves dependencies automatically. +## Quick Start -Run any snippet with: +1. Install **uv** if you don't have it yet: ```bash -uv run call_.py + pip install uv ``` -## Available Snippets +2. Navigate to the problem's repository and follow its specific README. -| Script | Benchmark | Description | -|--------|-----------|-------------| -| `call_cocoex.py` | [COCO/BBOB](https://github.com/numbbo/coco) | Evaluates function 1 from the BBOB suite (2D) | -| `call_mf2.py` | [mf2](https://github.com/sjvrijn/mf2) | Evaluates the Branin function at high and low fidelity | -| All other problems from the OPL Library | - -## Example +3. Run the snippet: ```bash -# Run the COCO/BBOB snippet -uv run call_cocoex.py - -# Run the multi-fidelity mf2 snippet -uv run call_mf2.py + uv run call_.py ``` -## Adding New Snippets +## Available Benchmarks -1. Create a new file named `call_.py`. -2. Add the inline dependency block at the top of the file: - ```python +| Repository | Benchmark | Description | +|------------|-----------|-------------| +| `cocoex/` | [COCO/BBOB](https://github.com/numbbo/coco) | Evaluates function 1 from the BBOB suite (2-D) | +| `mf2/` | [mf2](https://github.com/sjvrijn/mf2) | Evaluates the Branin function at high and low fidelity | +| … | … | See the full list in the [OPL Library](#) | + +## Contributing a New Snippet + +1. Create a new repository (or folder) named after the problem. +2. Add a `call_.py` file with the inline dependency block at the top: +```python # /// script # dependencies = [ # "your-package", # ] # /// - ``` -3. Write your evaluation code below it. -4. Run with `uv run call_.py`. \ No newline at end of file +``` +3. Write your evaluation code below the dependency block. +4. Add a `README.md` that documents any setup steps a user must complete before running the script (cloning repos, installing non-Python dependencies, downloading data, etc.). +5. Update the table above to include your new benchmark. \ No newline at end of file From 33163c88ee635f9abe29d172025c4775cd23f473 Mon Sep 17 00:00:00 2001 From: Elena <71965364+elenaraponi@users.noreply.github.com> Date: Tue, 21 Apr 2026 12:30:29 +0200 Subject: [PATCH 07/11] Reorganization of code examples into folders --- .DS_Store | Bin 6148 -> 8196 bytes code_snippets/.DS_Store | Bin 0 -> 8196 bytes code_snippets/bbob/README.md | 27 ++++++++ code_snippets/{ => bbob}/call_bbob.py | 0 code_snippets/bbob_largescale/README.md | 27 ++++++++ .../call_bbob_largescale.py | 0 code_snippets/bbob_mixint/README.md | 27 ++++++++ .../{ => bbob_mixint}/call_bbob_mixint.py | 0 code_snippets/bbob_noisy/README.md | 27 ++++++++ .../{ => bbob_noisy}/call_bbob_noisy.py | 0 code_snippets/cec2013/README.md | 44 +++++++++++++ code_snippets/{ => cec2013}/call_cec2013.py | 0 code_snippets/cec2022/README.md | 48 ++++++++++++++ code_snippets/{ => cec2022}/call_cec2022.py | 0 code_snippets/dynamicbinval/README.md | 29 +++++++++ .../{ => dynamicbinval}/call_dynamicbinval.py | 0 code_snippets/mf2/README.md | 37 +++++++++++ code_snippets/{ => mf2}/call_mf2.py | 0 code_snippets/sbox/README.md | 59 ++++++++++++++++++ code_snippets/{ => sbox}/call_sbox.py | 0 20 files changed, 325 insertions(+) create mode 100644 code_snippets/.DS_Store create mode 100644 code_snippets/bbob/README.md rename code_snippets/{ => bbob}/call_bbob.py (100%) create mode 100644 code_snippets/bbob_largescale/README.md rename code_snippets/{ => bbob_largescale}/call_bbob_largescale.py (100%) create mode 100644 code_snippets/bbob_mixint/README.md rename code_snippets/{ => bbob_mixint}/call_bbob_mixint.py (100%) create mode 100644 code_snippets/bbob_noisy/README.md rename code_snippets/{ => bbob_noisy}/call_bbob_noisy.py (100%) create mode 100644 code_snippets/cec2013/README.md rename code_snippets/{ => cec2013}/call_cec2013.py (100%) create mode 100644 code_snippets/cec2022/README.md rename code_snippets/{ => cec2022}/call_cec2022.py (100%) create mode 100644 code_snippets/dynamicbinval/README.md rename code_snippets/{ => dynamicbinval}/call_dynamicbinval.py (100%) create mode 100644 code_snippets/mf2/README.md rename code_snippets/{ => mf2}/call_mf2.py (100%) create mode 100644 code_snippets/sbox/README.md rename code_snippets/{ => sbox}/call_sbox.py (100%) diff --git a/.DS_Store b/.DS_Store index 6ccdef3ff50725da9d2d9301fcb424f68ee4959f..8e89c83e2e36b8fdd1eb98c102fd40c9b4d94df3 100644 GIT binary patch literal 8196 zcmeHMU2GIp6h3EKV6ITPMWCGpWJBf0x`b_^<)gcMBaAuq;)PoVOyS`OkPHvvr{U%k%d2Q5*_@`XLFxh*sck2Ty@ijqSME_h*2Stmep&UAvAM?3@W^PE^O7g}gq`!PvPkEA;br-JkKEl= zaGiZcQ6@Ks3a(umcSzD$$k~MwDT{5kow1GyZ`c<{eR(zNxkbMxP#m_%R?cPl0%^Z@ z!na(<8x%#4C}Z!=TeNJ&s(X?hTehZm?Rn@@!|n5V;{wJ;DN2rS9kfJopkkT+*htPR z2*vG z;rFnxD8EH{k(QqoftG@7~|Os`&Juzrsm;ki&Tv6iv^!}NN&M~@&Myse!X z19mPiY;H1T*13@xLuKVHe;}Ofx|bQl1$TU$T=W_-5l*MJ8O9@WvT(5gAKzt$@)P5iBMDBLHsBR9*T*!CSecl|3l z^wm6-HFqprbZ5(&we6iy#z@ZvgM>@D`kgv+yy2_cDA9-@;V_EZ}V9xR^jIA-fD$ z;cC1aTQPwh*om8PGr>2Fy|@E+;%>|kdm%2AI^a~0RR91 delta 132 zcmZp1XfcprU|?W$DortDU=RQ@Ie-{MGjUEV6q~50$jG!YU^nAr0~wadp9Q2RYY9wd zHZe1qd_cf&^II_~#?1y2512P|aQtT%WCrR20s(Fy;R-TfW8rt^$^0^oAR8DM85meV PG!w)Mu-N8!o;l0_-Z&T? diff --git a/code_snippets/.DS_Store b/code_snippets/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..66a1206d2bd071733c1bb7ee8cab58282b980b90 GIT binary patch literal 8196 zcmeHMJ&P1U5UutWTs#ghP}pz+e}KCen2yI97|JDPdi&vdFuQa3#h%gp27iIzKM;%z z1Pu(#%mj@L#6ZDFMMPh9motr1vvY~8aMefm8@gUyy?rw~L(LMA+rB&L6ZMFwi^;gT zjzt+9=UE#kWak{vA)m6n{?0g`9n_e%VGfuB=72e14wwV~ivxIO^XN7__e0cHbHE%p zmJaa!A;Dx!1&e_G)`7*h0Kg8m{lM`i9{>}w;s#c&}V`-$*U!6INt zCnwE^lgdsy6z8ks|0kYKE)8g_IbaUd9pK)*LnHj!x!0$dhd-dz{ zS1&KdxwCw-G=6Zi_HN+xpSpC7GTNnEv`16AO=BEqG*#5JWW*Z3J$Uv(G`40{%8#C< ze4h2_^UP?U7MOFoqkN7AW~~4HnZ;+(-^i|Xx3d+!ry{*`od11zf2gQcd9l_j?=E~1 ztqt5tX&YD3c@kH|6mvl5sZU#q!oL`?wzrS6@1m{7s#GvRQn!BhwH}T0!o$6U^(FJeXGm^eI?;I}Y^iII#S| f5XT9qoRbO`0kMOzf)@ehGu)p4{uJ193?29l{t9W7 literal 0 HcmV?d00001 diff --git a/code_snippets/bbob/README.md b/code_snippets/bbob/README.md new file mode 100644 index 0000000..bf6f4af --- /dev/null +++ b/code_snippets/bbob/README.md @@ -0,0 +1,27 @@ +# BBOB + +Evaluates a function from the [COCO](https://github.com/numbbo/coco) **bbob** suite — the core set of 24 noiseless single-objective benchmark functions widely used for comparing continuous optimizers. + +## Prerequisites + +No extra setup is needed beyond having `uv` installed. The `coco-experiment` package is resolved automatically. + +## Usage + +```bash +uv run call_bbob.py +``` + +## What the Snippet Does + +The script evaluates function 1 (instance 1) from the `bbob` suite in 2 dimensions at the origin and prints the result. You can adjust the behavior by editing these variables in the script: + +- **`function_indices`** — which benchmark function(s) to load (default: `1`) +- **`dimensions`** — problem dimensionality (default: `2`) +- **`instances`** — problem instance(s) (default: `1`) +- **`eval_point`** — the point at which the function is evaluated (default: all zeros) + +## Resources + +- [COCO documentation](https://numbbo.github.io/coco/) +- [bbob suite function definitions](https://numbbo.github.io/coco/testsuites/bbob) \ No newline at end of file diff --git a/code_snippets/call_bbob.py b/code_snippets/bbob/call_bbob.py similarity index 100% rename from code_snippets/call_bbob.py rename to code_snippets/bbob/call_bbob.py diff --git a/code_snippets/bbob_largescale/README.md b/code_snippets/bbob_largescale/README.md new file mode 100644 index 0000000..262b62a --- /dev/null +++ b/code_snippets/bbob_largescale/README.md @@ -0,0 +1,27 @@ +# BBOB Large-Scale + +Evaluates a function from the [COCO](https://github.com/numbbo/coco) **bbob-largescale** suite — a set of large-scale benchmark functions designed for testing optimizers in higher dimensions. + +## Prerequisites + +No extra setup is needed beyond having `uv` installed. The `coco-experiment` package is resolved automatically. + +## Usage + +```bash +uv run call_bbob_largescale.py +``` + +## What the Snippet Does + +The script evaluates function 1 (instance 1) from the `bbob-largescale` suite in 20 dimensions at the origin and prints the result. You can adjust the behavior by editing these variables in the script: + +- **`function_indices`** — which benchmark function(s) to load (default: `1`) +- **`dimensions`** — problem dimensionality (default: `20`) +- **`instances`** — problem instance(s) (default: `1`) +- **`eval_point`** — the point at which the function is evaluated (default: all zeros) + +## Resources + +- [COCO documentation](https://numbbo.github.io/coco/) +- [bbob-largescale suite definition](https://coco.gforge.inria.fr/downloads/download16.00/bbob-largescale-functions.pdf) \ No newline at end of file diff --git a/code_snippets/call_bbob_largescale.py b/code_snippets/bbob_largescale/call_bbob_largescale.py similarity index 100% rename from code_snippets/call_bbob_largescale.py rename to code_snippets/bbob_largescale/call_bbob_largescale.py diff --git a/code_snippets/bbob_mixint/README.md b/code_snippets/bbob_mixint/README.md new file mode 100644 index 0000000..9513d32 --- /dev/null +++ b/code_snippets/bbob_mixint/README.md @@ -0,0 +1,27 @@ +# BBOB Mixed-Integer + +Evaluates a function from the [COCO](https://github.com/numbbo/coco) **bbob-mixint** suite — benchmark functions with a mix of continuous and integer variables, designed for testing mixed-integer optimization algorithms. + +## Prerequisites + +No extra setup is needed beyond having `uv` installed. The `coco-experiment` package is resolved automatically. + +## Usage + +```bash +uv run call_bbob_mixint.py +``` + +## What the Snippet Does + +The script evaluates function 1 (instance 1) from the `bbob-mixint` suite in 5 dimensions at the origin and prints the result. You can adjust the behavior by editing these variables in the script: + +- **`function_indices`** — which benchmark function(s) to load (default: `1`) +- **`dimensions`** — problem dimensionality (default: `5`) +- **`instances`** — problem instance(s) (default: `1`) +- **`eval_point`** — the point at which the function is evaluated (default: all zeros) + +## Resources + +- [COCO documentation](https://numbbo.github.io/coco/) +- [bbob-mixint suite definition](https://numbbo.github.io/coco/testsuites/bbob-mixint) \ No newline at end of file diff --git a/code_snippets/call_bbob_mixint.py b/code_snippets/bbob_mixint/call_bbob_mixint.py similarity index 100% rename from code_snippets/call_bbob_mixint.py rename to code_snippets/bbob_mixint/call_bbob_mixint.py diff --git a/code_snippets/bbob_noisy/README.md b/code_snippets/bbob_noisy/README.md new file mode 100644 index 0000000..21cb3ef --- /dev/null +++ b/code_snippets/bbob_noisy/README.md @@ -0,0 +1,27 @@ +# BBOB Noisy + +Evaluates a function from the [COCO](https://github.com/numbbo/coco) **bbob-noisy** suite — a set of 30 noisy benchmark functions that add various noise models (Gaussian, uniform, Cauchy) to the base BBOB problems, designed for testing optimizer robustness under noisy evaluations. + +## Prerequisites + +No extra setup is needed beyond having `uv` installed. The `coco-experiment` package is resolved automatically. + +## Usage + +```bash +uv run call_bbob_noisy.py +``` + +## What the Snippet Does + +The script evaluates function 1 (instance 1) from the `bbob-noisy` suite in 2 dimensions at the origin and prints the result. Since the functions are noisy, repeated evaluations at the same point may return different values. You can adjust the behavior by editing these variables in the script: + +- **`function_indices`** — which benchmark function(s) to load (default: `1`) +- **`dimensions`** — problem dimensionality (default: `2`) +- **`instances`** — problem instance(s) (default: `1`) +- **`eval_point`** — the point at which the function is evaluated (default: all zeros) + +## Resources + +- [COCO documentation](https://numbbo.github.io/coco/) +- [bbob-noisy suite definition](https://numbbo.github.io/coco/testsuites/bbob-noisy) \ No newline at end of file diff --git a/code_snippets/call_bbob_noisy.py b/code_snippets/bbob_noisy/call_bbob_noisy.py similarity index 100% rename from code_snippets/call_bbob_noisy.py rename to code_snippets/bbob_noisy/call_bbob_noisy.py diff --git a/code_snippets/cec2013/README.md b/code_snippets/cec2013/README.md new file mode 100644 index 0000000..e157f2b --- /dev/null +++ b/code_snippets/cec2013/README.md @@ -0,0 +1,44 @@ +# IOH CEC2013 Niching + +Evaluates a function from the [IOHexperimenter](https://github.com/IOHprofiler/IOHexperimenter) **CEC2013 niching** benchmark suite — a set of 20 multimodal problems used for testing niching and multi-modal optimization algorithms. + +## Prerequisites + +No extra setup is needed beyond having `uv` installed. The `ioh` package is resolved automatically. + +> **Note:** This snippet requires **Python 3.10**. The inline metadata enforces this via `requires-python = "==3.10"`. Make sure a Python 3.10 interpreter is available on your system. + +## Usage + +```bash +uv run call_cec2013.py +``` + +## What the Snippet Does + +The script creates the `EqualMaxima1102` problem from the CEC2013 suite in 1 dimension, evaluates it at the origin, and prints the result. You can adjust the behavior by editing these variables in the script: + +- **Problem name** — replace `"EqualMaxima1102"` with any of the 20 available functions (see table below) +- **`dim`** — problem dimensionality (default: `1`) +- **`eval_point`** — the point at which the function is evaluated (default: all zeros) + +### Available Functions + +| ID | Name | +|----|------| +| 1101 | FivePeaks | +| 1102 | EqualMaxima | +| 1103 | UnevenEqualMaxima | +| 1104 | Himmelblau | +| 1105 | SixHumpCamelback | +| 1106 | Shubert | +| 1107 | Vincent | +| 1108 | Shubert | +| 1109 | Vincent | +| 1110 | ModifiedRastrigin | +| 1111–1120 | CompositionFunction | + +## Resources + +- [IOHexperimenter documentation](https://iohprofiler.github.io/IOHexperimenter/) +- [CEC2013 niching competition](https://bee22.com/resources/CEC%202013-Niching%20Methods%20for%20Multimodal%20Optimization.pdf) \ No newline at end of file diff --git a/code_snippets/call_cec2013.py b/code_snippets/cec2013/call_cec2013.py similarity index 100% rename from code_snippets/call_cec2013.py rename to code_snippets/cec2013/call_cec2013.py diff --git a/code_snippets/cec2022/README.md b/code_snippets/cec2022/README.md new file mode 100644 index 0000000..5d48902 --- /dev/null +++ b/code_snippets/cec2022/README.md @@ -0,0 +1,48 @@ +# IOH CEC2022 + +Evaluates a function from the [IOHexperimenter](https://github.com/IOHprofiler/IOHexperimenter) **CEC2022** benchmark suite — 12 single-objective bound-constrained problems used in the CEC2022 competition on real-parameter optimization. + +## Prerequisites + +No extra setup is needed beyond having `uv` installed. The `ioh` package is resolved automatically. + +> **Note:** This snippet requires **Python 3.10**. The inline metadata enforces this via `requires-python = "==3.10"`. Make sure a Python 3.10 interpreter is available on your system. + +## Usage + +```bash +uv run call_cec2022.py +``` + +## What the Snippet Does + +The script creates the `CEC2022Zakharov` problem (instance 1) in 10 dimensions, evaluates it at the origin, and prints the result. You can adjust the behavior by editing these variables in the script: + +- **Problem name** — replace `"CEC2022Zakharov"` with any of the 12 available functions (see table below) +- **`dimension`** — must be **10** or **20** +- **`instance`** — problem instance (default: `1`) +- **`eval_point`** — the point at which the function is evaluated (default: all zeros) + +### Available Functions + +| # | Name | +|---|------| +| 1 | CEC2022Zakharov | +| 2 | CEC2022Rosenbrock | +| 3 | CEC2022Schaffer | +| 4 | CEC2022StepRastrigin | +| 5 | CEC2022Levy | +| 6 | CEC2022HybridFunction1 | +| 7 | CEC2022HybridFunction2 | +| 8 | CEC2022HybridFunction3 | +| 9 | CEC2022CompositionFunction1 | +| 10 | CEC2022CompositionFunction2 | +| 11 | CEC2022CompositionFunction3 | +| 12 | CEC2022CompositionFunction4 | + +> **Note:** The function names above are approximate. Run `ioh.get_problem?` or check the IOHexperimenter docs for the exact strings accepted by `get_problem()`. + +## Resources + +- [IOHexperimenter documentation](https://iohprofiler.github.io/IOHexperimenter/) +- [CEC2022 competition technical report](https://www3.ntu.edu.sg/home/epnsugan/index_files/CEC2022/CEC2022.htm) \ No newline at end of file diff --git a/code_snippets/call_cec2022.py b/code_snippets/cec2022/call_cec2022.py similarity index 100% rename from code_snippets/call_cec2022.py rename to code_snippets/cec2022/call_cec2022.py diff --git a/code_snippets/dynamicbinval/README.md b/code_snippets/dynamicbinval/README.md new file mode 100644 index 0000000..260abae --- /dev/null +++ b/code_snippets/dynamicbinval/README.md @@ -0,0 +1,29 @@ +# IOH DynamicBinVal + +Evaluates the **DynamicBinValUniform** problem from the [IOHexperimenter](https://github.com/IOHprofiler/IOHexperimenter) — a dynamic pseudo-Boolean benchmark where bit weights change over time, used for studying the behavior of discrete optimizers under non-static objective functions. + +## Prerequisites + +No extra setup is needed beyond having `uv` installed. The `ioh` package is resolved automatically. + +> **Note:** This snippet requires **Python 3.10**. The inline metadata enforces this via `requires-python = "==3.10"`. Make sure a Python 3.10 interpreter is available on your system. + +## Usage + +```bash +uv run call_dynamicbinval.py +``` + +## What the Snippet Does + +The script creates the `DynamicBinValUniform` problem (instance 1, integer problem class) in 32 dimensions, evaluates it at the all-zeros bit string, and prints the result. You can adjust the behavior by editing these variables in the script: + +- **Problem name** — replace `"DynamicBinValUniform"` with other dynamic binary-value variants if available +- **`dim`** — number of bits / problem dimensionality (default: `32`) +- **`instance`** — problem instance (default: `1`) +- **`eval_point`** — the bit string at which the function is evaluated (default: all zeros) + +## Resources + +- [IOHexperimenter documentation](https://iohprofiler.github.io/IOHexperimenter/) +- [IOH problem registry](https://iohprofiler.github.io/IOHexperimenter/python/problem_overview.html) \ No newline at end of file diff --git a/code_snippets/call_dynamicbinval.py b/code_snippets/dynamicbinval/call_dynamicbinval.py similarity index 100% rename from code_snippets/call_dynamicbinval.py rename to code_snippets/dynamicbinval/call_dynamicbinval.py diff --git a/code_snippets/mf2/README.md b/code_snippets/mf2/README.md new file mode 100644 index 0000000..ebc1367 --- /dev/null +++ b/code_snippets/mf2/README.md @@ -0,0 +1,37 @@ +# mf2 Multi-Fidelity + +Evaluates multi-fidelity benchmark functions from the [mf2](https://github.com/sjvrijn/mf2) library — a collection of analytical multi-fidelity test functions commonly used for benchmarking surrogate-based and multi-fidelity optimization methods. + +## Prerequisites + +No extra setup is needed beyond having `uv` installed. The `mf2` and `setuptools` packages are resolved automatically. + +> **Note:** This snippet requires **Python 3.10**. The inline metadata enforces this via `requires-python = "==3.10"`. Make sure a Python 3.10 interpreter is available on your system. + +## Usage + +```bash +uv run call_mf2.py +``` + +## What the Snippet Does + +The script evaluates the **Branin** function at both high and low fidelity in 2 dimensions at the origin and prints both results. You can adjust the behavior by editing these variables in the script: + +- **Function** — replace `mf2.branin` with any available multi-fidelity function (see list below) +- **Fidelity level** — `.high()` for the expensive/accurate version, `.low()` for the cheap/approximate one +- **`dim`** — problem dimensionality (must match the chosen function's expected input dimension) +- **`eval_point`** — the point at which the function is evaluated (default: all zeros) + +### Available Functions + +Some of the functions provided by mf2 include: `branin`, `bohachevsky`, `booth`, `currin`, `himmelblau`, `six_hump_camelback`, `hartmann3`, `hartmann6`, `park91a`, `park91b`, `borehole`, and `forrester`. + +Each function exposes `.high()` and `.low()` fidelity levels, and some offer additional intermediate fidelities. + +> Run `dir(mf2)` for the full list available in your installed version. + +## Resources + +- [mf2 documentation](https://mf2.readthedocs.io/) +- [mf2 GitHub repository](https://github.com/sjvrijn/mf2) \ No newline at end of file diff --git a/code_snippets/call_mf2.py b/code_snippets/mf2/call_mf2.py similarity index 100% rename from code_snippets/call_mf2.py rename to code_snippets/mf2/call_mf2.py diff --git a/code_snippets/sbox/README.md b/code_snippets/sbox/README.md new file mode 100644 index 0000000..00e06d4 --- /dev/null +++ b/code_snippets/sbox/README.md @@ -0,0 +1,59 @@ +# IOH BBOB (SBOX) + +Evaluates a function from the [IOHexperimenter](https://github.com/IOHprofiler/IOHexperimenter) **SBOX** problem class(strict box-constrained problems) — a re-implementation of the 24 noiseless real-valued BBOB test functions supported on [-5, 5]^n. + +## Prerequisites + +No extra setup is needed beyond having `uv` installed. The `ioh` package is resolved automatically. + +> **Note:** This snippet requires **Python 3.10**. The inline metadata enforces this via `requires-python = "==3.10"`. Make sure a Python 3.10 interpreter is available on your system. + +## Usage + +```bash +uv run call_sbox.py +``` + +## What the Snippet Does + +The script creates SBOX problem 1 (instance 1) in 2 dimensions, evaluates it at the origin, and prints the result. You can adjust the behavior by editing these variables in the script: + +- **Problem ID** — the first argument to `ioh.get_problem()` selects which of the 24 functions to load (default: `1`) +- **`dim`** — problem dimensionality (default: `2`) +- **`instance`** — problem instance (default: `1`) +- **`eval_point`** — the point at which the function is evaluated (default: all zeros) + +### Available Functions + +| ID | Name | +|----|------| +| 1 | Sphere | +| 2 | Ellipsoid | +| 3 | Rastrigin | +| 4 | BuecheRastrigin | +| 5 | LinearSlope | +| 6 | AttractiveSector | +| 7 | StepEllipsoid | +| 8 | Rosenbrock | +| 9 | RosenbrockRotated | +| 10 | EllipsoidRotated | +| 11 | Discus | +| 12 | BentCigar | +| 13 | SharpRidge | +| 14 | DifferentPowers | +| 15 | RastriginRotated | +| 16 | Weierstrass | +| 17 | Schaffers10 | +| 18 | Schaffers1000 | +| 19 | GriewankRosenbrock | +| 20 | Schwefel | +| 21 | Gallagher101 | +| 22 | Gallagher21 | +| 23 | Katsuura | +| 24 | LunacekBiRastrigin | + +## Resources + +- [SBOX class documentation](https://iohprofiler.github.io/IOHexperimenter/api/ioh.iohcpp.problem.SBOX.html) +- [IOHexperimenter BBOB & SBOX overview](https://iohprofiler.github.io/IOHexperimenter/python/bbob.html) +- [IOHexperimenter GitHub repository](https://github.com/IOHprofiler/IOHexperimenter) \ No newline at end of file diff --git a/code_snippets/call_sbox.py b/code_snippets/sbox/call_sbox.py similarity index 100% rename from code_snippets/call_sbox.py rename to code_snippets/sbox/call_sbox.py From 48929bac44df4cefa2c2886ee1eb8835e0e24d4a Mon Sep 17 00:00:00 2001 From: Elena <71965364+elenaraponi@users.noreply.github.com> Date: Tue, 21 Apr 2026 14:57:42 +0200 Subject: [PATCH 08/11] GNBG-II suite added --- code_snippets/.DS_Store | Bin 8196 -> 8196 bytes code_snippets/GNBG-II/.DS_Store | Bin 0 -> 6148 bytes code_snippets/GNBG-II/README.md | 85 ++++++++++++++++++++++++++++ code_snippets/GNBG-II/call_gnbg.py | 23 ++++++++ code_snippets/GNBG-II/gnbg.py | 86 +++++++++++++++++++++++++++++ code_snippets/notes.txt | 4 +- 6 files changed, 197 insertions(+), 1 deletion(-) create mode 100644 code_snippets/GNBG-II/.DS_Store create mode 100644 code_snippets/GNBG-II/README.md create mode 100644 code_snippets/GNBG-II/call_gnbg.py create mode 100644 code_snippets/GNBG-II/gnbg.py diff --git a/code_snippets/.DS_Store b/code_snippets/.DS_Store index 66a1206d2bd071733c1bb7ee8cab58282b980b90..1b5ac13f9b4d0c28c691302a8e806f7fee94f068 100644 GIT binary patch delta 467 zcmZp1XmOa}mJU^hRb`eq)1W|n$(26qNO1}7k?%izi2nN(g}kd%|3#K6F?GpQga zv$({-;2I+nGYcylI|n-lH%Dx6Mt*s4Nn%N9u~TAEG>8|HpP!QiV<#qsWu}(L3y3)9 z=anR8=A{;aHDsow0+qysXXd5kmpkQ`=A{&a_0|VNWH>lEIO7E*tE-KTEev!NEG#W+ zbrh;Cjeu+uGn3j{P7YCJee0n3?3~=Z{BEG@fPj$^LNo9}X&BW5WT5#gr8qe!3FuCc u7Gx=Ypr6Zvi}G^v^U{G*jGKEzvY9rsOMGLg$8alsovMK0R!pa6FaZFk*lvLU delta 42 ycmZp1XmOa}C7U^hRb%4QycW|qzKMKhQ-76>qIW|#QJvYA)x7vshPUPb^bKMkS) diff --git a/code_snippets/GNBG-II/.DS_Store b/code_snippets/GNBG-II/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..3371d4c67ef66a6439d568005098187a30a20351 GIT binary patch literal 6148 zcmeHKQESvd5T3nWZH`j72L;iWfUi}P)8a#4Lac}{B1Y_k%9%8W4NZ5;CFdc>LH>aL zA^(TJ$8UD`L^=CXsI)QzGv8)*W|RHq*u5blmCnkTXh=i>l(9E}`HS#8>zeeuX9KA0 z8e@7vni^^;UyByURb+r`cZZ(SOG;sXub-wPnxK{s=oNiIMUTm#w)g22wXH}O^X9Cm zO@aLH#aUf7Z4~`by^a3njjdoS*bY8q$7Y_jc{^*;eEN=`-WXFCt8reuttRvF@a9va z+q}|~sZFTL2}0fi>z!{9>OFPo#fz;<}y3oY>$zQs^39sbbAB_2D6E}fKbK9qm6@*Rq@Z^!zf4JVa26e|n}1Aj8Wy&q)A z_y4o=`+plGMi>wV{!a!}{~$X^u{VFWuI-ZV+7S8?%EED-!(S;F*sB<^d==k@T7f_0 W0Wk5{IfMrye*`QIVuXQz%D_(=9%f|# literal 0 HcmV?d00001 diff --git a/code_snippets/GNBG-II/README.md b/code_snippets/GNBG-II/README.md new file mode 100644 index 0000000..d9f81b4 --- /dev/null +++ b/code_snippets/GNBG-II/README.md @@ -0,0 +1,85 @@ +# GNBG + +Evaluates functions from the **GNBG benchmark suite**, a set of structured multimodal optimization problems defined via parameter files (`.mat`) and evaluated through a Python implementation. + +## Prerequisites + +No extra setup is needed beyond having `uv` installed. The required dependencies are: + +* `numpy` +* `scipy` + +These are resolved automatically via the script header. + +## Setup + +1. Download or clone the GNBG repository: + + ``` + https://github.com/rohitsalgotra/GNBG-II + ``` + +2. Extract the Python instances: + + ``` + GNBG_Instances.Python-main.zip + ``` + +3. Place the extracted folder in your project directory: + +``` +project/ +│ +├── gnbg.py +├── call_gnbg.py +└── GNBG_Instances.Python-main/ + ├── f1.mat + ├── ... +``` + +## Usage + +```bash +uv run call_gnbg.py +``` + +## What the Snippet Does + +The script: + +1. Loads a GNBG problem instance (e.g. `f1.mat`) +2. Constructs the corresponding benchmark function +3. Evaluates it at a given point +4. Prints the result + +The implementation is split into: + +* **`gnbg.py`** — contains the GNBG class and loader (reusable) +* **`call_gnbg.py`** — minimal runner script + +`call_gnbg.py` depends on `gnbg.py`, so both files must be present in the same directory. + +## Key Parameters + +Edit these in `call_gnbg.py`: + +* **`problem_index`** — which GNBG function to load (`1`–`24`) +* **`repo_dir`** — path to the folder containing the `.mat` files +* **`eval_point`** — evaluation point + +Example: + +```python +problem_index = 1 +eval_point = np.zeros(problem.Dimension) +``` + +## Resources + +* GNBG repository: + [https://github.com/rohitsalgotra/GNBG-II](https://github.com/rohitsalgotra/GNBG-II) + +* Benchmark description: + Generalized Numerical Benchmark Generator (GNBG) + + diff --git a/code_snippets/GNBG-II/call_gnbg.py b/code_snippets/GNBG-II/call_gnbg.py new file mode 100644 index 0000000..56f3e08 --- /dev/null +++ b/code_snippets/GNBG-II/call_gnbg.py @@ -0,0 +1,23 @@ +# /// script +# dependencies = [ +# "numpy", +# "scipy", +# ] +# /// + +import numpy as np +from gnbg import load_gnbg_instance + +### input +repo_dir = "GNBG_Instances.Python-main" +problem_index = 1 + +### prepare +problem = load_gnbg_instance(repo_dir, problem_index) +print(problem) + +### evaluation point +eval_point = np.zeros(problem.Dimension) + +### go +print(problem(eval_point)) \ No newline at end of file diff --git a/code_snippets/GNBG-II/gnbg.py b/code_snippets/GNBG-II/gnbg.py new file mode 100644 index 0000000..2bf53b9 --- /dev/null +++ b/code_snippets/GNBG-II/gnbg.py @@ -0,0 +1,86 @@ +import os +import numpy as np +from scipy.io import loadmat + + +class GNBG: + def __init__(self, Dimension, CompNum, CompMinPos, CompSigma, + CompH, Mu, Omega, Lambda, RotationMatrix): + self.Dimension = int(Dimension) + self.CompNum = int(CompNum) + self.CompMinPos = np.asarray(CompMinPos, dtype=float) + self.CompSigma = np.asarray(CompSigma, dtype=float).reshape(-1) + self.CompH = np.asarray(CompH, dtype=float) + self.Mu = np.asarray(Mu, dtype=float) + self.Omega = np.asarray(Omega, dtype=float) + self.Lambda = np.asarray(Lambda, dtype=float).reshape(-1) + self.RotationMatrix = np.asarray(RotationMatrix, dtype=float) + + def transform(self, X, Alpha, Beta): + X = np.asarray(X, dtype=float) + Alpha = np.ravel(Alpha) + Beta = np.ravel(Beta) + + Y = X.copy() + + tmp = X > 0 + Y[tmp] = np.log(X[tmp]) + Y[tmp] = np.exp( + Y[tmp] + Alpha[0] * (np.sin(Beta[0] * Y[tmp]) + np.sin(Beta[1] * Y[tmp])) + ) + + tmp = X < 0 + Y[tmp] = np.log(-X[tmp]) + Y[tmp] = -np.exp( + Y[tmp] + Alpha[1] * (np.sin(Beta[2] * Y[tmp]) + np.sin(Beta[3] * Y[tmp])) + ) + + return Y + + def fitness(self, X): + X = np.asarray(X, dtype=float).reshape(-1, 1) + f = np.full(self.CompNum, np.nan) + + for k in range(self.CompNum): + R = self.RotationMatrix[:, :, k] if self.RotationMatrix.ndim == 3 else self.RotationMatrix + shift = self.CompMinPos[k, :].reshape(-1, 1) + + a = self.transform( + (X - shift).T @ R.T, + self.Mu[k, :], + self.Omega[k, :], + ) + b = self.transform( + R @ (X - shift), + self.Mu[k, :], + self.Omega[k, :], + ) + + quad = float(np.squeeze(a @ np.diag(np.ravel(self.CompH[k, :])) @ b)) + sigma_k = float(self.CompSigma[k]) + lambda_k = float(self.Lambda[k]) + + f[k] = sigma_k + quad ** lambda_k + + return float(np.min(f)) + + __call__ = fitness + + +def load_gnbg_instance(repo_dir, idx): + data = loadmat(os.path.join(repo_dir, f"f{idx}.mat"))["GNBG"] + + def get_scalar(field): + return np.array([item[0] for item in data[field].flatten()])[0, 0] + + return GNBG( + Dimension=get_scalar("Dimension"), + CompNum=get_scalar("o"), + CompMinPos=np.array(data["Component_MinimumPosition"][0, 0], dtype=float), + CompSigma=np.atleast_1d(np.array(data["ComponentSigma"][0, 0], dtype=float)).reshape(-1), + CompH=np.array(data["Component_H"][0, 0], dtype=float), + Mu=np.array(data["Mu"][0, 0], dtype=float), + Omega=np.array(data["Omega"][0, 0], dtype=float), + Lambda=np.atleast_1d(np.array(data["lambda"][0, 0], dtype=float)).reshape(-1), + RotationMatrix=np.array(data["RotationMatrix"][0, 0], dtype=float), + ) \ No newline at end of file diff --git a/code_snippets/notes.txt b/code_snippets/notes.txt index 80525e4..665ca00 100644 --- a/code_snippets/notes.txt +++ b/code_snippets/notes.txt @@ -8,4 +8,6 @@ Encountered issues: 2) VehicleDynamics is not a problem, only dataset 3) AMVOP: no Github available according to database (haven't double-checked) 4) AutomotiveCrashworthiness: Not integrated. The linked code is not generated aliases of the crashworthiness problems. It's a pipeline that extracts ELA features from generated problems. Problem generator is in a .py file. -5) gbea: Not integrated. Needs repository cloning. \ No newline at end of file +5) gbea: Not integrated. Needs repository cloning. +6) GNBG - 404 page not found (gor github repo) +7) \ No newline at end of file From 64101f4de52dbefe8287ce524d73b718e28448bb Mon Sep 17 00:00:00 2001 From: Elena <71965364+elenaraponi@users.noreply.github.com> Date: Tue, 21 Apr 2026 18:02:36 +0200 Subject: [PATCH 09/11] Updated local READMEs with uv installation --- code_snippets/.DS_Store | Bin 8196 -> 10244 bytes code_snippets/GNBG-II/README.md | 8 +++++++- code_snippets/bbob/README.md | 8 +++++++- code_snippets/bbob_largescale/README.md | 8 +++++++- code_snippets/bbob_mixint/README.md | 8 +++++++- code_snippets/bbob_noisy/README.md | 8 +++++++- code_snippets/cec2013/README.md | 8 +++++++- code_snippets/cec2022/README.md | 8 +++++++- code_snippets/dynamicbinval/README.md | 8 +++++++- code_snippets/mf2/README.md | 8 +++++++- code_snippets/sbox/README.md | 8 +++++++- 11 files changed, 70 insertions(+), 10 deletions(-) diff --git a/code_snippets/.DS_Store b/code_snippets/.DS_Store index 1b5ac13f9b4d0c28c691302a8e806f7fee94f068..c2372ddc25c76a5984243bb7d82e7ecbc98126b5 100644 GIT binary patch literal 10244 zcmeHMeQXp(6o2n}*j-9ti!Bt6+S5`}N|AB}N&%rCN1@2~we$nD+}$qihV5>--MbbD zq=_0$Kw?n;^aDx!!x*AQ5|n_6nkX9m0~#U`6Qha7L?tFBf&}r+&R%=8TS_!WiMyAb zH#6_Oo!@)=o86r`0KodBybvG=00Ny%N|UH?IhdZEqYj_bGnXWiKWJSGBXOgrca){q z;bp+ffR_O;16~Ha4E$FzK<{jJ2svDOrI!IO16~G(GQge>K{}bNb>sk-_M?LedkH|& zPu=!Gb%|9-1|3=J$N?@%LkDtKlH3)YB?fYL>JK`0wT>L%lDh*siw|^0MrVbB_ULr| zpluFV%cWO(8SpYNIs8yMhV3xY z@oZgiW)mY6Izvzi3!%yd;RuUNY?qH~*Bor4tcFpIZ8Z*_5QN6TLl&8M&g(y1cfn&@ z4dWTx$^}m@$gr1~76rz-INepoyA+#6F4%5kor&}GzMt>|KF4qCF^u`nJY4W+!y4EK z^;FJ>CTNQFnZ3@F=ABrtrkYk|AeaX2Z~8 z>3TG_O;!3jrThj%x1y@9By0y&R>)*WtE$UJU%ipkWz+VJaD^ZWVy84?|Ng3~rIi)I zr8PANDuVlKLR4S0WYK{GqEJw>VENY0-CB=s9O6$>biPI)m$!$?!&Dm)mTbng7{O#N zBUGB1YTyxP%}hu9MLJ?p%n7u%wRdz%QqokmDq7T1Q%X2$DQ2fM#iZby;)cFCp`B_Vp2iT19Rq8E?%}O+_YiKVD988k~me&Z%wJD8q<`PK2^55+oNV&(PdTd>Y!Ze zmbyz-5@H^P#AZF(qYO&ZrWekb83>HDPG6-h8B_NpRco(QA_#np;=ui)bW+$MQve$b znO#w~HG$$lsUU1;{S66)O5QD&1jlBSPt?zxR?DhoB1e%z{6duGU@hLonhw*uQ5nsY%_zJ#>@8W4ZgJYWL?%wZG~+UvY?JpE%G>0%@AgR6@hK%1wGg|N{;_73 zl+Ac73^MEDpjaeLApY~_>{4ppL)_=hx#dMgl8>ewZ$7x7NR+Z@LW#C-RXH`$X;d#2 zMafT7i|bZAL``6`oww`i=}K&(2!Efj$KW-115Uw*MA(b)C43E6;41uqej?~JEF_Z7 z!XhGR8J6QbtiZ)sjWxK8C>zE`T#HS(4kOrtt=NX`L|7RW+=T}2A<|kz+k-fOkKyC^ z1RlX>@F+fu&)M`nj<1iPezlI)y1YjH^!dg<nkUIx4j+!Yzf z;wXb`|9|z^|Nq|=v3MZ840sv%YZ*X)I1;WW-}I;V$jh+3_8^@*>0}498{pD*p~Bvd wCuwiTQ-f{Cm(j^=on?w$uXXwcxU}8L#&##kck}=8KLfn=zqkJXpRfP_1aLvn`2YX_ delta 101 zcmZn(XmOBWU|?W$DortDU;r^WfEYvza8FDWo2aMAsJ<~^H$S8LW*&hS*3IG4vzcWwfR|(``gy?6O9M3a#@?Vk3K=ma|0C Date: Tue, 21 Apr 2026 18:22:30 +0200 Subject: [PATCH 10/11] IOH Clustering problem added --- code_snippets/IOHClustering/README.md | 64 +++++++++++++++++++ .../IOHClustering/call_IOHClustering.py | 20 ++++++ 2 files changed, 84 insertions(+) create mode 100644 code_snippets/IOHClustering/README.md create mode 100644 code_snippets/IOHClustering/call_IOHClustering.py diff --git a/code_snippets/IOHClustering/README.md b/code_snippets/IOHClustering/README.md new file mode 100644 index 0000000..624cfbb --- /dev/null +++ b/code_snippets/IOHClustering/README.md @@ -0,0 +1,64 @@ +# IOH Clustering + +Evaluates a function from the [IOHclustering](https://github.com/IOHprofiler/IOHClustering) benchmark suite — a set of continuous black-box optimization problems derived from data clustering tasks, integrated with the [IOHprofiler](https://github.com/IOHprofiler) framework. + +Each problem encodes a k-means-style clustering objective: the search vector represents `k` cluster centers in a 2D feature space (after PCA or feature selection), so the problem dimensionality is `k × 2`. All variables are bounded in `[0, 1]`. + +## Quick Start + +1. Install [uv](https://docs.astral.sh/uv/) if you don't have it yet: + +```bash +pip install uv +``` + +No extra setup is needed beyond having `uv` installed. The `ioh` and `iohclustering` packages are resolved automatically. + +> **Note:** This snippet requires **Python 3.10**. The inline metadata enforces this via `requires-python = "==3.10"`. Make sure a Python 3.10 interpreter is available on your system. + +## Usage + +```bash +uv run call_clustering.py +``` + +## What the Snippet Does + +The script creates clustering problem 5 (`iris_pca`) with `k=2` clusters, evaluates it at the origin, and prints the result. You can adjust the behavior by editing these variables in the script: + +- **`fid`** — problem ID (integer) or dataset name (string) passed to `get_problem()` (default: `5`) +- **`k`** — number of cluster centers (default: `2`; available values: `2`, `3`, `5`, `10`) +- **`instance`** — problem instance for transformation-based generalization (default: `1`) +- **`eval_point`** — the point at which the function is evaluated (default: all zeros) + +> **Note:** `get_problem()` returns a tuple `(problem, retransform)`. The `retransform` function converts a solution vector back into cluster center coordinates in the original data space. + +### Available Datasets + +| ID | Name | +|----|------| +| 1 | breast_pca | +| 2 | diabetes_pca | +| 3 | german_postal_selected | +| 4 | glass_pca | +| 5 | iris_pca | +| 6 | kc1_pca | +| 7 | mfeat-fourier_pca | +| 8 | ruspini_selected | +| 9 | segment_pca | +| 10 | wine_pca | + +### Available Values of k + +| k | Dimensionality | +|---|----------------| +| 2 | 4 | +| 3 | 6 | +| 5 | 10 | +| 10 | 20 | + +## Resources + +- [IOHClustering GitHub repository](https://github.com/IOHprofiler/IOHClustering) +- [IOHexperimenter GitHub repository](https://github.com/IOHprofiler/IOHexperimenter) +- [Benchmark paper (arXiv)](https://arxiv.org/abs/2505.09233) \ No newline at end of file diff --git a/code_snippets/IOHClustering/call_IOHClustering.py b/code_snippets/IOHClustering/call_IOHClustering.py new file mode 100644 index 0000000..daeedbb --- /dev/null +++ b/code_snippets/IOHClustering/call_IOHClustering.py @@ -0,0 +1,20 @@ +# /// script +# requires-python = "==3.10" +# dependencies = [ +# "ioh", +# "iohclustering", +# ] +# /// + +from iohclustering import get_problem + +# Get benchmark problem by its ID (e.g., ID=5) with k=2 clusters +# Alternatively, by name (e.g., "iris_pca") +clustering_problem, retransform = get_problem(fid=5, k=2) + +### evaluation point +dim = clustering_problem.meta_data.n_variables +eval_point = [0.0]*dim + +### print function value for eval_point +print(clustering_problem(eval_point)) \ No newline at end of file From 37cba78f0f14672d0f519f664167207d7a937ae7 Mon Sep 17 00:00:00 2001 From: Elena <71965364+elenaraponi@users.noreply.github.com> Date: Tue, 21 Apr 2026 18:50:31 +0200 Subject: [PATCH 11/11] Added MA-BBOB + update in notes --- code_snippets/MA-BBOB/README.md | 79 ++++++++++++++++++++++++++++ code_snippets/MA-BBOB/call_mabbob.py | 17 ++++++ code_snippets/notes.txt | 8 +-- 3 files changed, 100 insertions(+), 4 deletions(-) create mode 100644 code_snippets/MA-BBOB/README.md create mode 100644 code_snippets/MA-BBOB/call_mabbob.py diff --git a/code_snippets/MA-BBOB/README.md b/code_snippets/MA-BBOB/README.md new file mode 100644 index 0000000..5bc757c --- /dev/null +++ b/code_snippets/MA-BBOB/README.md @@ -0,0 +1,79 @@ +# IOH MA-BBOB (ManyAffine) + +Evaluates a function from the [IOHexperimenter](https://github.com/IOHprofiler/IOHexperimenter) **MA-BBOB** problem generator — a method for creating arbitrary affine combinations of the 24 noiseless BBOB test functions, supported on [-5, 5]^n. + +MA-BBOB extends the classic BBOB suite by blending its base functions with random weights, shifts, and per-function instance transformations. The `instance` parameter seeds this generation procedure, so the same instance ID always produces the same function. + +## Quick Start + +1. Install [uv](https://docs.astral.sh/uv/) if you don't have it yet: + +```bash +pip install uv +``` + +No extra setup is needed beyond having `uv` installed. The `ioh` package is resolved automatically. + +> **Note:** This snippet requires **Python 3.10**. The inline metadata enforces this via `requires-python = "==3.10"`. Make sure a Python 3.10 interpreter is available on your system. + +## Usage + +```bash +uv run call_manyaffine.py +``` + +## What the Snippet Does + +The script creates an MA-BBOB problem (instance 1) in 5 dimensions, evaluates it at the origin, and prints the result. You can adjust the behavior by editing these variables in the script: + +- **`instance`** — seeds the random generation of weights, sub-problem instances, and optimum location (default: `1`) +- **`n_variables`** — problem dimensionality (default: `5`; the GECCO competition uses `2` and `5`) +- **`eval_point`** — the point at which the function is evaluated (default: all zeros) + +### Advanced Constructor + +In addition to the simple `(instance, n_variables)` constructor, `ManyAffine` also accepts explicit control over the combination: + +```python +ioh.problem.ManyAffine( + xopt, # list[float] — location of the optimum + weights, # list[float, 24] — weight per BBOB base function + instances, # list[int, 24] — instance ID per base function + n_variables, # int — search space dimensionality + scale_factors, # list[float, 24] — (optional) scaling per base function +) +``` + +### Readable Properties + +| Property | Description | +|---|---| +| `weights` | The 24 combination weights | +| `instances` | The 24 sub-problem instance IDs | +| `scale_factors` | The 24 per-function scaling factors | +| `sub_problems` | The 24 underlying BBOB problem objects | +| `function_values` | Current function values of the sub-problems | + +### Underlying BBOB Base Functions + +| ID | Name | ID | Name | +|----|------|----|------| +| 1 | Sphere | 13 | SharpRidge | +| 2 | Ellipsoid | 14 | DifferentPowers | +| 3 | Rastrigin | 15 | RastriginRotated | +| 4 | BuecheRastrigin | 16 | Weierstrass | +| 5 | LinearSlope | 17 | Schaffers10 | +| 6 | AttractiveSector | 18 | Schaffers1000 | +| 7 | StepEllipsoid | 19 | GriewankRosenbrock | +| 8 | Rosenbrock | 20 | Schwefel | +| 9 | RosenbrockRotated | 21 | Gallagher101 | +| 10 | EllipsoidRotated | 22 | Gallagher21 | +| 11 | Discus | 23 | Katsuura | +| 12 | BentCigar | 24 | LunacekBiRastrigin | + +## Resources + +- [MA-BBOB paper (arXiv:2312.11083)](https://arxiv.org/abs/2312.11083) +- [GECCO 2025 MA-BBOB Competition](https://iohprofiler.github.io/competitions/mabbob25) +- [Example notebook](https://github.com/IOHprofiler/IOHexperimenter/blob/master/example/Competitions/MA-BBOB/Example_MABBOB.ipynb) +- [IOHexperimenter GitHub repository](https://github.com/IOHprofiler/IOHexperimenter) \ No newline at end of file diff --git a/code_snippets/MA-BBOB/call_mabbob.py b/code_snippets/MA-BBOB/call_mabbob.py new file mode 100644 index 0000000..8b292b8 --- /dev/null +++ b/code_snippets/MA-BBOB/call_mabbob.py @@ -0,0 +1,17 @@ +# /// script +# requires-python = "==3.10" +# dependencies = [ +# "ioh", +# ] +# /// + +import ioh + +problem = ioh.problem.ManyAffine(instance = 1, n_variables = 5) + +### evaluation point +dim = problem.meta_data.n_variables +eval_point = [0.0]*dim + +### print function value for eval_point +print(problem(eval_point)) \ No newline at end of file diff --git a/code_snippets/notes.txt b/code_snippets/notes.txt index 665ca00..5bc7fb6 100644 --- a/code_snippets/notes.txt +++ b/code_snippets/notes.txt @@ -5,9 +5,9 @@ Task: write the minimum code snippets to call a function from the package/suite. Currently working on: single-objective + unconstrained Encountered issues: -2) VehicleDynamics is not a problem, only dataset +2) VehicleDynamics is not a problem, only a Zenodo dataset 3) AMVOP: no Github available according to database (haven't double-checked) 4) AutomotiveCrashworthiness: Not integrated. The linked code is not generated aliases of the crashworthiness problems. It's a pipeline that extracts ELA features from generated problems. Problem generator is in a .py file. -5) gbea: Not integrated. Needs repository cloning. -6) GNBG - 404 page not found (gor github repo) -7) \ No newline at end of file +5) GBEA: Not integrated. Needs repository cloning and socket server +6) GNBG - 404 page not found (gor github repo). GNBG-II done instead. +7) KinematicsRobotArm: no problems in the repo (just for transfer learning from loaded datasets) \ No newline at end of file