Skip to content

Refactor ego module internals#384

Merged
relf merged 5 commits intomasterfrom
refactor-ego
Feb 6, 2026
Merged

Refactor ego module internals#384
relf merged 5 commits intomasterfrom
refactor-ego

Conversation

@relf
Copy link
Owner

@relf relf commented Feb 6, 2026

This pull request introduces several improvements to the EGO optimizer codebase, focusing on enhancing configurability, code clarity, and maintainability. The most significant change is the introduction of a new RuntimeFlags struct, which centralizes runtime behavior configuration and replaces scattered environment variable checks. Additionally, several modules now have improved documentation, and there are refactorings to ensure state fields are accessed consistently through their logical groupings.

Major improvements:

1. Configurability and Runtime Behavior

  • Introduced the RuntimeFlags struct in egor_config.rs, allowing programmatic control over runtime behaviors (such as logging, use of specific optimization features, and data recording) that were previously controlled via environment variables. The struct provides builder-style methods and maintains backward compatibility by reading environment variables in its default implementation.
  • Added runtime_flags as a field to ValidEgorConfig and provided methods in EgorConfig to configure these flags, either via a closure or by direct assignment. [1] [2]

2. Refactoring State Access

  • Refactored code throughout egor.rs and egor_solver.rs to access fields such as data, theta_inits, clusterings, and x_fail through the appropriate sub-structs (e.g., state.surrogate or state.doe) instead of directly on state. This makes the codebase more modular and easier to maintain. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11]

3. Documentation and Code Clarity

  • Added or improved module-level documentation for optimizers/mod.rs, optimizers/optimizer.rs, and solver/egor_config.rs, explaining architecture, available features, and usage examples. [1] [2] [3]

4. Consistent Use of Runtime Flags

  • Replaced all direct environment variable checks in the solver logic with lookups against the new runtime_flags field, ensuring all runtime behavior is controlled in a centralized and testable manner. [1] [2] [3]

These changes collectively improve the flexibility, maintainability, and clarity of the EGO optimizer codebase, making it easier to configure and extend in the future.

@relf relf changed the title Refactor ego Refactor ego module internals Feb 6, 2026
@relf relf marked this pull request as ready for review February 6, 2026 20:42
@relf relf merged commit 4ce0978 into master Feb 6, 2026
19 checks passed
@relf relf deleted the refactor-ego branch February 6, 2026 20:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant