public void DendriteApicalUpdateTest() { DendriteApical den = new DendriteApical(3); List <Column> columns = new List <Column>(); columns.Add(new Column(0, 0, 2)); columns.Add(new Column(0, 0, 2)); columns.Add(new Column(0, 0, 2)); columns.Add(new Column(0, 0, 2)); columns.Add(new Column(0, 0, 2)); //test connecting to Cells foreach (Column col in columns) { Assert.IsTrue(den.CreateSynapse(col)); } //test number of connections created Assert.AreEqual(den.Synapses.Count, 5); //test no Cells are not active foreach (Column col in columns) { col.Update_Basal(); Assert.IsFalse(col.IsActive); } den.OverridePermanence(1.0); //activate below threshold (2) columns[0].OverrideActive(true, 0); columns[4].OverrideActive(true, 0); den.Update(); Assert.IsFalse(den.IsActive); //activate = threshold (3) columns[1].OverrideActive(true, 0); den.Update(); Assert.IsTrue(den.IsActive); //activate < threshold (2) columns[0].OverrideActive(false, 0); den.Update(); Assert.IsFalse(den.IsActive); //activate > threshold (5) columns[0].OverrideActive(true, 0); columns[1].OverrideActive(true, 0); columns[2].OverrideActive(true, 0); columns[3].OverrideActive(true, 0); columns[4].OverrideActive(true, 0); den.Update(); Assert.IsTrue(den.IsActive); //activate < threshold (2) columns[2].OverrideActive(false, 0); columns[3].OverrideActive(false, 0); columns[4].OverrideActive(false, 0); den.Update(); Assert.IsFalse(den.IsActive); }
public void DendriteApicalOverridePermanenceTest() { //dendrite DendriteApical den = new DendriteApical(3); //InputPlane InputPlane ip = new InputPlane(5, 5); //create synapses foreach (List <Column> listCol in ip.Columns) { foreach (Column col in listCol) { den.CreateSynapse(col); } } den.OverridePermanence(-5.0); foreach (SynapseApical syn in den.Synapses) { Assert.AreEqual(syn.Permanence, 0.0); } den.OverridePermanence(0.0); foreach (SynapseApical syn in den.Synapses) { Assert.AreEqual(syn.Permanence, 0.0); } den.OverridePermanence(0.112); foreach (SynapseApical syn in den.Synapses) { Assert.AreEqual(syn.Permanence, 0.112); } den.OverridePermanence(9999.99); foreach (SynapseApical syn in den.Synapses) { Assert.AreEqual(syn.Permanence, 1.0); } }