Class: Legion::Extensions::Agentic::Social::Mirror::Helpers::Simulation

Inherits:
Object
  • Object
show all
Defined in:
lib/legion/extensions/agentic/social/mirror/helpers/simulation.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(event_id:, simulated_outcome:, confidence: Constants::SIMULATION_CONFIDENCE_DEFAULT, emotional_resonance: Constants::DEFAULT_RESONANCE) ⇒ Simulation

Returns a new instance of Simulation.



15
16
17
18
19
20
21
22
23
24
# File 'lib/legion/extensions/agentic/social/mirror/helpers/simulation.rb', line 15

def initialize(event_id:, simulated_outcome:, confidence: Constants::SIMULATION_CONFIDENCE_DEFAULT,
               emotional_resonance: Constants::DEFAULT_RESONANCE)
  @id                  = SecureRandom.uuid
  @event_id            = event_id
  @simulated_outcome   = simulated_outcome
  @confidence          = confidence.to_f.clamp(0.0, 1.0)
  @emotional_resonance = emotional_resonance.to_f.clamp(0.0, 1.0)
  @simulated_at        = Time.now.utc
  @accuracy_score      = nil
end

Instance Attribute Details

#accuracy_scoreObject

Returns the value of attribute accuracy_score.



13
14
15
# File 'lib/legion/extensions/agentic/social/mirror/helpers/simulation.rb', line 13

def accuracy_score
  @accuracy_score
end

#confidenceObject (readonly)

Returns the value of attribute confidence.



12
13
14
# File 'lib/legion/extensions/agentic/social/mirror/helpers/simulation.rb', line 12

def confidence
  @confidence
end

#emotional_resonanceObject (readonly)

Returns the value of attribute emotional_resonance.



12
13
14
# File 'lib/legion/extensions/agentic/social/mirror/helpers/simulation.rb', line 12

def emotional_resonance
  @emotional_resonance
end

#event_idObject (readonly)

Returns the value of attribute event_id.



12
13
14
# File 'lib/legion/extensions/agentic/social/mirror/helpers/simulation.rb', line 12

def event_id
  @event_id
end

#idObject (readonly)

Returns the value of attribute id.



12
13
14
# File 'lib/legion/extensions/agentic/social/mirror/helpers/simulation.rb', line 12

def id
  @id
end

#simulated_atObject (readonly)

Returns the value of attribute simulated_at.



12
13
14
# File 'lib/legion/extensions/agentic/social/mirror/helpers/simulation.rb', line 12

def simulated_at
  @simulated_at
end

#simulated_outcomeObject (readonly)

Returns the value of attribute simulated_outcome.



12
13
14
# File 'lib/legion/extensions/agentic/social/mirror/helpers/simulation.rb', line 12

def simulated_outcome
  @simulated_outcome
end

Instance Method Details

#to_hObject



26
27
28
29
30
31
32
33
34
35
36
# File 'lib/legion/extensions/agentic/social/mirror/helpers/simulation.rb', line 26

def to_h
  {
    id:                  @id,
    event_id:            @event_id,
    simulated_outcome:   @simulated_outcome,
    confidence:          @confidence,
    emotional_resonance: @emotional_resonance,
    simulated_at:        @simulated_at,
    accuracy_score:      @accuracy_score
  }
end