Skip to content
This repository was archived by the owner on Jan 5, 2026. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 12 additions & 54 deletions docs/getting-started/tutorial_0.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,47 +44,29 @@ badger -g

You should be able to see the main GUI like below:

![Badger main GUI](/img/gui/main.png)
![Badger GUI](/img/gui/blank.png)

## Run your first optimization

Before you can run the optimization, you need to create the routine. Click the plus button to the right of the search bar, you'll be navigated to the routine editor:
Before you can run the optimization, you need to set up the environment, VOCS, and algorithm. For your first routine, let's select the `expected_improvement` generator[^generator] in the **Algorithm** section. In the **Environment + VOCS** section, select the `sphere_2d` environment that's shipped with Badger.

![Badger routine editor](/img/getting-started/create_1st_routine.png)

Where you can change the routine name and description in the **Metadata** section, as shown above. For your first routine, let's select `expected_improvement` generator[^generator] in the **Algorithm** section. In the **Environment + VOCS** section, select the sphere_2d environment that shipped with Badger.

Now we can shape our optimization problem by configuring the VOCS:

![Configure the VOCS](/img/getting-started/configure_vocs.png)

To archive the above configuration, simply click the blank cell on top of the checkboxes in the variable table to include all the two variables in the routine, then click the *Add Current* button in the **Initial Points** section to add the current values of the variables as the initial points where the optimization starts from. You of course can add more initial points as you wish but for now let's keep it simple -- we only start the run from the current values. Finally check the `f` observable shown in the objectives table and change the rule (direction of the optimization) to `MAXIMIZE`, this means we'll maximize `f` instead of minimize it (which is the default setting).

Now click the *Save* button and we'll be landing back on the main GUI where you can see the monitors, while you'll notice the routine we just created is up there in the routine list, selected and ready to run!

![Ready to run](/img/getting-started/ready_to_go.png)
Now we can shape our optimization problem by configuring the VOCS. Click the blank cell on top of the checkboxes in the variable table to include all the variables. If automatic mode is enabled, the **Initial Points** table should populate after this action. If it's not enabled, click the *Add Current* button in the **Initial Points** section to add the current values of the variables as the initial points where the optimization starts from. You of course can add more initial points as you wish but for now let's keep it simple -- we only start the run from the current values. Finally check the `f` observable shown in the objectives table and change the rule (direction of the optimization) to `MAXIMIZE`, this means we'll maximize `f` instead of minimize it (which is the default setting).

Now go ahead and click the green *Run* button, feel free to pause/resume the run anytime by clicking the button to the left of the run button, and click the run button (should be turned red now) again to terminate the run.

Congrats! You just run your very first routine in Badger!
![Badger GUI after the first run](/img/gui/run_1.png)

![First run](/img/getting-started/first_run.png)
Congrats! You just run your very first routine in Badger!

## Customize the environment

Now it's time to do some more serious stuff -- such as performing optimization on your own optimization problem. In order to do that, we need to create our own custom environment (and optionally, the corresponding interface).

First let's point Badger to a new folder where we would like to store our custom plugins. In terminal, do:

```shell
badger config BADGER_PLUGIN_ROOT
```
First let's point Badger to a new folder where we would like to store our custom plugins, if necessary. At the bottom right of the Badger GUI window is a settings cog. When clicked it will open a popup to configure the Badger plugin root, logbook root, and archive root. The default folders should be reasonable, but these can be changed to suit your needs, if the defaults are difficult to access.

Follow the CLI guide and set your root for the plugins.
![Badger GUI settings popup](/img/gui/settings.png)

Once that done, put a folder named `sphere_3d` into the environments dir under your plugins root.

Then create the following files inside that `sphere_3d` folder:
Create a folder named `sphere_3d` in the environments folder beneath the plugin root. Then create the following files inside that `sphere_3d` folder:

- The main python script:

