-
Notifications
You must be signed in to change notification settings - Fork 10
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
Feature/reward #152
Feature/reward #152
Conversation
if symbol == :Infeasible | ||
lh.reward.value -= 10*model.statistics.numberOfNodes | ||
|
||
elseif symbol == :FoundSolution | ||
lh.reward.value -= 1 | ||
|
||
elseif symbol == :Feasible | ||
lh.reward.value -= 1 | ||
|
||
elseif symbol == :BackTracking | ||
lh.reward.value -= 1 | ||
end |
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.
Finally we don't need to declare another function : function set_reward!(::SolutionFoundPhase, ...
as the information about the search ( :SolutionFound
, :Feasible
, :BackTracking
) is already contained in the argument symbol
.
We simply need to inform the user that he could implement a reward that can consider different symbols.
""" | ||
set_metrics!(PHASE::T, lh::LearnedHeuristic, model::CPModel, symbol::Union{Nothing, Symbol}, x::Union{Nothing, AbstractIntVar}) where T <: LearningPhase | ||
|
||
Call set_metrics!(::SearchMetrics, ...) on env.search_metrics to simplify synthax. | ||
Could also add it to basicheuristic ! | ||
""" | ||
function set_metrics!(PHASE::T, lh::LearnedHeuristic, model::CPModel, symbol::Union{Nothing, Symbol}, x::Union{Nothing, AbstractIntVar}) where T <: LearningPhase | ||
set_metrics!(PHASE, lh.search_metrics, model, symbol, x::Union{Nothing, AbstractIntVar}) | ||
end |
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.
this block of code was simply an interface between LearnedHeuristic
and search_metrics
This is my proposition to simplify the use of struct of subtype
LearningPhase
The
Phase
argument called byvalueselection
heuristic is no longer a element of type...Phase <: LearningPhase
but simply the Type...Phase
itself. That saves an allocation at each step of the search.I also fixed a little bug on the
plotRewardVariation
function.