Class: OpenStudio::Analysis::AlgorithmAttributes

Inherits:
Object
  • Object
show all
Defined in:
lib/openstudio/analysis/algorithm_attributes.rb

Constant Summary collapse

ANALYSIS_TYPES =

these are the allowed analysis types

['diag', 'doe', 'fast99', 'ga', 'gaisl', 'lhs', 'morris', 'nsga_nrel', 'optim',
'preflight', 'pso', 'repeat_run', 'rgenoud', 'single_run', 'sobol', 'spea_nrel']

Instance Method Summary collapse

Constructor Details

#initializeAlgorithmAttributes

Create a new instance of the parameters for an algorithm



14
15
16
17
18
19
20
# File 'lib/openstudio/analysis/algorithm_attributes.rb', line 14

def initialize
  @attributes = {
  "seed": nil,
  "failed_f_value": 1000000000000000000,
  "debug_messages": 1
  }
end

Instance Method Details

#[](name) ⇒ Object



38
39
40
# File 'lib/openstudio/analysis/algorithm_attributes.rb', line 38

def [](name)
  @attributes[name]
end

#set_attribute(attribute_name, attribute_value) ⇒ Object



26
27
28
29
30
31
32
33
34
35
36
# File 'lib/openstudio/analysis/algorithm_attributes.rb', line 26

def set_attribute(attribute_name, attribute_value)
  @attributes[attribute_name] = attribute_value
  begin
    unless Float(attribute_value).nil?
      if Float(attribute_value).abs >= Float('1.0e+19')
        raise "ERROR: Attribute `#{attribute_name}` is greater than 1E19. This may cause failures."
      end
    end
  rescue ArgumentError, TypeError
  end
end

#to_hash(_version = 1) ⇒ Object



42
43
44
# File 'lib/openstudio/analysis/algorithm_attributes.rb', line 42

def to_hash(_version = 1)
  @attributes
end