/// Creates a new segment for this Cell. /// learningCells: A set of available learning cells to add to the segmentUpdateList. /// Returns created segment. /// /// The new segment will initially connect to at most newSynapseCount /// synapses randomly selected from the set of cells that /// were in the learning state at t-1 (specified by the learningCells parameter). Segment *Cell::CreateSegment(FastList &learningCells, int creationTime) { Segment *newSegment = (Segment*)(mem_manager.GetMemObject(MOT_SEGMENT)); newSegment->Initialize(creationTime, (float)(column->region->SegActiveThreshold)); newSegment->CreateSynapsesToLearningCells(learningCells, &(column->region->DistalSynapseParams)); Segments.InsertAtEnd(newSegment); return newSegment; }
/// Add a new SegmentUpdateInfo object to this Cell containing proposed changes to the /// specified segment. /// /// If the segment is NULL, then a new segment is to be added, otherwise /// the specified segment is updated. If the segment exists, find all active /// synapses for the segment (either at t or t-1 based on the 'previous' parameter) /// and mark them as needing to be updated. If newSynapses is true, then /// Region.newSynapseCount - len(activeSynapses) new synapses are added to the /// segment to be updated. The (new) synapses are randomly chosen from the set /// of current learning cells (within Region.predictionRadius if set). /// /// These segment updates are only applied when the applySegmentUpdates /// method is later called on this Cell. SegmentUpdateInfo *Cell::UpdateSegmentActiveSynapses(bool previous, Segment *segment, bool newSynapses, UpdateType updateType) { FastList *activeSyns = NULL; if (segment != NULL) { activeSyns = previous ? &(segment->PrevActiveSynapses) : &(segment->ActiveSynapses); } SegmentUpdateInfo *segmentUpdate = (SegmentUpdateInfo*)(mem_manager.GetMemObject(MOT_SEGMENT_UPDATE_INFO)); segmentUpdate->Initialize(this, segment, activeSyns, newSynapses, column->region->GetStepCounter(), updateType); _segmentUpdates.InsertAtEnd(segmentUpdate); return segmentUpdate; }