-
Notifications
You must be signed in to change notification settings - Fork 4
Refactor constraints, conversion strategies, and print #18
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
Conversation
…o-boolean constraints in .opb format
…ssible group cardinality conversions
…nto refactoring_metamodel
… during conversion strategy
…ontain doubles by encoding them in integer values
…ndled as literal times literal)
… other mathematical operators)
…ure cardinality subtree roots, expression contains feature from feature cardinality, unsatisfiable expression should return false and not throw error, several issues with opb division encoding, removed unnecessary overwrites of left and right in expression constraints, force order of featurecardinality and aggregate function conversion, several to string methods for better debugging, issues with whole number encoding because numbers get larger than long value, uniform substitution, simpler substitution code,
…vs tseitin style cross-tree constraint encoding)
…ctoring_metamodel
Fixes for problems that occured during my master thesis
|
This PR comes with several changes to simplify the usage of constraints, conversion strategies, and printing. Constraints
Conversion strategies:
Printing:
|
coemgen1992
left a comment
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 only have some comments regarding comments and guarantees, which should be resolved. Besides that, the code looks good.
| } | ||
| } | ||
| /* | ||
| additional constraint with all cloned versions ored |
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.
Is there a particular reason to leave the comments in?
Please remove these comments, otherwise.
| Expression left = ((ExpressionConstraint) constraint).getLeft(); | ||
| Expression right = ((ExpressionConstraint) constraint).getRight(); | ||
| return expressionContains(left, subTreeFeatures) || expressionContains(right, subTreeFeatures); | ||
| } |
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.
This if-else statement is very specific.
Can we guarantee that there only will be these cases? If not, we may want to add some sort of log, error statement in an else branch of the cascade.
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 think this makes sense. It should only be those three cases in this abstraction level:
- Found the atom to collect it
- Constraint is an expression, so we switch to "expression mode" for the traversal
- Traverse all subparts of the constraint
| orConstraint.add_sub_part(constraint); | ||
| } | ||
| /* | ||
| Constraint orConstraint; |
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.
Same comment as before. Please remove code in comments.
| orConstraint.add_sub_part(constraint); | ||
| } | ||
| /* | ||
| Constraint orConstraint; |
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.
Remove comments.
| static { | ||
| constraintprecedenceLookup = new HashMap<>(); | ||
|
|
||
| // n-ary |
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 am always a bit nervous on magic numbers in code.
Consider making the ordering clear with constants?
| StringBuilder result = new StringBuilder(); | ||
| for (Constraint part : sub_parts) { | ||
| result.append(AutomaticBrackets.enforceConstraintBracketsIfNecessary(this, part, withSubmodels, currentAlias)); | ||
| result.append(" | "); |
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.
Do we want to introduce a Symbol lookup at some point?
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.
Makes sense. I created an issue #20
|
All comments should be addressed now. Pipeline sadly still fails due to the publishing issues. Locally all tests ran through. |
|
@SundermannC I will try to run it by myself next week. |
|
LGTM, nothing broke and code looks clean. |
No description provided.