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

Timeout feature on evaluation #185

Merged
merged 34 commits into from
Jul 28, 2021
Merged

Timeout feature on evaluation #185

merged 34 commits into from
Jul 28, 2021

Conversation

3rdCore
Copy link
Collaborator

@3rdCore 3rdCore commented Jul 26, 2021

Few modifications on CPModel to add the timeout feature on searches. CPModel now has a limit.searchingTime attribute.
To use a timeout on evaluation, the user should add the optional argument evalTimeOut during the SameInstancesEvaluator creation.

I added the possibility to define 2 different strategies strategy and eval_strategy for both the training and the evaluation.

I fixed a little omission on BasicHeuristic that were previously not modifying model.statistics.lastVar during a DecisionPhase

Prints during search, using verbose=true have also been updated.

@3rdCore 3rdCore requested review from PierreTsr and sandertom July 26, 2021 21:07
@3rdCore 3rdCore added the enhancement New feature or request label Jul 26, 2021
belowNodeLimit(model::CPModel) = isnothing(model.limit.numberOfNodes) || model.statistics.numberOfNodes < model.limit.numberOfNodes
belowSolutionLimit(model::CPModel) = isnothing(model.limit.numberOfSolutions) || model.statistics.numberOfSolutions < model.limit.numberOfSolutions

belowTimeLimit(model::CPModel) = isnothing(model.limit.searchingTime) || peektimer() < model.limit.searchingTime
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

peektimer() can be compared as the loop button on any stopwatch. It gives the elapsed time since the last call to tic().

@@ -19,7 +19,7 @@ at each branching and using `valueSelection` to choose how the branching will be

"""
function search!(model::CPModel, strategy::S, variableHeuristic::AbstractVariableSelection, valueSelection::ValueSelection=BasicHeuristic(); out_solver::Bool=false) where S <: SearchStrategy

tic()
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Timer is started at the beginning of a search.

Copy link
Contributor

@PierreTsr PierreTsr left a comment

Choose a reason for hiding this comment

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

Everything's good to me

@3rdCore 3rdCore merged commit 40f6570 into master Jul 28, 2021
@3rdCore 3rdCore deleted the enhancement/exp_eval branch July 28, 2021 14:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants