lc_social_events (faber_neuroevolution v1.2.4)

View Source

Behavioral event constructors for Social Silo.

Events related to reputation, coalitions, and social networks. Social Silo operates at timescale τ=25.

Summary

Types

individual_id/0

-type individual_id() :: binary().

population_id/0

-type population_id() :: binary().

social_event/0

-type social_event() ::
          #reputation_changed{meta ::
                                  #lc_event_meta{event_id :: binary(),
                                                 correlation_id :: binary() | undefined,
                                                 causation_id :: binary() | undefined,
                                                 timestamp :: timestamp(),
                                                 version :: pos_integer(),
                                                 emitter :: atom()},
                              individual_id :: individual_id(),
                              population_id :: population_id(),
                              reputation_before :: float(),
                              reputation_after :: float(),
                              change_cause :: cooperation | defection | achievement | punishment,
                              witnesses :: [individual_id()]} |
          #coalition_formed{meta ::
                                #lc_event_meta{event_id :: binary(),
                                               correlation_id :: binary() | undefined,
                                               causation_id :: binary() | undefined,
                                               timestamp :: timestamp(),
                                               version :: pos_integer(),
                                               emitter :: atom()},
                            coalition_id :: binary(),
                            founder_ids :: [individual_id()],
                            population_id :: population_id(),
                            formation_reason :: defense | resource | breeding,
                            initial_strength :: float()} |
          #coalition_dissolved{meta ::
                                   #lc_event_meta{event_id :: binary(),
                                                  correlation_id :: binary() | undefined,
                                                  causation_id :: binary() | undefined,
                                                  timestamp :: timestamp(),
                                                  version :: pos_integer(),
                                                  emitter :: atom()},
                               coalition_id :: binary(),
                               population_id :: population_id(),
                               dissolution_reason :: success | failure | conflict | attrition,
                               duration_generations :: non_neg_integer(),
                               final_members :: [individual_id()]} |
          #coalition_member_joined{meta ::
                                       #lc_event_meta{event_id :: binary(),
                                                      correlation_id :: binary() | undefined,
                                                      causation_id :: binary() | undefined,
                                                      timestamp :: timestamp(),
                                                      version :: pos_integer(),
                                                      emitter :: atom()},
                                   coalition_id :: binary(),
                                   individual_id :: individual_id(),
                                   membership_type :: full | associate | candidate,
                                   coalition_size_after :: non_neg_integer()} |
          #coalition_member_expelled{meta ::
                                         #lc_event_meta{event_id :: binary(),
                                                        correlation_id :: binary() | undefined,
                                                        causation_id :: binary() | undefined,
                                                        timestamp :: timestamp(),
                                                        version :: pos_integer(),
                                                        emitter :: atom()},
                                     coalition_id :: binary(),
                                     individual_id :: individual_id(),
                                     expulsion_reason :: defection | underperformance | conflict,
                                     coalition_size_after :: non_neg_integer()} |
          #mentoring_started{meta ::
                                 #lc_event_meta{event_id :: binary(),
                                                correlation_id :: binary() | undefined,
                                                causation_id :: binary() | undefined,
                                                timestamp :: timestamp(),
                                                version :: pos_integer(),
                                                emitter :: atom()},
                             mentor_id :: individual_id(),
                             mentee_id :: individual_id(),
                             mentoring_type :: skill | strategy | general,
                             expected_duration :: non_neg_integer() | indefinite} |
          #mentoring_ended{meta ::
                               #lc_event_meta{event_id :: binary(),
                                              correlation_id :: binary() | undefined,
                                              causation_id :: binary() | undefined,
                                              timestamp :: timestamp(),
                                              version :: pos_integer(),
                                              emitter :: atom()},
                           mentor_id :: individual_id(),
                           mentee_id :: individual_id(),
                           outcome :: success | failure | interrupted,
                           duration_generations :: non_neg_integer(),
                           mentee_improvement :: float()} |
          #social_network_updated{meta ::
                                      #lc_event_meta{event_id :: binary(),
                                                     correlation_id :: binary() | undefined,
                                                     causation_id :: binary() | undefined,
                                                     timestamp :: timestamp(),
                                                     version :: pos_integer(),
                                                     emitter :: atom()},
                                  population_id :: population_id(),
                                  connections_added :: non_neg_integer(),
                                  connections_removed :: non_neg_integer(),
                                  network_density :: float(),
                                  clustering_coefficient :: float()} |
          #trust_established{meta ::
                                 #lc_event_meta{event_id :: binary(),
                                                correlation_id :: binary() | undefined,
                                                causation_id :: binary() | undefined,
                                                timestamp :: timestamp(),
                                                version :: pos_integer(),
                                                emitter :: atom()},
                             individual_a_id :: individual_id(),
                             individual_b_id :: individual_id(),
                             trust_level :: float(),
                             trust_basis :: cooperation | kinship | reputation} |
          #betrayal_detected{meta ::
                                 #lc_event_meta{event_id :: binary(),
                                                correlation_id :: binary() | undefined,
                                                causation_id :: binary() | undefined,
                                                timestamp :: timestamp(),
                                                version :: pos_integer(),
                                                emitter :: atom()},
                             betrayer_id :: individual_id(),
                             victim_id :: individual_id(),
                             betrayal_type :: defection | deception | abandonment,
                             trust_before :: float(),
                             trust_after :: float()}.

