Class: MTree::TreeTask
- Inherits:
-
Task
- Object
- Task
- MTree::TreeTask
- Defined in:
- ext/lib/CompLearnLib/Tree.rb
Instance Method Summary collapse
- #execute ⇒ Object
-
#initialize(tree, tries, penalty) ⇒ TreeTask
constructor
A new instance of TreeTask.
Constructor Details
#initialize(tree, tries, penalty) ⇒ TreeTask
Returns a new instance of TreeTask.
10 11 12 |
# File 'ext/lib/CompLearnLib/Tree.rb', line 10 def initialize(tree, tries, penalty) @tree, @tries, @penalty = tree, tries, penalty end |
Instance Method Details
#execute ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'ext/lib/CompLearnLib/Tree.rb', line 13 def execute() dm = fetch('dm') ts = TreeScore.makeFullList(dm) ts.penalty = @penalty best, bestscore = nil, nil @tries.times { maybe = @tree.clone maybe.mutateComplex score = ts.score(maybe) if (best == nil || bestscore < score) best = maybe bestscore = score end } reply([best, bestscore]) end |