|
| 1 | +<!-- TODO: |
| 2 | +Complete EC module section |
| 3 | +Fix image not working |
| 4 | +Hyperlink to gui in starting guide |
| 5 | +Running experiments with GUI |
| 6 | +--> |
| 7 | +# Evolutionary Computing Course Documentation |
| 8 | + |
| 9 | +This section contains information more directed torwards the use of ARIEL for the Evolutionary Computing course. Here you can find installation information, basic functions needed for the assignments, and tips on how some things are done using ARIEL. |
| 10 | + |
| 11 | +## Run the example files |
| 12 | +After following the normal ARIEL installation guide you can come here for the following steps. We highly recommend you use a virtual environment alongside uv, this will help significantly with requirement conflicts. |
| 13 | + |
| 14 | +### uv version |
| 15 | +Things are a bit simpler if you are using uv. In your terminal simply run the following commands one by one: |
| 16 | +```bash |
| 17 | +uv venv |
| 18 | +uv sync |
| 19 | +uv run examples/0_render_single_frame.py |
| 20 | +``` |
| 21 | + |
| 22 | +These commands will automatically create the virtual environment, activate it, install all the requirements with their respecitve versions to avoid any conflicts and then run the example file. After you create the venv you can activate it again like you would with a normal one using: |
| 23 | +```bash |
| 24 | +Activate venv: |
| 25 | +./.venv/Scripts/activate |
| 26 | + |
| 27 | +Deactivate venv: |
| 28 | +./.venv/Scripts/deactivate |
| 29 | +``` |
| 30 | + |
| 31 | +### Pip version |
| 32 | +If you are using pip then you can create a normal virtual environment with: |
| 33 | +```bash |
| 34 | +python -m venv C:/path/to/new/virtual/environment |
| 35 | +``` |
| 36 | +or create it with the IDE you are using. For example, in VS Code just press `ctrl+shift+p` and select `Python: Create Environment`. Then run one of the example files in the examples module. For example `python examples/0_render_single_frame.py`, this file starts a simulation and takes a screenshot of a single frame of a red cube. |
| 37 | + |
| 38 | +It should look something like this: |
| 39 | + |
| 40 | + |
| 41 | +<!-- <p align="center"> |
| 42 | + <img src="../resources/example_image.png" width="1000"> |
| 43 | +</p> --> |
| 44 | + |
| 45 | + |
| 46 | +## Basic ARIEL Functions |
| 47 | +In this section we will present some of the basic functionalities of ARIEL. |
| 48 | + |
| 49 | +### EC Module |
| 50 | +To make implementation easier, ARIEL has many built in evolutionary operators (much like [DEAP](https://deap.readthedocs.io/en/master/)) for you to use in your work. This happens via the EC module. |
| 51 | + |
| 52 | +The functions of this module can be found under: |
| 53 | +```python |
| 54 | +import ariel.ec as ec |
| 55 | +``` |
| 56 | + |
| 57 | +## Starting Guide |
| 58 | +The starting guide intends to help you start your first ARIEL experiment. This can be done in two ways. By running the experiments manually from a python file or using the GUI [`HYPERLINK TO GUI PAGE ON THE DOCS`]. |
| 59 | + |
| 60 | +### Run Experiments Manually |
| 61 | +To run an experiment manually you just need to define all the necessary parameters and run the file. Here is an example: |
| 62 | + |
| 63 | +```python |
| 64 | +# Third-party libraries |
| 65 | +import mujoco |
| 66 | + |
| 67 | +# Local libraries |
| 68 | +from ariel.environments.simple_flat_world import SimpleFlatWorld |
| 69 | +from ariel.utils.renderers import single_frame_renderer |
| 70 | + |
| 71 | + |
| 72 | +def main() -> None: |
| 73 | + """Entry point.""" |
| 74 | + # World |
| 75 | + world = SimpleFlatWorld() |
| 76 | + |
| 77 | + # Object |
| 78 | + body = mujoco.MjSpec() |
| 79 | + cube = body.worldbody.add_body(name="cube") |
| 80 | + cube.add_geom( |
| 81 | + type=mujoco.mjtGeom.mjGEOM_BOX, |
| 82 | + size=(0.1, 0.1, 0.1), |
| 83 | + rgba=(0.8, 0.2, 0.2, 1.0), |
| 84 | + ) |
| 85 | + |
| 86 | + # Add object to world |
| 87 | + world.spawn(body) |
| 88 | + |
| 89 | + # Generate the model and data |
| 90 | + model: mujoco.MjModel = world.spec.compile() |
| 91 | + data = mujoco.MjData(model) |
| 92 | + |
| 93 | + # Render a single frame |
| 94 | + single_frame_renderer(model, data, steps=10_000) |
| 95 | +``` |
| 96 | + |
| 97 | +### Run Experiments Using the GUI |
| 98 | +For a more detailed explanation on how the GUI works and how to use it check out the {doc}`GUI` |
| 99 | + |
| 100 | +INSERT SCREENSHOT OF GUI |
| 101 | + |
| 102 | +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA WHAT IS A GUI!!!!! |
0 commit comments