timestamp/0

-type timestamp() :: integer().

Functions

betrayal_detected(Data)

-spec betrayal_detected(map()) ->
                           #betrayal_detected{meta ::
                                                  #lc_event_meta{event_id :: binary(),
                                                                 correlation_id :: binary() | undefined,
                                                                 causation_id :: binary() | undefined,
                                                                 timestamp :: timestamp(),
                                                                 version :: pos_integer(),
                                                                 emitter :: atom()},
                                              betrayer_id :: individual_id(),
                                              victim_id :: individual_id(),
                                              betrayal_type :: defection | deception | abandonment,
                                              trust_before :: float(),
                                              trust_after :: float()}.

coalition_dissolved(Data)

-spec coalition_dissolved(map()) ->
                             #coalition_dissolved{meta ::
                                                      #lc_event_meta{event_id :: binary(),
                                                                     correlation_id ::
                                                                         binary() | undefined,
                                                                     causation_id ::
                                                                         binary() | undefined,
                                                                     timestamp :: timestamp(),
                                                                     version :: pos_integer(),
                                                                     emitter :: atom()},
                                                  coalition_id :: binary(),
                                                  population_id :: population_id(),
                                                  dissolution_reason ::
                                                      success | failure | conflict | attrition,
                                                  duration_generations :: non_neg_integer(),
                                                  final_members :: [individual_id()]}.

coalition_formed(Data)

-spec coalition_formed(map()) ->
                          #coalition_formed{meta ::
                                                #lc_event_meta{event_id :: binary(),
                                                               correlation_id :: binary() | undefined,
                                                               causation_id :: binary() | undefined,
                                                               timestamp :: timestamp(),
                                                               version :: pos_integer(),
                                                               emitter :: atom()},
                                            coalition_id :: binary(),
                                            founder_ids :: [individual_id()],
                                            population_id :: population_id(),
                                            formation_reason :: defense | resource | breeding,
                                            initial_strength :: float()}.

coalition_member_expelled(Data)

-spec coalition_member_expelled(map()) ->
                                   #coalition_member_expelled{meta ::
                                                                  #lc_event_meta{event_id :: binary(),
                                                                                 correlation_id ::
                                                                                     binary() |
                                                                                     undefined,
                                                                                 causation_id ::
                                                                                     binary() |
                                                                                     undefined,
                                                                                 timestamp ::
                                                                                     timestamp(),
                                                                                 version ::
                                                                                     pos_integer(),
                                                                                 emitter :: atom()},
                                                              coalition_id :: binary(),
                                                              individual_id :: individual_id(),
                                                              expulsion_reason ::
                                                                  defection | underperformance |
                                                                  conflict,
                                                              coalition_size_after :: non_neg_integer()}.

coalition_member_joined(Data)

