Initialization

Before the main optimization loop begins, the optimizer needs starting positions to evaluate. The choice of initialization strategy affects how quickly the optimizer finds good solutions: starting from well-distributed points gives the algorithm a broad view of the search landscape, while starting from known good positions lets it refine solutions immediately. GFO offers four initialization strategies that can be combined freely.

Grid

"grid": 10

Systematic, evenly spaced coverage across the search space.

Random

"random": 20

Diverse starting points sampled uniformly at random.

Vertices

"vertices": 8

Corners and edges of the search space boundaries.

Warm Start

"warm_start": [...]

Known good positions from prior knowledge or previous runs.

Default Initialization

By default, GFO uses a mix of strategies:

initialize = {
    "grid": 4,      # 4 grid-spaced positions
    "random": 2,    # 2 random positions
    "vertices": 4,  # 4 corner/edge positions
}

This provides a balance of systematic and random coverage.

Initialization Options

Grid initialization:

Generates positions on a regular grid across the search space.

initialize = {"grid": 10}  # 10 grid positions

Random initialization:

Generates random positions.

initialize = {"random": 20}  # 20 random positions

Vertices initialization:

Generates positions at corners and edges of the search space.

initialize = {"vertices": 8}  # 8 vertex positions

Warm start initialization:

Start from specific known positions.

initialize = {
    "warm_start": [
        {"x": 0.5, "y": 1.0},   # First starting point
        {"x": -0.5, "y": 2.0},  # Second starting point
    ]
}

Combining Strategies

Mix multiple strategies:

initialize = {
    "grid": 4,
    "random": 4,
    "vertices": 2,
    "warm_start": [
        {"x": 0.0, "y": 0.0},  # Known good starting point
    ],
}

Strategy Selection

Use grid when:

  • You want systematic coverage

  • The search space is small

  • You don’t have prior knowledge

Use random when:

  • The search space is large

  • You want diverse starting points

  • Using population-based algorithms

Use vertices when:

  • Optima might be at boundaries

  • You want to test extreme values

Use warm_start when:

  • You have prior knowledge of good regions

  • Continuing from a previous optimization

  • Fine-tuning around known solutions

Examples

Exploration-focused:

# Many diverse starting points
opt = HillClimbingOptimizer(
    search_space,
    initialize={"random": 50}
)

Exploitation-focused:

# Start from known good region
opt = HillClimbingOptimizer(
    search_space,
    initialize={
        "warm_start": [previous_best_params],
        "random": 2,  # Plus some exploration
    }
)

Population-based:

# Ensure diverse initial population
opt = ParticleSwarmOptimizer(
    search_space,
    population=20,
    initialize={
        "grid": 5,
        "random": 10,
        "vertices": 5,
    }
)

Notes

  • Initial positions are evaluated first before the main optimization loop

  • For population-based algorithms, initial positions are distributed across individuals

  • Constraints are respected during initialization (invalid positions are rejected)