/// <summary> /// Initializes a new instance of the <see cref="Journey"/> class. /// </summary> /// <param name="uuid"> /// The UUID of the journey. /// </param> /// <param name="properties"> /// The evolutionary properties associated with the journey. /// </param> /// <param name="shortName"> /// The short name of the journey. /// </param> /// <param name="description"> /// The description of the journey. /// </param> public Journey(string uuid, EvolutionaryProperties properties, string shortName, string description) { this.Uuid = uuid; this.properties = properties; this.shortName = shortName; this.description = description; }
/// <summary> /// Initializes a new instance of the <see cref = "Journey" /> class. /// </summary> public Journey() { this.Uuid = Guid.NewGuid().ToString(); this.shortName = string.Empty; this.description = string.Empty; this.properties = new EvolutionaryProperties(); }
/// <summary> /// The import. /// </summary> /// <param name="context"> /// The context. /// </param> /// <param name="reader"> /// The reader. /// </param> /// <returns> /// The import. /// </returns> public object Import(ImportContext context, JsonReader reader) { // var properties = new EvolutionaryProperties(); // reader.StepOut(); // JsonToken token = reader.Token; this.properties = new EvolutionaryProperties(); PropertyValue[] o = context.Import<PropertyValue[]>(reader); this.SetProperties(o); return this.properties; }
/// <summary> /// Initializes a new instance of the <see cref="PTAStarSearch"/> class. /// </summary> /// <param name="properties"> /// The properties. /// </param> /// <param name="bidirectional"> /// The bidirectional. /// </param> /// <param name="provider"> /// The provider. /// </param> /// <param name="origin"> /// The origin. /// </param> /// <param name="destination"> /// The destination. /// </param> public PTAStarSearch( EvolutionaryProperties properties, bool bidirectional, INetworkDataProvider provider, INetworkNode origin, INetworkNode destination) : base(bidirectional, provider, origin, destination) { this.provider = provider; this.properties = properties; }
/// <summary> /// Initializes a new instance of the <see cref="EaJourneyPlanner"/> class. /// </summary> /// <param name="properties"> /// The <see cref="EvolutionaryProperties"/> object containing the properties of the run. /// </param> public EaJourneyPlanner(EvolutionaryProperties properties) { this.properties = properties; }
/// <summary> /// Initializes a new instance of the <see cref="TimeBlendBreeder"/> class. /// Initializes a new instance of the <see cref="StandardBreeder"/> class. /// </summary> /// <param name="properties"> /// The properties. /// </param> public TimeBlendBreeder(EvolutionaryProperties properties) { this.properties = properties; }
/// <summary> /// The save population. /// </summary> /// <param name="population"> /// The population. /// </param> /// <param name="generation"> /// The generation. /// </param> /// <param name="properties"> /// The properties. /// </param> /// <param name="filename"> /// The filename. /// </param> public static void SavePopulation( List<Critter> population, int generation, EvolutionaryProperties properties, string filename) { // Console.ForegroundColor = ConsoleColor.Green; // List<KeyValuePair<List<int>, TimeSpan>> kvps = population.ToList(); // kvps.Sort((x, y) => x.Value.CompareTo(y.Value)); // File.Delete("Results.txt"); string template = new StreamReader("Template.htm").ReadToEnd(); foreach (Critter kvp in population) { // Console.WriteLine("{0} : {1}", kvp.UnifiedFitnessScore, kvp.Key.Count); string file = filename; string markerCode = string.Empty; foreach (NodeWrapper<INetworkNode> t in kvp.Route) { int key = Convert.ToInt32(t.Node.Id); TimeSpan time = t.TotalTime; string latlng = string.Format( "new google.maps.LatLng({0},{1})", properties.NetworkDataProviders[0].GetNodeFromId(key).Latitude, properties.NetworkDataProviders[0].GetNodeFromId(key).Longitude); markerCode += string.Format( "var marker = new google.maps.Marker({{position: {0}, map: map,title:\"{1}: {2} ({3})\"}});\n", latlng, key, time.ToString(), ((PtvNode)properties.NetworkDataProviders[0].GetNodeFromId(key)).StopSpecName); } using (var sw = new StreamWriter(file, false)) { sw.Write(template.Replace(@"//##//", markerCode)); } /* using (StreamWriter sw = new StreamWriter("Results.txt", true)) { sw.WriteLine(String.Format("{0} : {1} \n", kvp.Value.ToString(CultureInfo.InvariantCulture), string.Join(",", kvp.Key))); try { sw.WriteLine( String.Format( "{0} : {1} \n\n", kvp.Value.ToString(CultureInfo.InvariantCulture), string.Join(",", kvp.Key.Select(id => properties.DataStructures.List[id][0].StopSpecName).ToList()))); } catch { string why = "why?"; } } */ } Console.ForegroundColor = ConsoleColor.Gray; }