# The Robot Arm Enigma

*English translation by SOTA – AI Community of the Portuguese original, published with the permission of the ONIA Brazil committee. Organisers who would like this translation removed can email team@sota-ai.org.*

## Scenario

A high-tech factory recently lost its network connection to its newest and most advanced autonomous robotic arm. The robot continued operating and carrying out tasks on the assembly line, but the central server could no longer record high-level logs of the completed activities.

The engineering team recovered only raw text files containing low-level telemetry from the robot's joints. The data include sensor readings at each time point, such as:

- the angular position of each joint;
- the movement velocity; and
- the effort (torque or load) applied to the joints.

## Your goal

As the data and artificial intelligence specialist called in to solve the problem, analyze the telemetry history and reconstruct the exact sequence of tasks that the robot performed while disconnected.

The factory floor is unpredictable. The robot may have experienced anomalies or malfunctions, such as minor collisions, incorrect trajectories, or inappropriate loads on the joints. Your model must classify the normal tasks and identify anomalous events.

## Available data

The engineering team provides two training files:

- `task_1.csv`: telemetry recorded while the robot performed Task 1;
- `task_2.csv`: telemetry recorded while the robot performed Task 2.

Each file contains multiple runs of its task, concatenated one after another. The final evaluation dataset has the same structure: a continuous sensor stream containing Task 1 runs, Task 2 runs, and possibly anomalous events.

## Submission

Create a folder named `ENTREGA_FINAL` in your user directory containing these four artifacts:

1. a trained machine-learning model;
2. the Python source script used for inference;
3. a SLURM script that runs the Python script as a job; and
4. a brief PDF report describing the approaches tried and the decisions made in arriving at the solution.

### Python code requirements

- The script must contain a global variable named `INPUT_PATH`.
- During evaluation, the committee changes this variable to point to the final test set, which holds the data from the period when the robot lost its connection.
- The code must read the data from `INPUT_PATH`, process it with the model and write an output file in CSV format.

## Output format

Produce a CSV file with no header and one number per line. Each number identifies one event:

- `1` for Task 1;
- `2` for Task 2; and
- `0` for an anomaly.

The labels must be in strict chronological order. For example, if the robot performed Task 2 twice, Task 1 once, Task 2 once, and then an anomaly, the output is:

```text
2
2
1
2
0
```

## Evaluation

Submissions are evaluated using Levenshtein distance. This measures the minimum number of insertions, deletions, and substitutions needed to turn the predicted event sequence into the reference sequence. A lower distance means a more accurate reconstruction. Incorrect task order, missed anomalies, or invented events increase the distance.
