public HelperTCell(ITissue parent, int mpLen) : base(CellType.Helper, parent) { Activators = new List<Address>(); // generate a random molecular pattern // NOTE: pattern vectors should be normalized var pat = new double[mpLen]; for (int i = 0; i < mpLen; i++) { pat[i] = RandGen.NextDouble(); } Pattern = new MolecularPattern(pat); }
private Point GetPatternAsPoint(MolecularPattern mp) { // TODO: X64 /*// returns the cartesian representation of the pattern byte[] array = new byte[4]; mp.CopyTo(array, 0); int xy = BitConverter.ToInt32(array, 0); int allOneLower = (int)Math.Pow(2, Globals.NumOfNocleutidesPerGen) - 1; int y = xy & (allOneLower); // y = lower half bits int x = (xy - y) / (allOneLower + 1); // x = higher half bits return new Point(x, y);*/ return new Point(0, 0); }
public double Affinity(MolecularPattern mp, AffinityType type) { if (pattern.Length != mp.Length) { throw new Exception("Patterns must have the same lengths."); } double ndist = 0; // normalized distance (must be between 0 and 1) switch (type) { case AffinityType.Euclidean: for (var i = 0; i < pattern.Length; i++) { ndist += Math.Pow(pattern[i] - mp[i], 2); } ndist = Math.Sqrt(ndist) / Math.Sqrt(pattern.Length); break; } return(1 - ndist); }
public double Affinity(MolecularPattern mp, AffinityType type) { if (pattern.Length != mp.Length) { throw new Exception("Patterns must have the same lengths."); } double ndist = 0; // normalized distance (must be between 0 and 1) switch (type) { case AffinityType.Euclidean: for (var i = 0; i < pattern.Length; i++) { ndist += Math.Pow(pattern[i] - mp[i], 2); } ndist = Math.Sqrt(ndist) / Math.Sqrt(pattern.Length); break; } return 1 - ndist; }
public ProcessSdampEventArgs(MolecularPattern mp) { Mp = mp; }
public Sdamp(Address sender, MolecularPattern mp) : base(sender) { Pattern = mp; }
public Antigen(Address sender, MolecularPattern pattern, T rawData) : base(sender) { Spamp = pattern; RawData = rawData; }
public Stimulation(Address sender, MolecularPattern peptide, double costimulationLevel) : base(sender) { Peptide = peptide; Concentration = costimulationLevel; // concentration of Stimulation indicates co-stimulation }