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

Make propagation stops sooner if time limit is met (fix issue #1062) #1064

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

ArthurGodet
Copy link
Collaborator

No description provided.

@@ -189,6 +189,9 @@ public void propagate() throws ContradictionException {
manageModifications();
for (int i = nextNotEmpty(); i > -1; i = nextNotEmpty()) {
assert !pro_queue[i].isEmpty() : "try to pop a propagator from an empty queue";
if (model.getSolver().isTimeLimitMet()) {
Copy link
Contributor

Choose a reason for hiding this comment

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

why not calling model.getSolver().isStopCriterionMet() ?
This would avoid modifying the Solver class.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The idea was to have a simple check on the time limit, and not check all the stopping criterion before the propagation of each propagator.
Indeed, all stopping criterion but the time limit do not depend on the problem's state outside of fixpoint. Unless you can think of one that would.

Copy link
Member

Choose a reason for hiding this comment

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

Personnaly, I would have move the code to the end of the while-loop just to keep the main purpose (ie, propagating) clear

boolean solved = solver.solve();
long took = System.currentTimeMillis() - start;

assertFalse(solved);
Copy link
Contributor

Choose a reason for hiding this comment

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

Good to check that solve() returns false;

@@ -189,6 +189,9 @@ public void propagate() throws ContradictionException {
manageModifications();
for (int i = nextNotEmpty(); i > -1; i = nextNotEmpty()) {
assert !pro_queue[i].isEmpty() : "try to pop a propagator from an empty queue";
if (model.getSolver().isTimeLimitMet()) {
Copy link
Member

Choose a reason for hiding this comment

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

Personnaly, I would have move the code to the end of the while-loop just to keep the main purpose (ie, propagating) clear

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

Successfully merging this pull request may close these issues.

None yet

3 participants