public void DeserializeSolutions() { Solutions d = new Solutions(); string xml = d.SerializeToXML(); d = (Solutions)xml.DeserializeXML(); Assert.IsNotNull(d); }
protected abstract string ReceivedSolutions(Solutions solution);
public void SerializeSolutions() { Solutions d = new Solutions(); string xml = d.SerializeToXML(); Assert.IsNotNull(xml); }
protected override string ReceivedSolutions(Solutions solution) { Debug.Assert(false, "Should not be here"); return null; }
protected override string ReceivedSolutions(Solutions solution) { this.serverQueues.Solutions.Enqueue(solution); //if(this.BackupMode == true) // return null; Console.WriteLine("\n****\nSolution delivered with id: \n****\n"+solution.Id); NoOperation noOp = this.GenerateNoOperation(); Console.WriteLine("Sending NoOp as an ans to Solutions"); return noOp.SerializeToXML(); }
protected override string ReceivedSolutionRequest(SolutionRequest solutionRequest) { /* Solution Request message is sent from the CC in order to check whether the cluster has successfully * computed the solution. It allows CC to be shut down and disconnected from server during computations. */ Solutions solution = new Solutions(); List<Solutions> solutions = this.serverQueues.FinalSolutions.ToList(); foreach (Solutions s in solutions) { if (s.Id == solutionRequest.Id) { solution = s; break; } } if (!this.BackupMode) Console.WriteLine("Sending Solutions"); return solution.SerializeToXML(); }
protected override string ReceivedSolvePartialProblems(SolvePartialProblems solvePartialProblems) { ///// Hey here is the problem to solve! (undivided, everything is in CommonData) string problem = Utilities.Base64Decode(solvePartialProblems.CommonData); globalProblem = problem; //solvePartialProblems.Id; NodeWorker worker = new NodeWorker(solvePartialProblems.Id); worker.problemObject = ProblemLoader.loadnewExampleString(globalProblem); Workers.Add(worker); double sol = worker.calculateAlgorithm(); Solutions solutions = new Solutions(); solutions.Id = solvePartialProblems.Id; solutions.CommonData = Utilities.Base64Encode(sol.ToString()); Console.WriteLine("How Long = " + this.Workers.First().HowLong); CMSocket.Instance.SendMessage(this.Port, this.IP, solutions.SerializeToXML(), this); return null; }
protected override string ReceivedSolutions(Solutions solution) { Console.WriteLine("\n" + solution.SerializeToXML()); return null; }