-
Notifications
You must be signed in to change notification settings - Fork 145
perf: optimize the updater used for shadow variables in certain cases #1659
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
perf: optimize the updater used for shadow variables in certain cases #1659
Conversation
…an update can go - If only one entity has declarative variables, and all sources are either of the form "previous.*", "undirectional" or "declarative", then create a cascading updater using next to get successor and (index, id(entity)) for the initial sort. - If only one entity has declarative variables, and all sources are either of the form "next.*", "undirectional" or "declarative", then create a cascading updater using previous to get successor and (-index, id(entity)) for the initial sort. - If there are no dynamic edges, use a fixed topological order for each variable. - Otherwise use the current approach. Undirectional mean variables that don't create edges in the graph (such as accessing a fact on the inverse or genuine variables).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
First round of review complete. In general, we need more comments/explainers.
I'll run the code through some benchmarks now, see what comes up.
...mefold/solver/core/impl/domain/variable/declarative/DefaultShadowVariableSessionFactory.java
Outdated
Show resolved
Hide resolved
...mefold/solver/core/impl/domain/variable/declarative/DefaultShadowVariableSessionFactory.java
Outdated
Show resolved
Hide resolved
...mefold/solver/core/impl/domain/variable/declarative/DefaultShadowVariableSessionFactory.java
Outdated
Show resolved
Hide resolved
...mefold/solver/core/impl/domain/variable/declarative/DefaultShadowVariableSessionFactory.java
Outdated
Show resolved
Hide resolved
...mefold/solver/core/impl/domain/variable/declarative/DefaultShadowVariableSessionFactory.java
Outdated
Show resolved
Hide resolved
core/src/main/java/ai/timefold/solver/core/impl/domain/variable/declarative/GraphStructure.java
Outdated
Show resolved
Hide resolved
core/src/main/java/ai/timefold/solver/core/impl/domain/variable/declarative/GraphStructure.java
Outdated
Show resolved
Hide resolved
...c/main/java/ai/timefold/solver/core/impl/domain/variable/declarative/ParentVariableType.java
Show resolved
Hide resolved
...ver/core/impl/domain/variable/declarative/SingleDirectionalParentVariableReferenceGraph.java
Outdated
Show resolved
Hide resolved
...mefold/solver/core/testdomain/declarative/extended/TestdataDeclarativeExtendedBaseValue.java
Outdated
Show resolved
Hide resolved
...ver/core/impl/domain/variable/declarative/SingleDirectionalParentVariableReferenceGraph.java
Outdated
Show resolved
Hide resolved
...ver/core/impl/domain/variable/declarative/SingleDirectionalParentVariableReferenceGraph.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The improvements are impressive!
LGTM after comments are resolved.
Also please resolve the Sonar issues - the vast majority of them are trivial, and make sense.
...c/main/java/ai/timefold/solver/core/impl/domain/variable/declarative/ParentVariableType.java
Outdated
Show resolved
Hide resolved
...ver/core/impl/domain/variable/declarative/SingleDirectionalParentVariableReferenceGraph.java
Outdated
Show resolved
Hide resolved
core/src/main/java/ai/timefold/solver/core/impl/domain/variable/declarative/GraphStructure.java
Show resolved
Hide resolved
…not instances of the declarative class
...ai/timefold/solver/core/impl/domain/variable/declarative/AbstractVariableReferenceGraph.java
Outdated
Show resolved
Hide resolved
...mefold/solver/core/impl/domain/variable/declarative/DefaultShadowVariableSessionFactory.java
Outdated
Show resolved
Hide resolved
Co-authored-by: Lukáš Petrovický <lukas@petrovicky.net>
|
Undirectional mean variables that don't create edges in the graph (such as accessing a fact on the inverse or genuine variables).