public void DeserializeSolutions() { Solutions d = new Solutions(); string xml = d.SerializeToXML(); d = (Solutions)xml.DeserializeXML(); Assert.IsNotNull(d); }
public void SerializeSolutions() { Solutions d = new Solutions(); string xml = d.SerializeToXML(); Assert.IsNotNull(xml); }
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 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 ReceivedSolutions(Solutions solution) { Console.WriteLine("\n" + solution.SerializeToXML()); return null; }