コード例 #1
0
        public static BionicModel ModelToBionicModel(Model source, ModelsConverterSettings settings)
        {
            if (source == null)
            {
                throw new ArgumentNullException("source");
            }

            if (settings == null)
            {
                throw new ArgumentNullException("settings");
            }

            BionicModel result = new BionicModel();

            ConvertAttributes(source, settings, result);
            CopyFitnessCriterion(source, settings, result);
            CopyFunctionalConstraints(source, result);

            return(result);
        }
コード例 #2
0
 private static void ConvertAttributes(Model source, ModelsConverterSettings settings, BionicModel destination)
 {
     if (settings.UseRecordPoint)
     {
         Experiment recordPoint = GetRecordPoint(source, settings.FitnessCriterionId);
         foreach (Parameter parameter in source.Parameters.Values)
         {
             Range     attributeRange = RangeFactory.CreateRangeWithRestriction(recordPoint.ParameterValues[parameter.Id], settings.NeighborhoodSizePercent, parameter.MinValue, parameter.MaxValue);
             Parameter attribute      = (Parameter)parameter.Clone();
             attribute.MinValue = attributeRange.MinValue;
             attribute.MaxValue = attributeRange.MaxValue;
             destination.Attributes.Add(attribute);
         }
     }
     else
     {
         foreach (Parameter parameter in source.Parameters.Values)
         {
             destination.Attributes.Add((Parameter)parameter.Clone());
         }
     }
 }
コード例 #3
0
 private static void CopyFitnessCriterion(Model source, ModelsConverterSettings settings, BionicModel destination)
 {
     destination.FitnessCriterion = (Criterion)source.Criteria[settings.FitnessCriterionId].Clone();
 }