Class: FeldtRuby::Optimize::MaxStepsTerminationCriterion

Inherits:
TerminationCriterion show all
Defined in:
lib/feldtruby/optimize/max_steps_termination_criterion.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from TerminationCriterion

#continue_optimization?

Constructor Details

#initialize(maxSteps = 10_000) ⇒ MaxStepsTerminationCriterion

Returns a new instance of MaxStepsTerminationCriterion.



18
19
20
# File 'lib/feldtruby/optimize/max_steps_termination_criterion.rb', line 18

def initialize(maxSteps = 10_000)
	@max_steps = maxSteps
end

Instance Attribute Details

#max_stepsObject

Returns the value of attribute max_steps.



16
17
18
# File 'lib/feldtruby/optimize/max_steps_termination_criterion.rb', line 16

def max_steps
  @max_steps
end

Instance Method Details

#terminate?(optimizer) ⇒ Boolean

Returns:

  • (Boolean)


21
22
23
# File 'lib/feldtruby/optimize/max_steps_termination_criterion.rb', line 21

def terminate?(optimizer)
	optimizer.num_optimization_steps >= @max_steps
end