Exception: StopSignal

Inherits:
RuntimeError
  • Object
show all
Defined in:
lib/optimizer_signals.rb

Overview

When this Signal is raised in the thread of a Optimizer, the Optimizer will complete its current step and then stop.

If a filename is given to the constructor the results will be written to this file.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(save_state_filename = nil) ⇒ StopSignal

Returns a new instance of StopSignal.

Parameters:

  • save_state_filename (String) (defaults to: nil)

    If this parameter is set, then the state of the algorithm will be saved to a file of this name.


11
12
13
14
# File 'lib/optimizer_signals.rb', line 11

def initialize(save_state_filename = nil)
  @save = !save_state_filename.nil?
  @save_state_filename = save_state_filename
end

Instance Attribute Details

#saveObject (readonly)


8
9
10
# File 'lib/optimizer_signals.rb', line 8

def save
  @save
end

#save_state_filenameObject (readonly)


8
9
10
# File 'lib/optimizer_signals.rb', line 8

def save_state_filename
  @save_state_filename
end