コード例 #1
0
        public ReferenceExperiment GetReferenceExperiment()
        {
            string content = File.ReadAllText(Path.Combine(dir.FullName, "reference.json"));
            JsonSerializerSettings settings = new JsonSerializerSettings();

            settings.ContractResolver = new PrivatePropertiesResolver();
            ReferenceExperiment reference = JsonConvert.DeserializeObject <ReferenceExperiment>(content, settings);

            return(reference);
        }
コード例 #2
0
        public static LocalExperimentManager NewExperiments(string experimentsFolder, ReferenceExperiment reference, IDomainResolver domainResolver)
        {
            ExperimentDefinition def    = MakeRelativeDefinition(experimentsFolder, reference.Definition);
            ReferenceExperiment  relRef = new ReferenceExperiment(def, reference.Repetitions, reference.ReferenceValue);

            FileStorage storage = FileStorage.Open(experimentsFolder);

            storage.Clear();
            storage.SaveReferenceExperiment(relRef);
            LocalExperimentManager manager = new LocalExperimentManager(storage, domainResolver);

            return(manager);
        }
コード例 #3
0
        private LocalExperimentManager(FileStorage storage, IDomainResolver domainResolver)
        {
            if (storage == null)
            {
                throw new ArgumentNullException("storage");
            }
            this.storage   = storage;
            this.reference = storage.GetReferenceExperiment();

            runningExperiments = new ConcurrentDictionary <ExperimentID, ExperimentInstance>();
            runner             = new LocalExperimentRunner(storage.Location, domainResolver);
            lastId             = storage.MaxExperimentId;

            asyncNormal = new AsyncLazy <double>(this.ComputeNormal);
        }
コード例 #4
0
        public void SaveReferenceExperiment(ReferenceExperiment reference)
        {
            string json = JsonConvert.SerializeObject(reference, Formatting.Indented);

            File.WriteAllText(Path.Combine(dir.FullName, "reference.json"), json);
        }