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



44
45
46
47
48
49
50
# File 'lib/openstudio/analysis/algorithm_attributes.rb', line 44

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

Instance Method Details

#[](name) ⇒ Object



68
69
70
# File 'lib/openstudio/analysis/algorithm_attributes.rb', line 68

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

#set_attribute(attribute_name, attribute_value) ⇒ Object



56
57
58
59
60
61
62
63
64
65
66
# File 'lib/openstudio/analysis/algorithm_attributes.rb', line 56

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



72
73
74
# File 'lib/openstudio/analysis/algorithm_attributes.rb', line 72

def to_hash(_version = 1)
  @attributes
end