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

use square when possible and stronger filtering 2 #1055

Merged
merged 5 commits into from
Aug 2, 2023
Merged

Conversation

jgFages
Copy link
Contributor

@jgFages jgFages commented Aug 1, 2023

No description provided.

@sonatype-lift
Copy link

sonatype-lift bot commented Aug 1, 2023

Sonatype Lift is retiring

Sonatype Lift will be retiring on Sep 12, 2023, with its analysis stopping on Aug 12, 2023. We understand that this news may come as a disappointment, and Sonatype is committed to helping you transition off it seamlessly. If you’d like to retain your data, please export your issues from the web console.
We are extremely grateful and thank you for your support over the years.

📖 Read about the impacts and timeline

@mergify
Copy link
Contributor

mergify bot commented Aug 1, 2023

⚠️ The sha of the head commit of this PR conflicts with #1054. Mergify cannot evaluate rules on this PR. ⚠️

@jgFages jgFages changed the title Jg square2 use square when possible and stronger filtering 2 Aug 1, 2023

private boolean hasHoles(IntVar var) {
return (var.getUB() - var.getLB() + 1) > var.getDomainSize();
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ArthurGodet you suggest to remove it because the following code is expected to create holes everywhere?

// check perfect squares once and for all
            int ub = vars[0].getUB();
            vrms.clear();
            vrms.setOffset(vars[0].getLB());
            for (int value = vars[0].getLB(); value <= ub; value = vars[0].nextValue(value)) {
                if (!MathUtils.isPerfectSquare(value)) {
                    vrms.add(value);
                }
            }
            impact = vars[0].removeValues(vrms, this);

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, indeed. As long as vars[0] has an enumerated domain and its bounds are different, it will necessarily contains holes because of this code.

@jgFages
Copy link
Contributor Author

jgFages commented Aug 1, 2023

@ArthurGodet can you please confirm I correctly reapplied your suggestions in the last commit ?

@ArthurGodet
Copy link
Collaborator

Yes, everything seems good to me now !

@ArthurGodet ArthurGodet merged commit 3a5a92b into master Aug 2, 2023
14 checks passed
@ArthurGodet ArthurGodet deleted the JG_square2 branch August 2, 2023 09:38
@ArthurGodet ArthurGodet added this to the 4.11.0 milestone Aug 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants