Changeset 13537 for branches/thasling/DistributedGA/DistributedGA.Core.Host
- Timestamp:
- 01/18/16 10:41:50 (9 years ago)
- Location:
- branches/thasling/DistributedGA/DistributedGA.Core.Host
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/thasling/DistributedGA/DistributedGA.Core.Host/Program.cs
r13524 r13537 1 using DistributedGA.Core.Domain; 1 using System; 2 using System.Threading; 3 using DistributedGA.Core.Domain; 2 4 using DistributedGA.Core.Implementation; 3 5 using DistributedGA.Core.Interface; 4 using System;5 using System.Collections.Generic;6 using System.Linq;7 using System.Text;8 using System.Threading;9 using System.Threading.Tasks;10 6 11 namespace DistributedGA.Core.Host 12 { 13 class Program 14 { 15 static void Main(string[] args) 16 { 17 try 18 { 19 Console.WriteLine("Starting peer..."); 20 IMessageHandler h = new PeerNetworkMessageHandler(); 21 h.Init(); 22 PeerInfo pi = h.GetPeerInfo(); 23 Console.WriteLine(string.Format("Peer is hostet at IP: {0} and port: {1}", pi.IpAddress, pi.Port)); 24 Thread.Sleep(1000 * 20); 25 Console.WriteLine("Current peers within network:"); 26 foreach (var item in h.GetCurrentNetwork()) 27 { 28 Console.WriteLine(string.Format("Peer at {0}:{1}",item.IpAddress, item.Port)); 29 } 30 while (true) 31 { 32 Thread.Sleep(1000 * 10); 33 var pop1 = CreatePopulation(); 34 Console.WriteLine("Publish population into network..."); 35 h.PublishMigrationInfo(pop1); 36 Console.WriteLine("Population published."); 37 Console.WriteLine("Recieved populations:"); 38 foreach (var item in h.GetMigrationInfo()) 39 { 40 Console.WriteLine(string.Format("Population with Quality: {0:2} in Iteration {1}", item.Quality, item.IterationNumber)); 41 } 42 } 43 } 44 catch (Exception ex) 45 { 46 Console.WriteLine(ex.Message); 47 Console.WriteLine("press any key to continue..."); 48 Console.ReadLine(); 49 } 7 namespace DistributedGA.Core.Host { 8 class Program { 9 static void Main(string[] args) { 10 try { 11 Console.WriteLine("Starting peer..."); 12 IMessageHandler h = new PeerNetworkMessageHandler(); 13 h.Init(); 14 PeerInfo pi = h.GetPeerInfo(); 15 Console.WriteLine(string.Format("Peer is hostet at IP: {0} and port: {1}", pi.IpAddress, pi.Port)); 16 Thread.Sleep(1000 * 20); 17 Console.WriteLine("Current peers within network:"); 18 foreach (var item in h.GetCurrentNetwork()) { 19 Console.WriteLine(string.Format("Peer at {0}:{1}", item.IpAddress, item.Port)); 20 } 21 int i = 1; 22 while (i < 10) { 23 i++; 24 Thread.Sleep(1000 * 10); 25 var pop1 = CreatePopulation(); 26 Console.WriteLine("Publish population into network..."); 27 h.PublishMigrationInfo(pop1); 28 Console.WriteLine("Population published."); 29 Console.WriteLine("Recieved populations:"); 30 foreach (var item in h.GetMigrationInfo()) { 31 Console.WriteLine(string.Format("Population with Quality: {0:2} in Iteration {1}", item.Quality, item.IterationNumber)); 32 } 33 } 34 } catch (Exception ex) { 35 Console.WriteLine(ex.Message); 36 Console.WriteLine("press any key to continue..."); 37 Console.ReadLine(); 38 } 50 39 40 } 41 42 private static SolutionInfo[] CreatePopulation() { 43 SolutionInfo si1 = new SolutionInfo() { 44 IterationNumber = 1, 45 Quality = 3.5f, 46 Solution = new Solution() { 51 47 } 52 53 private static SolutionInfo[] CreatePopulation() 54 { 55 SolutionInfo si1 = new SolutionInfo() 56 { 57 IterationNumber = 1, 58 Quality = 3.5f, 59 Solution = new Solution() 60 { 61 } 62 }; 63 SolutionInfo si2 = new SolutionInfo() 64 { 65 IterationNumber = 2, 66 Quality = 3.5f, 67 Solution = new Solution() 68 { 69 } 70 }; 71 SolutionInfo si3 = new SolutionInfo() 72 { 73 IterationNumber = 3, 74 Quality = 3.5f, 75 Solution = new Solution() 76 { 77 } 78 }; 79 return new SolutionInfo[] { si1, si2, si3 }; 48 }; 49 SolutionInfo si2 = new SolutionInfo() { 50 IterationNumber = 2, 51 Quality = 3.5f, 52 Solution = new Solution() { 80 53 } 54 }; 55 SolutionInfo si3 = new SolutionInfo() { 56 IterationNumber = 3, 57 Quality = 3.5f, 58 Solution = new Solution() { 59 } 60 }; 61 return new SolutionInfo[] { si1, si2, si3 }; 81 62 } 63 } 82 64 } -
branches/thasling/DistributedGA/DistributedGA.Core.Host/obj/Debug/DistributedGA.Core.Host.csproj.FileListAbsolute.txt
r13528 r13537 15 15 P:\_DATA\SVN\thasling\DistributedGA\DistributedGA.Core.Host\obj\Debug\DistributedGA.Core.Host.exe 16 16 P:\_DATA\SVN\thasling\DistributedGA\DistributedGA.Core.Host\obj\Debug\DistributedGA.Core.Host.pdb 17 C:\Public\SVN\DistributedGA\DistributedGA.Core.Host\bin\Debug\DistributedGA.Core.Host.exe.config 18 C:\Public\SVN\DistributedGA\DistributedGA.Core.Host\obj\Debug\DistributedGA.Core.Host.exe 19 C:\Public\SVN\DistributedGA\DistributedGA.Core.Host\obj\Debug\DistributedGA.Core.Host.pdb 20 C:\Public\SVN\DistributedGA\DistributedGA.Core.Host\bin\Debug\DistributedGA.Core.Host.exe 21 C:\Public\SVN\DistributedGA\DistributedGA.Core.Host\bin\Debug\DistributedGA.Core.Host.pdb 22 C:\Public\SVN\DistributedGA\DistributedGA.Core.Host\bin\Debug\DistributedGA.Core.dll 23 C:\Public\SVN\DistributedGA\DistributedGA.Core.Host\bin\Debug\DistributedGA.Core.pdb 24 C:\Public\SVN\DistributedGA\DistributedGA.Core.Host\obj\Debug\DistributedGA.Core.Host.csprojResolveAssemblyReference.cache
Note: See TracChangeset
for help on using the changeset viewer.