-
Notifications
You must be signed in to change notification settings - Fork 149
chore: rename @ShadowVariableLooped to @ShadowVariableInconsistent #1749
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
chore: rename @ShadowVariableLooped to @ShadowVariableInconsistent #1749
Conversation
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.
I have not done a full review yet. The changes I'm requesting will alter this PR enough that I will re-review from scratch when done.
...a/ai/timefold/solver/core/impl/domain/variable/listener/support/VariableListenerSupport.java
Outdated
Show resolved
Hide resolved
...a/ai/timefold/solver/core/impl/domain/variable/listener/support/VariableListenerSupport.java
Outdated
Show resolved
Hide resolved
...a/ai/timefold/solver/core/impl/domain/variable/listener/support/VariableListenerSupport.java
Outdated
Show resolved
Hide resolved
...a/ai/timefold/solver/core/impl/domain/variable/listener/support/VariableListenerSupport.java
Outdated
Show resolved
Hide resolved
...a/ai/timefold/solver/core/impl/domain/variable/listener/support/VariableListenerSupport.java
Outdated
Show resolved
Hide resolved
...a/ai/timefold/solver/core/impl/domain/variable/listener/support/VariableListenerSupport.java
Outdated
Show resolved
Hide resolved
core/src/main/java/ai/timefold/solver/core/impl/score/director/InnerScoreDirector.java
Outdated
Show resolved
Hide resolved
core/src/main/java/ai/timefold/solver/core/impl/solver/scope/SolverScope.java
Outdated
Show resolved
Hide resolved
Also, I wonder... the performance impact of this could be mitigated if we know that these checks will be done elsewhere. If we know that var listeners will be triggered, and that those have all of those assertions, can we not skip this work? |
The code doesn't make that at all clear. There is no comment, nor does the structure of the code suggests that. If we moved this code to a place where the |
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.
Leaving my review.
I also pushed a small commit adding Javadocs to the methods that have to do with update policies. I figured it'd be more effective to do it than to spend even more time explaining it so that you can do it.
core/src/main/java/ai/timefold/solver/core/impl/score/director/EntityValidator.java
Outdated
Show resolved
Hide resolved
core/src/main/java/ai/timefold/solver/core/impl/score/director/EntityValidator.java
Outdated
Show resolved
Hide resolved
core/src/main/java/ai/timefold/solver/core/impl/score/director/EntityValidator.java
Outdated
Show resolved
Hide resolved
core/src/main/java/ai/timefold/solver/core/impl/score/director/EntityValidator.java
Outdated
Show resolved
Hide resolved
core/src/main/java/ai/timefold/solver/core/impl/score/director/EntityValidator.java
Outdated
Show resolved
Hide resolved
core/src/main/java/ai/timefold/solver/core/impl/score/director/EntityValidator.java
Outdated
Show resolved
Hide resolved
core/src/main/java/ai/timefold/solver/core/impl/score/director/InnerScoreDirector.java
Outdated
Show resolved
Hide resolved
...imefold/solver/core/preview/api/domain/variable/declarative/ShadowVariablesInconsistent.java
Outdated
Show resolved
Hide resolved
...c/main/java/ai/timefold/solver/core/impl/domain/variable/declarative/RootVariableSource.java
Outdated
Show resolved
Hide resolved
core/src/main/java/ai/timefold/solver/core/impl/domain/variable/declarative/LoopedTracker.java
Show resolved
Hide resolved
Also, tests are failing. |
Having reviewed the Sonar suggestions, I'd say they're useful. |
- Solving will automatically update all shadow variables, so you can now pass in solutions with incorrect/stale shadow variables and they'll be correctly updated. - SolutionManager.update(SolutionUpdatePolicy.UPDATE_SCORE_ONLY, ...) will now fail fast if any @ShadowVariableInconsistent member is null or if any @InverseRelationVariable is null or incorrect.
384611b
to
e3ca804
Compare
I have just added my final comment. Once that's resolved, I'll approve, provided that those changes don't result in anything questionable. |
core/src/main/java/ai/timefold/solver/core/impl/domain/variable/ShadowVariableUpdateHelper.java
Outdated
Show resolved
Hide resolved
...va/ai/timefold/solver/core/impl/score/director/incremental/IncrementalScoreDirectorTest.java
Outdated
Show resolved
Hide resolved
core/src/main/java/ai/timefold/solver/core/impl/solver/scope/SolverScope.java
Outdated
Show resolved
Hide resolved
core/src/main/java/ai/timefold/solver/core/impl/score/director/InnerScoreDirector.java
Outdated
Show resolved
Hide resolved
|
Solving will automatically update all shadow variables, so you can now pass in solutions with incorrect/stale shadow variables and they'll be correctly updated.
SolutionManager.update(SolutionUpdatePolicy.UPDATE_SCORE_ONLY, ...) will now fail fast if any @ShadowVariableInconsistent member is null or if any @InverseRelationVariable is null or incorrect.