-spec coalition_member_joined(map()) ->
                                 #coalition_member_joined{meta ::
                                                              #lc_event_meta{event_id :: binary(),
                                                                             correlation_id ::
                                                                                 binary() | undefined,
                                                                             causation_id ::
                                                                                 binary() | undefined,
                                                                             timestamp :: timestamp(),
                                                                             version :: pos_integer(),
                                                                             emitter :: atom()},
                                                          coalition_id :: binary(),
                                                          individual_id :: individual_id(),
                                                          membership_type ::
                                                              full | associate | candidate,
                                                          coalition_size_after :: non_neg_integer()}.

event_to_map(Event)

-spec event_to_map(social_event()) -> map().

make_meta(Emitter)

-spec make_meta(Emitter :: atom()) ->
                   #lc_event_meta{event_id :: binary(),
                                  correlation_id :: binary() | undefined,
                                  causation_id :: binary() | undefined,
                                  timestamp :: timestamp(),
                                  version :: pos_integer(),
                                  emitter :: atom()}.

make_meta(Emitter, Opts)

-spec make_meta(Emitter :: atom(), Opts :: map()) ->
                   #lc_event_meta{event_id :: binary(),
                                  correlation_id :: binary() | undefined,
                                  causation_id :: binary() | undefined,
                                  timestamp :: timestamp(),
                                  version :: pos_integer(),
                                  emitter :: atom()}.

mentoring_ended(Data)

-spec mentoring_ended(map()) ->
                         #mentoring_ended{meta ::
                                              #lc_event_meta{event_id :: binary(),
                                                             correlation_id :: binary() | undefined,
                                                             causation_id :: binary() | undefined,
                                                             timestamp :: timestamp(),
                                                             version :: pos_integer(),
                                                             emitter :: atom()},
                                          mentor_id :: individual_id(),
                                          mentee_id :: individual_id(),
                                          outcome :: success | failure | interrupted,
                                          duration_generations :: non_neg_integer(),
                                          mentee_improvement :: float()}.

mentoring_started(Data)

-spec mentoring_started(map()) ->
                           #mentoring_started{meta ::
                                                  #lc_event_meta{event_id :: binary(),
                                                                 correlation_id :: binary() | undefined,
                                                                 causation_id :: binary() | undefined,
                                                                 timestamp :: timestamp(),
                                                                 version :: pos_integer(),
                                                                 emitter :: atom()},
                                              mentor_id :: individual_id(),
                                              mentee_id :: individual_id(),
                                              mentoring_type :: skill | strategy | general,
                                              expected_duration :: non_neg_integer() | indefinite}.

reputation_changed(Data)

-spec reputation_changed(map()) ->
                            #reputation_changed{meta ::
                                                    #lc_event_meta{event_id :: binary(),
                                                                   correlation_id ::
                                                                       binary() | undefined,
                                                                   causation_id :: binary() | undefined,
                                                                   timestamp :: timestamp(),
                                                                   version :: pos_integer(),
                                                                   emitter :: atom()},
                                                individual_id :: individual_id(),
                                                population_id :: population_id(),
                                                reputation_before :: float(),
                                                reputation_after :: float(),
                                                change_cause ::
                                                    cooperation | defection | achievement | punishment,
                                                witnesses :: [individual_id()]}.

social_network_updated(Data)

-spec social_network_updated(map()) ->
                                #social_network_updated{meta ::
                                                            #lc_event_meta{event_id :: binary(),
                                                                           correlation_id ::
                                                                               binary() | undefined,
                                                                           causation_id ::
                                                                               binary() | undefined,
                                                                           timestamp :: timestamp(),
                                                                           version :: pos_integer(),
                                                                           emitter :: atom()},
                                                        population_id :: population_id(),
                                                        connections_added :: non_neg_integer(),
                                                        connections_removed :: non_neg_integer(),
                                                        network_density :: float(),
                                                        clustering_coefficient :: float()}.

trust_established(Data)

-spec trust_established(map()) ->
                           #trust_established{meta ::
                                                  #lc_event_meta{event_id :: binary(),
                                                                 correlation_id :: binary() | undefined,
                                                                 causation_id :: binary() | undefined,
                                                                 timestamp :: timestamp(),
                                                                 version :: pos_integer(),
                                                                 emitter :: atom()},
                                              individual_a_id :: individual_id(),
                                              individual_b_id :: individual_id(),
                                              trust_level :: float(),
                                              trust_basis :: cooperation | kinship | reputation}.