Example #1
0
        public override IOperation InstrumentedApply()
        {
            IVRPEncoding solution = VRPToursParameter.ActualValue;

            if (!(solution is PrinsEncoding))
            {
                VRPToursParameter.ActualValue = PrinsEncoding.ConvertFrom(solution, ProblemInstance);
            }

            Manipulate(RandomParameter.ActualValue, VRPToursParameter.ActualValue as PrinsEncoding);

            return(base.InstrumentedApply());
        }
        public override IOperation InstrumentedApply()
        {
            ItemArray <IVRPEncoding> parents = new ItemArray <IVRPEncoding>(ParentsParameter.ActualValue.Length);

            for (int i = 0; i < ParentsParameter.ActualValue.Length; i++)
            {
                IVRPEncoding solution = ParentsParameter.ActualValue[i];

                if (!(solution is PrinsEncoding))
                {
                    parents[i] = PrinsEncoding.ConvertFrom(solution, ProblemInstance);
                }
                else
                {
                    parents[i] = solution;
                }
            }
            ParentsParameter.ActualValue = parents;

            ChildParameter.ActualValue =
                Crossover(RandomParameter.ActualValue, parents[0] as PrinsEncoding, parents[1] as PrinsEncoding);

            return(base.InstrumentedApply());
        }