You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/protein-optimization/contributing/a_new_problem.md
+22-8Lines changed: 22 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,4 +1,4 @@
1
-
# Contributing a new problem to the repository
1
+
# Adding a new problem to the repository
2
2
3
3
This tutorial covers how problems are structured in the repository, and what it takes to add a new one.
4
4
@@ -9,16 +9,18 @@ If you take a look at the source code of `poli`, you will find a folder called `
9
9
```bash
10
10
poli/objective_repository
11
11
├── problem_name # Has the name of the registered problem (exactly)
12
+
│ ├── __init__.py # Necessary, else it doesn't get included in the pip install.
12
13
│ ├── environment.yml # The env. where ./register.py and the problem will run
13
14
│ └── register.py # Definition and registration of the problem
14
15
```
15
16
16
17
You can also have as many other files as you want. Think of the folder `.../problem_name` as a small project as of itself: you can have Python dependencies that will get appended to the path at runtime.
17
18
18
-
**For example:**, let's take a look at the problem folder of `super_mario_bros`
19
+
**For example:** let's take a look at the problem folder of `super_mario_bros`
19
20
20
21
```bash
21
22
├── super_mario_bros
23
+
│ ├── __init__.py
22
24
│ ├── environment.yml
23
25
│ ├── register.py
24
26
│ ├── example.pt # < --
@@ -47,6 +49,11 @@ from poli.core.abstract_black_box import AbstractBlackBox
47
49
from poli.core.abstract_problem_factory import AbstractProblemFactory
48
50
from poli.core.problem_setup_information import ProblemSetupInformation
49
51
52
+
# Files that are in the same folder as
53
+
# register will get added to the
54
+
# PYTHONPATH at runtime.
55
+
from your_local_dependency import...
56
+
50
57
51
58
classYourBlackBox(AbstractBlackBox):
52
59
def__init__(self, L: int= np.inf):
@@ -75,7 +82,12 @@ class YourProblemFactory(AbstractProblemFactory):
If the installation isn't fresh/the only one in your system, you might actually get some registered problems.
72
78
73
-
## Running `poli`in Colab
79
+
## Running `poli`on Colab
74
80
75
-
With a little effort, you can run `poli`in Colab. [Check this example](https://colab.research.google.com/drive/1-IISCebWYfu0QhuCJ11wOag8aKOiPtls).
81
+
With a little effort, you can run `poli`on Colab. [Check this example](https://colab.research.google.com/drive/1-IISCebWYfu0QhuCJ11wOag8aKOiPtls).
76
82
77
83
78
84
## Your first `poli` script
@@ -100,6 +106,12 @@ for _ in range(5):
100
106
101
107
If we run this script, `poli` will ask us to confirm that we want to register/install `"white_noise"` as an objective function (you can deactivate this confirmation step by passing the flag `force_register=True` to `.create`). Afterwards, it will print 5 evaluations of the objective function on the same input.
102
108
109
+
:::{warning}
110
+
111
+
In the registration process, `poli` creates a `conda` environment, and **executes a shell script**. Be wary of objective functions you find in the wild.
112
+
113
+
:::
114
+
103
115
## Conclusion
104
116
105
117
This tutorial showed you how to install `poli`, and register `white_noise`, which is available inside `poli` itself.
Copy file name to clipboardExpand all lines: readme.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,7 +8,7 @@ This repository contains documentation on how protein optimization is currently
8
8
The folder `./docs/protein-optimization` is a [Jupyter Book](https://jupyterbook.org/en/stable/intro.html). To build it, create a new environment (`python>=3.9`) and install the requirements:
0 commit comments