broadcast method

void broadcast(
  1. Concept concept
)

Broadcasts a concept into the global workspace.

If the workspace is at capacity the least salient concept is evicted to make room (winner-takes-most dynamics).

Implementation

void broadcast(Concept concept) {
  _applyDecayIfNeeded();

  if (_buffer.any((c) => c.id == concept.id)) {
    // Re-activate existing concept
    _reinforceConcept(concept.id, 0.15);
    _logger.debug('Reinforced existing concept: "${concept.content}"');
    return;
  }

  if (_buffer.length >= capacity) {
    _evictLeastSalient();
  }

  final activated = concept.copyWith(
    activationLevel: math.min(1.0, concept.activationLevel + 0.1),
  );
  _buffer.add(activated);
  _activationLevels[activated.id] = activated.activationLevel;

  _logger.info(
      'Broadcast concept: "${activated.content}" '
      '(activation: ${activated.activationLevel.toStringAsFixed(2)})');
}