Repository navigation
Conversation
Variable descriptors were only numbered within their entity, so hot lookups used two-level arrays or maps keyed by the variable meta-model, and per-entity indexing could collide under entity inheritance. Each variable descriptor now gets a solution-wide ordinal at construction, from an offset its entity descriptor derives from the previously built one. Variable dispatch, value range statistics and the declarative graph lookups use flat arrays indexed by it; ordinal-based comparators use it too. This also fixes value counts of inherited variables in problem size statistics. Value counts per entity class now follow the order of the class's genuine variables. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
The implementation is consistent across descriptors, dispatch, graph lookup, statistics, and focused inheritance tests.
0 open findings
What changed in this PR
This PR adds solution-wide variable ordinals to prevent inheritance collisions and improve lookup performance.
Changes:
- Replaces nested maps and arrays with flat ordinal-indexed arrays.
- Corrects inherited-variable value statistics.
- Adds inheritance and ordinal tests.
| File | Description |
|---|---|
TestdataEntityRangeSolution.java |
Adds an inheritance statistics test solution. |
TestdataEntityRangeChildEntity.java |
Adds the child test entity. |
TestdataEntityRangeBaseEntity.java |
Adds an entity-provided value range. |
VariableDescriptorGlobalOrdinalTest.java |
Verifies dense, unique global ordinals. |
ProblemSizeStatisticsTest.java |
Tests inherited-variable value counts. |
ValueRangeStatistics.java |
Uses ordinal-indexed value-count arrays. |
ShadowVariablesAssert.java |
Orders variables by global ordinal. |
VariableSupport.java |
Uses a flat dispatch array. |
VariableDescriptor.java |
Adds the global ordinal. |
DefaultShadowVariableSessionFactory.java |
Uses ordinals for graph lookups. |
AbstractVariableReferenceGraph.java |
Replaces lookup maps with an indexed array. |
SolutionDescriptor.java |
Exposes the variable descriptor count. |
DefaultPlanningVariableMetaModel.java |
Compares variables by global ordinal. |
EntityDescriptor.java |
Computes entity variable ordinal offsets. |
🧠 Review effort: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
triceo
force-pushed
the
global-ordinal
branch
from
October 14, 2026 12:00
1cc2096 to
9e64d35
Compare
This branch was successfully deployed
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.
Variable descriptors were only numbered within their entity, so hot lookups used two-level arrays or maps keyed by the variable meta-model, and per-entity indexing could collide under entity inheritance.
Each variable descriptor now gets a solution-wide ordinal at construction, from an offset its entity descriptor derives from the previously built one. Variable dispatch, value range statistics and the declarative graph lookups use flat arrays indexed by it; ordinal-based comparators use it too. This also fixes value counts of inherited variables in problem size statistics. Value counts per entity class now follow the order of the class's genuine variables.