public static void Main(string[] args) { //SuperBasic Test char[] vector = new char[] { 'A', 'B', 'G', 'T', 'A' }; foreach (var x in vector) Console.Write(x); Console.WriteLine(); int threadLimit = 10; for (int i=0; i<threadLimit; i++) { Console.WriteLine("Ejecutandose con {0} hilos:", i); Master master = new Master(vector, 3); char[] toFound = new char[] { 'G', 'T' }; double results = master.ComputeModulus(toFound); Console.WriteLine("<<{0}>>(gen) en <<{1}>>(cromosoma): {2} aparación/es.", toFound.SpecialToString(), vector.SpecialToString(), results); } Console.WriteLine(); Console.WriteLine(); //Context-Switching threadLimit = 50; char[] vector2 = CreateRandomGeneticString(1000000); char[] gens = CreateRandomGeneticString(9); String[] lines = new String[threadLimit]; for (int i=1; i<= threadLimit; i++) { Console.WriteLine("Thread Number: {0}", i); Master master = new Master(vector2, i); DateTime before = DateTime.Now; double result = master.ComputeModulus(gens); DateTime after = DateTime.Now; double ticks = (after - before).Ticks; Console.WriteLine("Result: {0}, ticks={1}", result, ticks, result); lines[i-1] = prepareDataToCSV(i, result, ticks); GC.Collect(); GC.WaitForFullGCComplete(); } ExportToCSV(@"C:\Users\Esteban\Desktop\fichero.csv", lines); }
public void ExamplesTest() { // Example 1 char[] vector1 = new char[] { 'A', 'B', 'G', 'T', 'A' }; char[] toFound1 = new char[] { 'G', 'T'}; //Example 2 char[] vector2 = new char[] { 'A','B','G','A','B'}; char[] toFound2 = new char[] { 'A','B'}; //Example 3 char[] vector3 = new char[] { 'G','T','A','A','A','A'}; char[] toFound3 = new char[] { 'A','A','A'}; int threadLimit = 5; for (int i = 1; i <= threadLimit; i++) { //Example 1 Master master1 = new Master(vector1, i); Assert.AreEqual(master1.ComputeModulus(toFound1), 1); } threadLimit = 5; for (int i = 1; i <= threadLimit; i++) { //Example 2 Master master2 = new Master(vector2, i); Assert.AreEqual(master2.ComputeModulus(toFound2), 2); } //threadLimit = 6; //for (int i = 1; i <= threadLimit; i++) //{ // //Example 3 // Master master3 = new Master(vector3, i); // Assert.AreEqual(master3.ComputeModulus(toFound3), 3); //} }