# Directed Molecule Design

*English translation by SOTA – AI Community of the Russian original. Organisers who would like this translation removed can email sota.ai.community@gmail.com.*

*Source: the 2023/24 task collection of the National Technology Olympiad (NTO), "Artificial Intelligence" profile, Stage 2, pp. 89–90: [original PDF](https://ntcontest.ru/upload/problembooks-2324/13_%D0%98%D1%81%D0%BA%D1%83%D1%81%D1%81%D1%82%D0%B2%D0%B5%D0%BD%D0%BD%D1%8B%D0%B9%20%D0%B8%D0%BD%D1%82%D0%B5%D0%BB%D0%BB%D0%B5%D0%BA%D1%82.pdf#page=89).*

## Team task

### Task IV.2.1. (100 points)

*Topics: evolutionary algorithms, molecular structure representation methods, generative models, interpretation of molecular data, teamwork.*

#### Problem statement

Participants are required to develop an algorithm for the directed search for molecules with specified properties. Following the practice of scientific research, the quality of generation will be assessed on a representative sample rather than on individual compounds. Diversity, validity, uniqueness and conformity to a specified range of a physicochemical property are the target indicators for the set of new molecules, and participants should aim to maximise them.

#### Input format

A file with the CSV extension (example: <https://disk.yandex.ru/d/L---JfJV1EOAxQ>) containing a list of `SMILES` strings (one per line): the set of molecules that serves as the starting sample for generating new compounds.

#### Output format

A file with the `CSV` extension containing a list of `SMILES` strings (one per line): the result produced by the participants' solution, that is, a set of molecules that meet the specified criteria of the task.

*Example of input data (file fragment)*

```
ClC(Cl)(Cl)C(Cl)(Cl)Cl
Cc1c(Cl)cccc1Cl
CCCCCI
```

*Program output (file fragment)*

```
CC(CSC(=O)c1ccccc1)C(=O)N1CC(Sc2ccccc2)CC1C(=O)O
CCC/C(=N\OCC)C1C(=O)CC2(CCC(C)CC2)OC1=O
COc1ccc(C2Cc3cc(OC(F)F)ccc3N(CCN(C)C)C(=O)C2OC(C)=O)cc1
```

#### Assessment criteria

The quality of a solution will be assessed on the basis of a composite value, which is the product of the following four metrics:

- The fraction of molecules in the generated sample for which the value of the target property (lipophilicity) lies within the specified range ($2.0 < \log P < 3.0$). This value will be estimated with a model that is not available to participants.
- Validity (`validity`). The fraction of `SMILES` strings in the generated sample that correspond to chemically valid molecules.
- Novelty (`novelty`). The fraction of `SMILES` strings in the generated sample that are not in the initial sample provided to participants.
- Diversity of the sample (`internal diversity`).

#### Solution

Participants have access to a baseline solution from the organisers. The intended pipeline includes:

- The file `generate.py` must contain the function `search_step()`, which takes a list of `SMILES` strings as input and returns a list of the same length that differs from the input list in at most one element.
- A model file for estimating lipophilicity. One of the components of the metric involves estimating this parameter. Participants may use their own model trained in the individual stage, or any other model.

The starting sample of molecules contained in the file `check.csv` (<https://disk.yandex.ru/d/L---JfJV1EOAxQ>) is updated many times by calling the function `search_step()`. The final sample is assessed in terms of the metrics described above.

An example solution (with comments) is available at: <https://disk.yandex.ru/d/_-AqM2pRFCIs8Q>.
