Fix/demo problems#437
Merged
Merged
Conversation
## Description This PR synchronizes `main` with `dev`, introducing a major refactor for PeTTa interpreter compatibility and structural alignment with OpenCog Classic MOSES. ### Key Highlights - **Performance**: Achieved a ~10x speedup by removing redundant `eval` calls, implementing caching for `scoreTree` and `getCscore`, and migrating to the PeTTa interpreter. - **OpenCog Classic Alignment**: Aligned `BuildLogical` complexity, tree reconstruction (`getCandidateRec`), and reduction rules (`0subsume`) with classic C++ MOSES behavior. - **Game Policy Domain**: Extended the framework to support game strategy evolution (e.g., Tic-Tac-Toe) via a new Strategy Subtree Knob (SSK) system and `PRIORITIZED-OR` operators. - **Baseline Players**: Added Minimax and Alpha-Beta Pruned Minimax players with immediate win detection. - **CI/CD**: Established a Dockerized testing environment to ensure stable, persistent validation with PeTTa. ## Motivation and Context These updates are essential for achieving architectural parity with OpenCog Classic, resolving performance bottlenecks for larger datasets (like parity-4), and enabling MOSES to evolve complex game strategies. ## How Has This Been Tested? - **Performance Benchmarks**: Verified execution time reduction from ~20 mins to ~2 mins on core tasks. - **Functional Tests**: Validated both Boolean and Game domain workflows using the new automated CI suite. - **Domain Validation**: Confirmed correct strategy evolution for Tic-Tac-Toe and parity/multiplexer results. ## Types of changes - [x] Bug fix - [x] New feature - [x] Breaking change (due to PeTTa migration and structural refactors) ## Checklist: - [x] Code follows project style. - [x] Added tests for new features. - [x] All CI tests passed.
This resulted in almost double the performance of the algorithm. When tested with the majoirty3 problem in 2 generations, the running time reduced almost by half.
- Replaced every recursive List functions with the built in constructor of expressions cons and () instead. This resulted in almost double the running speed after testing
- Before the optimization the algorithm used to take around 53 seconds, close to a minute but after it only takes around 18 seconds. This is a huge improvement
- Removed the previous Map, MultiMap and OS with built in expressions and their helpers whenever available and recurision over expressions when not. This gained additional two second performance improvement when tested against 2 generations of majority3 problem with no feature selection
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This branch updates the MOSES MeTTa codebase to use PeTTa-friendly raw expression structures (
cons/()) in place of several older collection and list helper patterns, fixes the demo-problems flow, and restores the strict test suite after the migration. These changes resulted an overall 2x performance increase as compared to the latest PeTTa changes and 4x increase as to what things were when testing it against the v1.0.0 PeTTa.Compared with
dev, the branch primarily does four things:List.*-style recursive helper usages with direct expression-backed operations.Map,MultiMap, andOS-related logic to use expression-backed containers and simpler helper implementations.untilfunction yields a faster performance, although that change isn't pushed here because it depends on making changes to PeTTa.The resulting diff touches core MOSES flow, utilities, metapopulation/deme handling, feature-selection, scoring, representation logic, and their associated tests.
Motivation and Context
The main motivation for this branch is performance and compatibility with the current PeTTa runtime while keeping MOSES behavior correct.
How Has This Been Tested?
Testing was done both at the individual-file level and across the full strict Python runner.
Types of changes
Checklist