Skip to content

Commit d4ebf75

Browse files
committed
Adds continuous objectives to the documentation
1 parent ad2051f commit d4ebf75

File tree

5 files changed

+82
-0
lines changed

5 files changed

+82
-0
lines changed

docs/protein-optimization/_toc.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ parts:
2323
- file: using_poli/objective_repository/all_objectives.md
2424
- file: using_poli/objective_repository/white_noise.md
2525
- file: using_poli/objective_repository/aloha.md
26+
- file: using_poli/objective_repository/toy_continuous_problems.md
2627
- file: using_poli/objective_repository/rdkit_qed.md
2728
- file: using_poli/objective_repository/rdkit_logp.md
2829
- file: using_poli/objective_repository/dockstring.md

docs/protein-optimization/index.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,12 @@ White noise drawn from a unit Gaussian
2929
A toy example about optimizing 5-letter words to spell "ALOHA"
3030
:::
3131

32+
:::{grid-item-card} Toy continuous problems
33+
:link: ./using_poli/objective_repository/toy_continuous_problems.html
34+
:columns: 6
35+
The usual benchmark functions for continuous optimization (e.g. `easom`, or `ackley_function_01`)
36+
:::
37+
3238
::::
3339

3440
### Small molecules

docs/protein-optimization/references.bib

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,3 +70,11 @@ @article{GarciaOrtegon:dockstring:2022
7070
language = {en}
7171
}
7272

73+
@MISC{Al-Roomi:continuous_objective_benchmarks:2015,
74+
author = {Ali R. Al-Roomi},
75+
title = {{Unconstrained Single-Objective Benchmark Functions Repository}},
76+
year = {2015},
77+
address = {Halifax, Nova Scotia, Canada},
78+
institution = {Dalhousie University, Electrical and Computer Engineering},
79+
url = {https://www.al-roomi.org/benchmarks/unconstrained}
80+
}

docs/protein-optimization/using_poli/objective_repository/all_objectives.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,12 @@ White noise drawn from a unit Gaussian
2020
A toy example about optimizing 5-letter words to spell "ALOHA"
2121
:::
2222

23+
:::{grid-item-card} Toy continuous problems
24+
:link: ./toy_continuous_problems.html
25+
:columns: 6
26+
The usual benchmark functions for continuous optimization (e.g. `easom`, or `ackley_function_01`)
27+
:::
28+
2329
::::
2430

2531
## Small molecules
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
# Toy continuous objective functions
2+
3+
![Type of objective function: continuous](https://img.shields.io/badge/Input_type-continuous-red)
4+
![Environment to run this objective function: poli base](https://img.shields.io/badge/Environment-poli____base-teal
5+
)
6+
7+
## About
8+
9+
These are the usual objective function people use to test continuous optimizers {cite:p}`Al-Roomi:continuous_objective_benchmarks:2015`. In particular, we include:
10+
11+
- For $n$-dimensional optimization:
12+
- [`ackley_function_01`](https://www.al-roomi.org/benchmarks/unconstrained/n-dimensions/227-ackley-s-function-no-1-or-ackley-s-path-function),
13+
- [`alpine_01`](https://www.al-roomi.org/benchmarks/unconstrained/n-dimensions/162-alpine-function-no-1),
14+
- [`alpine_02`](https://www.al-roomi.org/benchmarks/unconstrained/n-dimensions/163-alpine-function-no-2),
15+
- [`bent_cigar`](https://www.al-roomi.org/benchmarks/unconstrained/n-dimensions/164-bent-cigar-function),
16+
- [`brown`](https://www.al-roomi.org/benchmarks/unconstrained/n-dimensions/241-brown-s-function),
17+
- [`chung_reynolds`](https://www.al-roomi.org/benchmarks/unconstrained/n-dimensions/165-chung-reynolds-function),
18+
- [`cosine_mixture`](https://www.al-roomi.org/benchmarks/unconstrained/n-dimensions/166-cosine-mixture-function),
19+
- [`deb_01`](https://www.al-roomi.org/benchmarks/unconstrained/n-dimensions/231-deb-s-function-no-01),
20+
- [`deb_02`](https://www.al-roomi.org/benchmarks/unconstrained/n-dimensions/232-deb-s-function-no-02),
21+
- [`deflected_corrugated_spring`](https://www.al-roomi.org/benchmarks/unconstrained/n-dimensions/238-deflected-corrugated-spring-function),
22+
- `shifted_sphere` ($\sum_{d=1}^n (x_d - 1)^2$),
23+
- [`egg_holder`](https://www.al-roomi.org/benchmarks/unconstrained/n-dimensions/187-egg-holder-function),
24+
- For specific dimensions:
25+
- [`easom`](https://www.al-roomi.org/benchmarks/unconstrained/2-dimensions/22-easom-s-function), which is only available in 2 dimensions.
26+
- [`cross_in_tray`](https://www.al-roomi.org/benchmarks/unconstrained/2-dimensions/44-cross-in-tray-function), which is only available in 2 dimensions.
27+
28+
:::{warning}
29+
30+
Some of the signs might be flipped, since we are usually interested in maximization. Some of the constants inside might also be changed for scale. [For the definitive version we used, check the implementation](https://github.com/MachineLearningLifeScience/poli/blob/dev/src/poli/objective_repository/toy_continuous_problem/definitions.py).
31+
32+
:::
33+
34+
## Prerequisites
35+
36+
None, this function should always run out-of-the-box
37+
38+
## How to run
39+
40+
```python
41+
import numpy as np
42+
from poli import objective_factory
43+
44+
# Choose a function name and number of dimensions
45+
function_name = "ackley_function_01"
46+
n_dimensions = 2 # it's 2 by default.
47+
48+
# How to create
49+
problem_info, f, x0, y0, run_info = objective_factory.create(
50+
name="toy_continuous_problem",
51+
function_name=function_name,
52+
n_dimensions=n_dimensions, # For some, this can be arbitrary.
53+
)
54+
55+
56+
# Example input:
57+
x = np.array([[0.0, 0.0]]) # must be of shape [b, n_dimensions], in this case [1, 2].
58+
59+
# Querying:
60+
print(f(x)) # Should be [[0.0]] in this example
61+
```

0 commit comments

Comments
 (0)