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); }
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); }
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); }
public void SaveReferenceExperiment(ReferenceExperiment reference) { string json = JsonConvert.SerializeObject(reference, Formatting.Indented); File.WriteAllText(Path.Combine(dir.FullName, "reference.json"), json); }