示例#1
0
		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);
		}
示例#2
0
		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);
		}
示例#3
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);
        }
示例#4
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;
		}
示例#5
0
		public ProcessSdampEventArgs(MolecularPattern mp)
		{
			Mp = mp;
		}
示例#6
0
 public Sdamp(Address sender, MolecularPattern mp)
     : base(sender)
 {
     Pattern = mp;
 }
示例#7
0
 public Antigen(Address sender, MolecularPattern pattern, T rawData)
     : base(sender)
 {
     Spamp   = pattern;
     RawData = rawData;
 }
示例#8
0
 public Stimulation(Address sender, MolecularPattern peptide, double costimulationLevel)
     : base(sender)
 {
     Peptide       = peptide;
     Concentration = costimulationLevel;                         // concentration of Stimulation indicates co-stimulation
 }