diff --git a/Problems/NPComplete/NPC_DEUTSCHJOZSA/Solvers/DeutschJozsaClassicalSolver.cs b/Problems/NPComplete/NPC_DEUTSCHJOZSA/Solvers/DeutschJozsaClassicalSolver.cs index 3a4905d..cc47274 100644 --- a/Problems/NPComplete/NPC_DEUTSCHJOZSA/Solvers/DeutschJozsaClassicalSolver.cs +++ b/Problems/NPComplete/NPC_DEUTSCHJOZSA/Solvers/DeutschJozsaClassicalSolver.cs @@ -7,7 +7,7 @@ class DeutschJozsaClassicalSolver : ISolver { // --- Fields --- public string solverName {get;} = "Deutsch Jozsa Problem - Classical Solver"; - public string solverDefinition {get;} = "This is a classical solver for the Deutsch Jozsa Problem"; + public string solverDefinition { get; } = "This solver classically solves the Deutsch-Jozsa problem by querying the oracle up to (n/2) + 1 times to determine if the function is constant or balanced."; public string source { get; } = "Deutsch, David and Jozsa, Richard. 1992. Rapid solution of problems by quantum computation. Proc. R. Soc. Lond. A439553-558"; public string[] contributors {get;} = { "George Lake", "Eric Hill", "Paul Gilbreath", "Max Gruenwoldt", "Alex Svancara" }; @@ -26,7 +26,7 @@ public string solve(DEUTSCHJOZSA problem){ // ("Balanced" or "Constant") // // NOTE: This solver returns "Breaks DJ Promise" in the event that the input does. - // Technically this breaks the idea of the input being a black box. + // Technically this breaks the idea of the input being a black box. // I kept the idea for education purposes List oracle = problem.w; @@ -39,8 +39,8 @@ public string solve(DEUTSCHJOZSA problem){ int queries_to_be_certain = (total_inputs / 2) + 1; // Check DJ promise - if (!(oracle.All(v => v == 0) || oracle.All(v => v == 1) || oracle.Count(v => v == 0) * 2 == oracle.Count)) - return "{Breaks DJ Promise}"; + if (!(oracle.All(v => v == 0) || oracle.All(v => v == 1) || oracle.Count(v => v == 0) * 2 == oracle.Count)) + return "Breaks DJ Promise"; // check the inputs for (int i = 1; i { // --- Fields --- - public string verifierName {get;} = "ProblemVerifier"; - public string verifierDefinition {get;} = "TODO"; - public string source {get;} = " "; - public string[] contributors {get;} = { "Eric Hill", "Paul Gilbreath", "Max Gruenwoldt", "Alex Svancara" }; + public string verifierName { get; } = "Deutsch Jozsa Verifier"; + public string verifierDefinition { get; } = "This verifier uses the classical solver to verify the solution to the Deutsch-Jozsa problem."; + public string source { get; } = "Deutsch, David and Jozsa, Richard. 1992. Rapid solution of problems by quantum computation. Proc. R. Soc. Lond. A439553-558"; + public string[] contributors { get; } = { "Jason L. Wright", "Eric Hill", "Paul Gilbreath", "Max Gruenwoldt", "Alex Svancara" }; private string _certificate = ""; public string certificate { @@ -18,12 +19,12 @@ public string certificate { } // --- Methods Including Constructors --- - public DeutschJozsaVerifier() { - + public DeutschJozsaVerifier() + { } public bool verify(DEUTSCHJOZSA problem, string certificate){ - // TODO: implement {VERIFIER} for {PROBLEM} - return true; + var solver = new DeutschJozsaClassicalSolver(); + return solver.solve(problem) == certificate && (certificate is "constant" or "balanced"); } }