-
Notifications
You must be signed in to change notification settings - Fork 146
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
base: master
Are you sure you want to change the base?
Conversation
@@ -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()) { |
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.
why not calling model.getSolver().isStopCriterionMet() ?
This would avoid modifying the Solver class.
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.
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.
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.
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); |
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.
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()) { |
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.
Personnaly, I would have move the code to the end of the while-loop just to keep the main purpose (ie, propagating) clear
No description provided.