Expand Down Expand Up @@ -157,39 +139,15 @@ dependencies:
## Usage
```

Now relaunch Badger GUI, you should be able the see the new custom environment we just created in the dropdown menu in the environment selector:



## Configure important Badger settings

You can run the following command to see which settings are configurable in Badger:

```shell
badger config
```

For example you'd like to change the dir where all the databases are stored, you can do:

```shell
badger config BADGER_DB_ROOT
```

Badger would guide you through the setting.
Now relaunch Badger GUI, you should be able the see the new custom environment we just created in the dropdown menu in the environment selector.

## Run your second optimization

Now it's time to create our new routine with the newly created `sphere_3d` environment. This time we don't have to start from the scratch, instead, we'll base on our first routine, modify the parts as needed, and save the changes as a new routine.

We start by selecting the first routine, then click the *routine editor* tab. Edit the name, description, and the VOCS:

![Edit the first routine](/img/getting-started/configure_vocs_3d.png)

Note that we need to select the `sphere_3d` environment from the env selector and change the variable ranges in the new routine according to our target problem. We'll also change the initial point so that the optimization won't start with the best solution. Since our second problem is a minimization one, remember to change the direction of `f` to *MINIMIZE*. Once configuration is done, click *Save* to save it as a new routine, `my second routine`.
Now it's time to create our new routine with the newly created `sphere_3d` environment. This follows the same process as the earlier example. Select the `sphere_3d` environment and select the same algorithm as before. For this example, we'll change the variable ranges according to our target problem. We'll also change the initial point so that the optimization won't start with the best solution. Since our second problem is a minimization one, remember to change the direction of `f` to *MINIMIZE*.

Now we can just run it as we do for `my first routine`, stop whenever you feel right, you should see some optimization curves like this:
Press *Run* and stop whenever you feel right, you should see some optimization curves like this:

![The 2nd run](/img/getting-started/second_run.png)
![Badger GUI after the second run](/img/gui/run_2.png)

Congrats! You have accomplished the Badger GUI tutorial! Hope that by this point you already have some feelings about what Badger is and how Badger works. Now you can continue and do the [CLI tutorial](tutorial_1) to get to know the other side of Badger, or you can jump directly to the [guides](../guides/create-a-plugin#create-an-environment-plugin) to adapt Badger to your own optimization problem, good luck!

Expand Down
6 changes: 6 additions & 0 deletions docs/getting-started/tutorial_1.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@ Make sure you have Badger [installed and setup](./installation).

:::

:::caution

Badger's CLI mode is unsupported in this release. It may be supported again in the future.

:::

Let's discover **Badger in less than 5 minutes**. All of the following commands are assumed to be run in a terminal (Mac, Windows, and Linux are supported).

First let's verify that Badger has been installed and configured correctly:
Expand Down
2 changes: 1 addition & 1 deletion docs/guides/api-usage.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
sidebar_position: 1
sidebar_position: 3
---

# API Usage
Expand Down
6 changes: 6 additions & 0 deletions docs/guides/cli-usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ sidebar_position: 2

# CLI Usage

:::caution

Badger's CLI mode is unsupported in this release. It may be supported again in the future.

:::

For all the implemented and planned CLI usage, please refer to [these slides](https://docs.google.com/presentation/d/1APlLgaRik2VPGL7FuxEUmwHvx6egTeIRaxBKGS1TnsE/edit#slide=id.ge68b2a5657_0_5). We'll highlight several common CLI use cases of Badger in the following sections.

## Get help
Expand Down
4 changes: 2 additions & 2 deletions docs/guides/color-by-environment.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
sidebar_position: 6
sidebar_position: 5
---

# Color by environment
Expand Down Expand Up @@ -37,4 +37,4 @@ sphere_3d:

Here is what the GUI then looks like

![Color by environment](/img/guides/color-by-environment.png)
![Color by environment](/img/guides/color-by-environment.png)
2 changes: 1 addition & 1 deletion docs/guides/create-a-plugin.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
sidebar_position: 4
---

# Create a plugin
# Create a Plugin

Plugins have two types:

Expand Down
Loading