<!-- Source: https://docs.biosimulant.com/how-to/library/parameter-sweeps -->

# How to Run Parameter Sweeps

For the current kernel, the safest local sweep pattern is to build a fresh world per parameter point. If you only need to reset simulation state, snapshots are also available.

## Fresh-world sweep

```python

from src.linear_growth import LinearGrowth

def build_world(rate: float):
    world = biosim.BioWorld(communication_step=1.0)
    module = LinearGrowth(rate=rate, initial_value=1.0)
    world.add_biomodule("growth", module)
    return world, module

results = []
for rate in [0.05, 0.1, 0.2, 0.4]:
    world, module = build_world(rate)
    world.run(duration=100.0)
    results.append({"rate": rate, "final_state": module.snapshot()})
```

## Snapshot-based reruns

Use this when the module parameters stay fixed and only the evolving state needs to be reset:

```python
world, module = build_world(0.1)
world.setup()
baseline = world.snapshot()

for _ in range(3):
    world.restore(baseline)
    world.run(duration=100.0)
```

## Desktop CLI JSON payloads

```json
{"duration": 100.0, "communication_step": 1.0}
```

**Info:**

  Avoid older examples that rely on a kernel-level reset method between runs. The current kernel expects snapshots or fresh worlds instead.

## Next steps

- [Use a BioWorld](/how-to/library/use-bioworld)
