Skip to content

Refactor ego strategies#385

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

Refactor ego strategies#385
relf merged 6 commits intomasterfrom
refactor-ego-strategy

Conversation

@relf
Copy link
Owner

@relf relf commented Feb 6, 2026

This pull request introduces a major refactor to the EGO optimizer configuration and internal logic, focusing on extensibility and code clarity. The most significant changes are the replacement of hardcoded TREGO and CoEGO configurations with flexible strategy patterns for both iteration (e.g., standard EGO vs. TREGO) and variable activity (e.g., full vs. cooperative/CoEGO). This enables cleaner code, easier customization, and future extensibility. Additionally, related documentation and examples have been updated to reflect these changes.

Key changes:

1. Strategy Pattern for Optimizer Configuration

  • Introduced IterationStrategy (with StandardEgoStrategy, TregoStrategy) and ActivityStrategy (with FullActivity, CooperativeActivity) traits, replacing the previous TregoConfig and CoegoConfig structs. Configuration now uses boxed trait objects, providing extensibility and cleaner separation of concerns. [1] [2] [3] [4] [5] [6]

  • Updated EgorConfig and ValidEgorConfig to use these new strategies, removing direct fields for TREGO and CoEGO configuration. [1] [2]

2. Cooperative Activity (CoEGO) Refactor

  • Moved the logic for generating variable activity groups for CoEGO into the new CooperativeActivity strategy, removing the previous methods from the solver. This centralizes and clarifies how variable grouping is handled. [1] [2] [3] [4]

  • Adjusted tests to use the new CooperativeActivity directly, simplifying test code and improving clarity. [1] [2]

3. Documentation and Example Updates

  • Updated module-level documentation and code examples to reflect the new strategy-based configuration, showing how to use TregoStrategy and CooperativeActivity in practice. [1] [2] [3]

4. API Simplification and Cleanup

  • Removed obsolete methods and configuration fields for TREGO and CoEGO from the codebase, as their responsibilities are now handled by the new strategy objects. [1] [2] [3] [4]

5. Minor Usability Improvements

  • Simplified the activation of TREGO in the example runner (run_egor) to use the new .trego(true) method, aligning with the updated API.

These changes modernize the configuration and internal logic of the EGO optimizer, making it more modular, maintainable, and user-friendly.

@relf relf marked this pull request as ready for review February 7, 2026 10:20
@relf relf merged commit c44acf0 into master Feb 7, 2026
19 checks passed
@relf relf deleted the refactor-ego-strategy branch February 7, 2026 10:22
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