Skip to content

Configuration: TOML Support for Local Search #29

@lv416e

Description

@lv416e

Current State

Local search operators in MAB scheduler must be hardcoded:

UCBLocalSearchSelector<TSP> selector(3, 2.0, rng);
selector.add_operator(LinKernighan(20, 5), "LK");
selector.add_operator(TwoOpt(), "2opt");

This means researchers must recompile to change operators or parameters.

Goal

Enable configuration via TOML:

[local_search]
scheduler = "UCB"
exploration_rate = 2.0

[[local_search.operators]]
type = "LinKernighan"
k_nearest = 20
max_depth = 5

[[local_search.operators]]
type = "TwoOpt"

This enables:

  • Parameter tuning without recompilation
  • Reproducible experiment configurations
  • Template-based configs (e.g., configs/memetic_eax_lk.toml)

Solution

Implement runtime operator selection using std::variant:

using LocalSearchVariant = std::variant<LinKernighan, TwoOpt, Random2Opt>;

// Factory creates operators from config
LocalSearchVariant create_from_config(const std::string& type, const Config& params);

Why std::variant: Zero runtime overhead, type-safe, covers research use cases.

Tasks

  • Add std::variant based operator factory
  • Extend TOML schema for local search config
  • Update AdaptiveLocalSearchSelector to accept variants
  • Create example config templates (configs/memetic_*.toml)

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions