Skip to content
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

Bug in ThreeValuedEquivalenceRelation#projectToConstraintsWith #234

Closed
Heizmann opened this issue Sep 30, 2017 · 7 comments
Closed

Bug in ThreeValuedEquivalenceRelation#projectToConstraintsWith #234

Heizmann opened this issue Sep 30, 2017 · 7 comments
Assignees

Comments

@Heizmann
Copy link
Member

While constructing seemingly a copy the above mentioned method in fact reuses data structure of the original.
I cannot understand its documentation but I guess the problem is a bug.

I did not want to change the original method (currently used in an evaluation) and added a new method ThreeValuedEquivalenceRelation#projectTo
68916df

Please check and delete the old method in case the new method fixes the problem.

@danieldietsch
Copy link
Member

I'd like to add that if some adds a method to a class he or she should add an author tag. I did nothing with ThreeValuedEquivalenceRelation#projectToConstraintsWith, but perhaps @alexandernutz should take a look (the history indicates him as author).

@alexandernutz
Copy link
Member

alexandernutz commented Oct 1, 2017

I agree with @Heizmann that the method leads to sharing of an underlying Set between two ThreeValuedEquivalenceRelations, which is clearly unintended.
However the new implementation does an additional intersection operation with the parameter set "elems" that is not intended.
I will update both the method and the documentation.

(The intended purpose is to keep all constraints where at least one side is in the given Set elems)

Can I delete the projectTo method after fixing projectToConstraintsWith? Eclipse shows me it is not referenced, but it has been wrong before..

@alexandernutz
Copy link
Member

actually, I now believe it was not a bug -- at least the underlying sets were not shared.
The reason is that UnionFind#addEquivalenceClass makes a copy of its input set.
But I can see, that the code should make that clearer, so projectToConstraintsWith now makes a copy.

@Heizmann
Copy link
Member Author

Heizmann commented Oct 1, 2017

Can I delete the projectTo method

No. I need this method and it was not nice to comment the code.

@Heizmann
Copy link
Member Author

Heizmann commented Oct 1, 2017

But I can see, that the code should make that clearer,

It would be good if you could also update the documentation. If one can understand the documentation it might also become clear what your method does.

@alexandernutz
Copy link
Member

sorry. I updated both documentation and method name (commits linked above in this thread), dont you like them?

@Heizmann
Copy link
Member Author

Heizmann commented Oct 1, 2017

I did no knew that you also updated the documentation.

@Heizmann Heizmann closed this as completed Oct 1, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants