public BehaviorType(BehaviorType copyFrom) { if (copyFrom.behaviorList != null) { behaviorList = new List <double>(copyFrom.behaviorList); } }
public static double Distance(BehaviorType v1, BehaviorType v2) { double behavioralDistance = 0.0; if (v1 != null && v2 != null) { // Loop through each triple in the behavior vector for (int k = 0; k < v1.behaviorList.Count; k += 4) { // Position component behavioralDistance += Chromaria.Simulator.positionWeight * Scale(EuclideanDistance(v1.behaviorList[k], v1.behaviorList[k + 1], v2.behaviorList[k], v2.behaviorList[k + 1]), 0.0, Chromaria.Simulator.maxDistance, 0.0, 1.0); // Heading component behavioralDistance += Chromaria.Simulator.headingWeight * Math.Abs(Scale(v1.behaviorList[k + 3], -Math.PI, Math.PI, 0.0, 1.0) - Scale(v2.behaviorList[k + 3], -Math.PI, Math.PI, 0.0, 1.0)); // Planting component behavioralDistance += Chromaria.Simulator.plantingWeight * (Math.Abs(v1.behaviorList[k + 2] - v2.behaviorList[k + 2])); } } return(behavioralDistance); }