diff --git a/Interfaces/SolverInterface.cs b/Interfaces/SolverInterface.cs index 0ba17ec8..ba0085aa 100644 --- a/Interfaces/SolverInterface.cs +++ b/Interfaces/SolverInterface.cs @@ -1,6 +1,3 @@ -using API.Interfaces.JSON_Objects; -using API.Interfaces.JSON_Objects.Graphs; -using API.Tools; namespace API.Interfaces; @@ -10,6 +7,21 @@ interface ISolver { string source {get;} string[] contributors { get; } + bool timerHasExpired { get; set; } + + /// + /// Called when the run time timer for this solver has run out. The solver is + /// expected to check the "timerHasExpired" periodically and abandon the solution + /// if the flag is found to be true. + /// + public void TimerExpired() + { + timerHasExpired = true; + } + public void ResetTimer() + { + timerHasExpired = false; + } string solve(string problem); List GetSteps(string instance) @@ -23,10 +35,29 @@ string ISolver.solve(string problem) { // Should there be some sort of contraint that assures there is a constructor // that matches the signature of a single `string` argument? // Perhaps a static `FromInstance(string instance)` method for `IProblem` will work. - return solve((T)Activator.CreateInstance(typeof(T), problem)); + T problemInstance = (T)Activator.CreateInstance(typeof(T), problem); + if (problemInstance == null) + throw new ArgumentException($"Could not create problem instance for {problem}."); + + string result = "no solution found"; + Thread thread = new Thread(() => result = solve(problemInstance)); + + // start the thread + ResetTimer(); + thread.Start(); + + // after 5 seconds w/out finishing, tell the thread it's time + // is up and wait for it to finish up. + // XXX make the solution time configurable + if (thread.Join(new TimeSpan(0, 0, 5)) == false) + { + TimerExpired(); + thread.Join(); + } + return result; } - string solve(T problem); + string solve(T problem); List ISolver.GetSteps(string instance) { diff --git a/Problems/NPComplete/NPC_ARCSET/Solvers/ArcSetBruteForce.cs b/Problems/NPComplete/NPC_ARCSET/Solvers/ArcSetBruteForce.cs index d1b4af07..b81b65d0 100644 --- a/Problems/NPComplete/NPC_ARCSET/Solvers/ArcSetBruteForce.cs +++ b/Problems/NPComplete/NPC_ARCSET/Solvers/ArcSetBruteForce.cs @@ -13,6 +13,7 @@ class ArcSetBruteForce : ISolver { public string source {get;} = ""; public string[] contributors {get;} = { "Alex Diviney","Caleb Eardley","Russell Phillips"}; + public bool timerHasExpired { get; set; } // --- Methods Including Constructors --- public ArcSetBruteForce() { diff --git a/Problems/NPComplete/NPC_BERNSTEINVAZIRANI/Solvers/BernsteinVaziraniClassicalSolver.cs b/Problems/NPComplete/NPC_BERNSTEINVAZIRANI/Solvers/BernsteinVaziraniClassicalSolver.cs index afa8d365..ca885c69 100644 --- a/Problems/NPComplete/NPC_BERNSTEINVAZIRANI/Solvers/BernsteinVaziraniClassicalSolver.cs +++ b/Problems/NPComplete/NPC_BERNSTEINVAZIRANI/Solvers/BernsteinVaziraniClassicalSolver.cs @@ -8,6 +8,7 @@ class BernsteinVaziraniClassicalSolver : ISolver { public string solverDefinition { get; } = "This is a classical verifier for the Bernstein-Vazirani problem which runs in O(n) time."; public string source {get;} = ""; public string[] contributors {get;} = { "Jason L. Wright" }; + public bool timerHasExpired { get; set; } // --- Methods Including Constructors --- public BernsteinVaziraniClassicalSolver() {} diff --git a/Problems/NPComplete/NPC_CLIQUE/Solvers/CliqueBruteForce.cs b/Problems/NPComplete/NPC_CLIQUE/Solvers/CliqueBruteForce.cs index fe74bb07..98b74d5d 100644 --- a/Problems/NPComplete/NPC_CLIQUE/Solvers/CliqueBruteForce.cs +++ b/Problems/NPComplete/NPC_CLIQUE/Solvers/CliqueBruteForce.cs @@ -12,6 +12,7 @@ class CliqueBruteForce : ISolver { public string solverDefinition {get;} = "This is a brute force solver for the NP-Complete Clique problem"; public string source {get;} = ""; public string[] contributors {get;} = {"Caleb Eardley", "Kaden Marchetti"}; + public bool timerHasExpired { get; set; } // --- Methods Including Constructors --- public CliqueBruteForce() { diff --git a/Problems/NPComplete/NPC_CLIQUECOVER/Solvers/CliqueCoverBruteForce.cs b/Problems/NPComplete/NPC_CLIQUECOVER/Solvers/CliqueCoverBruteForce.cs index bd604314..80ba39f7 100644 --- a/Problems/NPComplete/NPC_CLIQUECOVER/Solvers/CliqueCoverBruteForce.cs +++ b/Problems/NPComplete/NPC_CLIQUECOVER/Solvers/CliqueCoverBruteForce.cs @@ -10,6 +10,7 @@ class CliqueCoverBruteForce : ISolver { public string solverDefinition {get;} = "This is a brute force solver for the NP-Complete Clique Cover problem"; public string source {get;} = ""; public string[] contributors {get;} = { "Andrija Sevaljevic" }; + public bool timerHasExpired { get; set; } // --- Methods Including Constructors --- public CliqueCoverBruteForce() diff --git a/Problems/NPComplete/NPC_CUT/Solvers/CutBruteForce.cs b/Problems/NPComplete/NPC_CUT/Solvers/CutBruteForce.cs index bd8879a5..9ffff219 100644 --- a/Problems/NPComplete/NPC_CUT/Solvers/CutBruteForce.cs +++ b/Problems/NPComplete/NPC_CUT/Solvers/CutBruteForce.cs @@ -10,8 +10,9 @@ class CutBruteForce : ISolver { public string solverDefinition {get;} = "This is a brute force solver for the Cut problem"; public string source {get;} = ""; public string[] contributors {get;} = {"Andrija Sevaljevic"}; + public bool timerHasExpired { get; set; } -public CutBruteForce() { + public CutBruteForce() { } private long factorial(long x){ diff --git a/Problems/NPComplete/NPC_DEUTSCH/Solvers/DeutschClassicalSolver.cs b/Problems/NPComplete/NPC_DEUTSCH/Solvers/DeutschClassicalSolver.cs index b786120f..e10a0de0 100644 --- a/Problems/NPComplete/NPC_DEUTSCH/Solvers/DeutschClassicalSolver.cs +++ b/Problems/NPComplete/NPC_DEUTSCH/Solvers/DeutschClassicalSolver.cs @@ -8,6 +8,7 @@ class DeutschClassicalSolver : ISolver { public string solverDefinition {get;} = "This is a classical solver for the Deutsch Problem"; public string source {get;} = ""; public string[] contributors {get;} = { "Jason L. Wright" }; + public bool timerHasExpired { get; set; } // --- Methods Including Constructors --- public DeutschClassicalSolver() {} diff --git a/Problems/NPComplete/NPC_DEUTSCHJOZSA/Solvers/DeutschJozsaClassicalSolver.cs b/Problems/NPComplete/NPC_DEUTSCHJOZSA/Solvers/DeutschJozsaClassicalSolver.cs index 5211af5b..08e384fd 100644 --- a/Problems/NPComplete/NPC_DEUTSCHJOZSA/Solvers/DeutschJozsaClassicalSolver.cs +++ b/Problems/NPComplete/NPC_DEUTSCHJOZSA/Solvers/DeutschJozsaClassicalSolver.cs @@ -10,6 +10,7 @@ class DeutschJozsaClassicalSolver : ISolver { public string solverDefinition {get;} = "This is a classical solver for the Deutsch Jozsa Problem"; public string source {get;} = "TODO"; public string[] contributors {get;} = { "George Lake", "Eric Hill", "Paul Gilbreath", "Max Gruenwoldt", "Alex Svancara" }; + public bool timerHasExpired { get; set; } // --- Methods Including Constructors --- public DeutschJozsaClassicalSolver() {} diff --git a/Problems/NPComplete/NPC_DIRECTEDHAMILTONIAN/Solvers/DirectedHamiltonianBruteForce.cs b/Problems/NPComplete/NPC_DIRECTEDHAMILTONIAN/Solvers/DirectedHamiltonianBruteForce.cs index e752b590..0c717139 100644 --- a/Problems/NPComplete/NPC_DIRECTEDHAMILTONIAN/Solvers/DirectedHamiltonianBruteForce.cs +++ b/Problems/NPComplete/NPC_DIRECTEDHAMILTONIAN/Solvers/DirectedHamiltonianBruteForce.cs @@ -10,6 +10,7 @@ class DirectedHamiltonianBruteForce : ISolver { public string solverDefinition {get;} = "This is a brute force solver for the NP-Complete Directed Hamiltonian Path problem"; public string source {get;} = ""; public string[] contributors {get;} = { "Andrija Sevaljevic" }; + public bool timerHasExpired { get; set; } // --- Methods Including Constructors --- public DirectedHamiltonianBruteForce() diff --git a/Problems/NPComplete/NPC_DM3/Solvers/ThreeDimensionalMatchingBruteForce.cs b/Problems/NPComplete/NPC_DM3/Solvers/ThreeDimensionalMatchingBruteForce.cs index d1662924..386ed11c 100644 --- a/Problems/NPComplete/NPC_DM3/Solvers/ThreeDimensionalMatchingBruteForce.cs +++ b/Problems/NPComplete/NPC_DM3/Solvers/ThreeDimensionalMatchingBruteForce.cs @@ -9,6 +9,7 @@ class ThreeDimensionalMatchingBruteForce : ISolver { public string solverDefinition {get;} = "This is a generic local search solver for 3-Dimensional Matching, which, while possible, removes one constraint from the current solution, and swaps in two more constraints."; public string source {get;} = ""; public string[] contributors {get;} = { "Caleb Eardley"}; + public bool timerHasExpired { get; set; } // --- Methods Including Constructors --- public ThreeDimensionalMatchingBruteForce() { diff --git a/Problems/NPComplete/NPC_EXACTCOVER/Solvers/DancingLinks.cs b/Problems/NPComplete/NPC_EXACTCOVER/Solvers/DancingLinks.cs index fe18db8f..4a4e7a3b 100644 --- a/Problems/NPComplete/NPC_EXACTCOVER/Solvers/DancingLinks.cs +++ b/Problems/NPComplete/NPC_EXACTCOVER/Solvers/DancingLinks.cs @@ -9,6 +9,7 @@ class DancingLinks : ISolver { public string solverDefinition {get;} = ""; public string source {get;} = ""; public string[] contributors {get;} = { "Andrija Sevaljevic"}; + public bool timerHasExpired { get; set; } // --- Methods Including Constructors --- public DancingLinks() { diff --git a/Problems/NPComplete/NPC_EXACTCOVER/Solvers/ExactCoverBruteForce.cs b/Problems/NPComplete/NPC_EXACTCOVER/Solvers/ExactCoverBruteForce.cs index da0cd8c6..09d07ea2 100644 --- a/Problems/NPComplete/NPC_EXACTCOVER/Solvers/ExactCoverBruteForce.cs +++ b/Problems/NPComplete/NPC_EXACTCOVER/Solvers/ExactCoverBruteForce.cs @@ -8,6 +8,7 @@ class ExactCoverBruteForce : ISolver { public string solverDefinition {get;} = "This is a generic brute force solver for Exact Cover"; public string source {get;} = ""; public string[] contributors {get;} = { "Caleb Eardley"}; + public bool timerHasExpired { get; set; } // --- Methods Including Constructors --- public ExactCoverBruteForce() { diff --git a/Problems/NPComplete/NPC_EXACTCOVER/Solvers/ExactCoverRecursive.cs b/Problems/NPComplete/NPC_EXACTCOVER/Solvers/ExactCoverRecursive.cs index cbfeede2..f8cd156d 100644 --- a/Problems/NPComplete/NPC_EXACTCOVER/Solvers/ExactCoverRecursive.cs +++ b/Problems/NPComplete/NPC_EXACTCOVER/Solvers/ExactCoverRecursive.cs @@ -8,6 +8,7 @@ class ExactCoverRecursive : ISolver { public string solverDefinition {get;} = "This is a optimized recursive solver for Exact Cover"; public string source {get;} = ""; public string[] contributors {get;} = { "Russell Phillips"}; + public bool timerHasExpired { get; set; } // --- Methods Including Constructors --- public ExactCoverRecursive() { diff --git a/Problems/NPComplete/NPC_GRAPHCOLORING/Solvers/GraphColoringBruteForce.cs b/Problems/NPComplete/NPC_GRAPHCOLORING/Solvers/GraphColoringBruteForce.cs index d5b5c96f..5e55ded2 100644 --- a/Problems/NPComplete/NPC_GRAPHCOLORING/Solvers/GraphColoringBruteForce.cs +++ b/Problems/NPComplete/NPC_GRAPHCOLORING/Solvers/GraphColoringBruteForce.cs @@ -10,6 +10,7 @@ class GraphColoringBruteForce : ISolver { public string solverDefinition {get;} = "This is a brute force solver for the NP-Complete Graph Coloring problem"; public string source {get;} = ""; public string[] contributors {get;} = { "Andrija Sevaljevic" }; + public bool timerHasExpired { get; set; } // --- Methods Including Constructors --- public GraphColoringBruteForce() diff --git a/Problems/NPComplete/NPC_HAMILTONIAN/Solvers/HamiltonianBruteForce.cs b/Problems/NPComplete/NPC_HAMILTONIAN/Solvers/HamiltonianBruteForce.cs index df3a11f9..03a8be9d 100644 --- a/Problems/NPComplete/NPC_HAMILTONIAN/Solvers/HamiltonianBruteForce.cs +++ b/Problems/NPComplete/NPC_HAMILTONIAN/Solvers/HamiltonianBruteForce.cs @@ -10,6 +10,7 @@ class HamiltonianBruteForce : ISolver { public string solverDefinition {get;} = "This is a brute force solver for the NP-Complete Hamiltonian Path problem"; public string source {get;} = ""; public string[] contributors {get;} = { "Andrija Sevaljevic" }; + public bool timerHasExpired { get; set; } // --- Methods Including Constructors --- public HamiltonianBruteForce() diff --git a/Problems/NPComplete/NPC_HITTINGSET/Solvers/HittingSetBruteForce.cs b/Problems/NPComplete/NPC_HITTINGSET/Solvers/HittingSetBruteForce.cs index a9a354d2..a7150cea 100644 --- a/Problems/NPComplete/NPC_HITTINGSET/Solvers/HittingSetBruteForce.cs +++ b/Problems/NPComplete/NPC_HITTINGSET/Solvers/HittingSetBruteForce.cs @@ -11,6 +11,7 @@ class HittingSetBruteForce : ISolver { public string solverDefinition {get;} = "This is a brute force solver for Hitting Set"; public string source {get;} = ""; public string[] contributors {get;} = {"Russell Phillips"}; + public bool timerHasExpired { get; set; } // --- Methods Including Constructors --- public HittingSetBruteForce() { diff --git a/Problems/NPComplete/NPC_INDEPENDENTSET/Solvers/IndependentSetBruteForce.cs b/Problems/NPComplete/NPC_INDEPENDENTSET/Solvers/IndependentSetBruteForce.cs index 846b2903..2abb9821 100644 --- a/Problems/NPComplete/NPC_INDEPENDENTSET/Solvers/IndependentSetBruteForce.cs +++ b/Problems/NPComplete/NPC_INDEPENDENTSET/Solvers/IndependentSetBruteForce.cs @@ -10,6 +10,7 @@ class IndependentSetBruteForce : ISolver { public string solverDefinition {get;} = "This is a brute force solver for the NP-Complete Independent Set problem"; public string source {get;} = ""; public string[] contributors {get;} = {"Russell Phillips"}; + public bool timerHasExpired { get; set; } // --- Methods Including Constructors --- public IndependentSetBruteForce() { diff --git a/Problems/NPComplete/NPC_INTPROGRAMMING01/Solvers/IntegerProgrammingBruteForce.cs b/Problems/NPComplete/NPC_INTPROGRAMMING01/Solvers/IntegerProgrammingBruteForce.cs index af38b7e4..4b03abf5 100644 --- a/Problems/NPComplete/NPC_INTPROGRAMMING01/Solvers/IntegerProgrammingBruteForce.cs +++ b/Problems/NPComplete/NPC_INTPROGRAMMING01/Solvers/IntegerProgrammingBruteForce.cs @@ -8,6 +8,7 @@ class IntegerProgrammingBruteForce : ISolver { public string solverDefinition {get;} = "This is a generic brute force solver for 0-1 Integer Programming"; public string source {get;} = ""; public string[] contributors {get;} = { "Caleb Eardley"}; + public bool timerHasExpired { get; set; } // --- Methods Including Constructors --- public IntegerProgrammingBruteForce() { diff --git a/Problems/NPComplete/NPC_JOBSEQ/Solvers/JobSeqBruteForce.cs b/Problems/NPComplete/NPC_JOBSEQ/Solvers/JobSeqBruteForce.cs index a105b208..3ba62171 100644 --- a/Problems/NPComplete/NPC_JOBSEQ/Solvers/JobSeqBruteForce.cs +++ b/Problems/NPComplete/NPC_JOBSEQ/Solvers/JobSeqBruteForce.cs @@ -10,6 +10,7 @@ class JobSeqBruteForce : ISolver { public string solverDefinition {get;} = "This is a brute force solver for the NP-Complete Job Sequencing problem"; public string source {get;} = ""; public string[] contributors {get;} = {"Russell Phillips"}; + public bool timerHasExpired { get; set; } // --- Methods Including Constructors --- public JobSeqBruteForce() { diff --git a/Problems/NPComplete/NPC_KNAPSACK/Solvers/KnapsackBruteForce.cs b/Problems/NPComplete/NPC_KNAPSACK/Solvers/KnapsackBruteForce.cs index d8cb0a46..e25c9948 100644 --- a/Problems/NPComplete/NPC_KNAPSACK/Solvers/KnapsackBruteForce.cs +++ b/Problems/NPComplete/NPC_KNAPSACK/Solvers/KnapsackBruteForce.cs @@ -10,6 +10,7 @@ class KnapsackBruteForce : ISolver { public string solverDefinition {get;} = "This a brute force solver for the 0-1 Knapsack problem"; public string source {get;} = ""; public string[] contributors {get;} = { "Russell Phillips"}; + public bool timerHasExpired { get; set; } public string complexity {get;} = "O(2^n)"; diff --git a/Problems/NPComplete/NPC_NODESET/Solvers/NodeSetBruteForce.cs b/Problems/NPComplete/NPC_NODESET/Solvers/NodeSetBruteForce.cs index fc0c18e2..69183d9e 100644 --- a/Problems/NPComplete/NPC_NODESET/Solvers/NodeSetBruteForce.cs +++ b/Problems/NPComplete/NPC_NODESET/Solvers/NodeSetBruteForce.cs @@ -10,8 +10,9 @@ class NodeSetBruteForce : ISolver { public string solverDefinition {get;} = "This is a brute force solver for the Node Set problem"; public string source {get;} = ""; public string[] contributors {get;} = {"Andrija Sevaljevic"}; + public bool timerHasExpired { get; set; } -public NodeSetBruteForce() { + public NodeSetBruteForce() { } private long factorial(long x){ diff --git a/Problems/NPComplete/NPC_PARTITION/Solvers/PartitionBruteForce.cs b/Problems/NPComplete/NPC_PARTITION/Solvers/PartitionBruteForce.cs index 08cdabe6..3aa2e9f1 100644 --- a/Problems/NPComplete/NPC_PARTITION/Solvers/PartitionBruteForce.cs +++ b/Problems/NPComplete/NPC_PARTITION/Solvers/PartitionBruteForce.cs @@ -10,6 +10,7 @@ class PartitionBruteForce : ISolver { public string solverDefinition {get;} = "This is a brute force solver for the Partition problem"; public string source {get;} = ""; public string[] contributors {get;} = {"Andrija Sevaljevic"}; + public bool timerHasExpired { get; set; } // --- Methods Including Constructors --- public PartitionBruteForce() { diff --git a/Problems/NPComplete/NPC_SAT/Solvers/SATBruteForceSolver.cs b/Problems/NPComplete/NPC_SAT/Solvers/SATBruteForceSolver.cs index 149d3f1b..0afbf491 100644 --- a/Problems/NPComplete/NPC_SAT/Solvers/SATBruteForceSolver.cs +++ b/Problems/NPComplete/NPC_SAT/Solvers/SATBruteForceSolver.cs @@ -17,6 +17,7 @@ public class SATBruteForceSolver : ISolver { public string solverDefinition {get;} = "This is a simple brute force solver for SAT"; public string source {get;} = ""; public string[] contributors {get;} = { "Daniel Igbokwe, Show Pratoomratana"}; + public bool timerHasExpired { get; set; } #endregion @@ -117,7 +118,10 @@ public string solve(string SATInstance){ // Loop through all combinations. The total number of binary choices you can make is 2^(number of items). E.G. 3 variables is 2^3. for (int currentCombination = 0; currentCombination < Math.Pow(2, literals.Count); currentCombination++){ int trueClauses = 0; - foreach (List currentClause in clause){ + if (timerHasExpired) + return "timeout"; + + foreach (List currentClause in clause){ // change the T/F values of the literals. Starts with at least 1 being true by incrementing at the start. literalDict = increment(literalDict); bool currentEvaluation = evaluate(literalDict, currentClause); diff --git a/Problems/NPComplete/NPC_SAT3/Solvers/Sat3BacktrackingSolver.cs b/Problems/NPComplete/NPC_SAT3/Solvers/Sat3BacktrackingSolver.cs index 9fa30133..664e3677 100644 --- a/Problems/NPComplete/NPC_SAT3/Solvers/Sat3BacktrackingSolver.cs +++ b/Problems/NPComplete/NPC_SAT3/Solvers/Sat3BacktrackingSolver.cs @@ -11,6 +11,7 @@ class Sat3BacktrackingSolver : ISolver { public string solverDefinition {get;} = "This is a O(n!) solution algorithm for the 3SAT problem which implements a back tracking algorithm to find and exact assignment boolean assignment of variable to satisfy the broblem instance."; public string source {get;} = ""; public string[] contributors {get;} = {"David Lindeman","Kaden Marchetti"}; + public bool timerHasExpired { get; set; } // --- Methods Including Constructors --- public Sat3BacktrackingSolver() { diff --git a/Problems/NPComplete/NPC_SETCOVER/Solvers/HeuristicSolver.cs b/Problems/NPComplete/NPC_SETCOVER/Solvers/HeuristicSolver.cs index 2064620a..b292e309 100644 --- a/Problems/NPComplete/NPC_SETCOVER/Solvers/HeuristicSolver.cs +++ b/Problems/NPComplete/NPC_SETCOVER/Solvers/HeuristicSolver.cs @@ -9,6 +9,7 @@ class HeuristicSolver : ISolver { public string solverDefinition {get;} = ""; public string source {get;} = ""; public string[] contributors {get;} = { "Andrija Sevaljevic" }; + public bool timerHasExpired { get; set; } // --- Methods Including Constructors --- public HeuristicSolver() diff --git a/Problems/NPComplete/NPC_SETCOVER/Solvers/SetCoverBruteForce.cs b/Problems/NPComplete/NPC_SETCOVER/Solvers/SetCoverBruteForce.cs index 43d04df7..764e6a10 100644 --- a/Problems/NPComplete/NPC_SETCOVER/Solvers/SetCoverBruteForce.cs +++ b/Problems/NPComplete/NPC_SETCOVER/Solvers/SetCoverBruteForce.cs @@ -11,6 +11,7 @@ class SetCoverBruteForce : ISolver { public string solverDefinition {get;} = "This is a brute force solver for the NP-Complete Set Cover problem"; public string source {get;} = ""; public string[] contributors {get;} = { "Andrija Sevaljevic" }; + public bool timerHasExpired { get; set; } // --- Methods Including Constructors --- public SetCoverBruteForce() diff --git a/Problems/NPComplete/NPC_STEINERTREE/Solvers/SteinerTreeBruteForce.cs b/Problems/NPComplete/NPC_STEINERTREE/Solvers/SteinerTreeBruteForce.cs index b0d99949..f7162c40 100644 --- a/Problems/NPComplete/NPC_STEINERTREE/Solvers/SteinerTreeBruteForce.cs +++ b/Problems/NPComplete/NPC_STEINERTREE/Solvers/SteinerTreeBruteForce.cs @@ -10,6 +10,7 @@ class SteinerTreeBruteForce : ISolver { public string solverDefinition {get;} = "This is a brute force solver for the NP-Complete Steiner Tree problem"; public string source {get;} = ""; public string[] contributors {get;} = { "Andrija Sevaljevic" }; + public bool timerHasExpired { get; set; } // --- Methods Including Constructors --- public SteinerTreeBruteForce() diff --git a/Problems/NPComplete/NPC_SUBSETSUM/Solvers/SubsetSumBruteForce.cs b/Problems/NPComplete/NPC_SUBSETSUM/Solvers/SubsetSumBruteForce.cs index c5bbf5ae..f8ad0180 100644 --- a/Problems/NPComplete/NPC_SUBSETSUM/Solvers/SubsetSumBruteForce.cs +++ b/Problems/NPComplete/NPC_SUBSETSUM/Solvers/SubsetSumBruteForce.cs @@ -8,6 +8,7 @@ class SubsetSumBruteForce : ISolver { public string solverDefinition {get;} = "This is a brute force solver for Subset Sum"; public string source {get;} = ""; public string[] contributors {get;} = { "Caleb Eardley","Garret Stouffer"}; + public bool timerHasExpired { get; set; } // --- Methods Including Constructors --- public SubsetSumBruteForce() { diff --git a/Problems/NPComplete/NPC_TSP/Solvers/TSPBruteForce.cs b/Problems/NPComplete/NPC_TSP/Solvers/TSPBruteForce.cs index 4321ee4e..da528995 100644 --- a/Problems/NPComplete/NPC_TSP/Solvers/TSPBruteForce.cs +++ b/Problems/NPComplete/NPC_TSP/Solvers/TSPBruteForce.cs @@ -10,6 +10,7 @@ class TSPBruteForce : ISolver { public string solverDefinition {get;} = "This is a brute force solver for the NP-Complete Traveling Sales Person problem"; public string source {get;} = ""; public string[] contributors {get;} = { "Andrija Sevaljevic" }; + public bool timerHasExpired { get; set; } // --- Methods Including Constructors --- public TSPBruteForce() diff --git a/Problems/NPComplete/NPC_VERTEXCOVER/Solvers/VertexCoverBruteForce.cs b/Problems/NPComplete/NPC_VERTEXCOVER/Solvers/VertexCoverBruteForce.cs index f1aea3b3..8c41697f 100644 --- a/Problems/NPComplete/NPC_VERTEXCOVER/Solvers/VertexCoverBruteForce.cs +++ b/Problems/NPComplete/NPC_VERTEXCOVER/Solvers/VertexCoverBruteForce.cs @@ -11,6 +11,7 @@ class VertexCoverBruteForce : ISolver { public string solverDefinition {get;} = "This solver simply tests combinations of nodes of size k until a solution is found, or all combinations are tested."; public string source {get;} = ""; public string[] contributors {get;} = { "Caleb Eardley"}; + public bool timerHasExpired { get; set; } // --- Methods Including Constructors --- public VertexCoverBruteForce() { diff --git a/Problems/NPComplete/NPC_WEIGHTEDCUT/Solvers/WeightedCutBruteForce.cs b/Problems/NPComplete/NPC_WEIGHTEDCUT/Solvers/WeightedCutBruteForce.cs index 73e5ab8b..11c454d6 100644 --- a/Problems/NPComplete/NPC_WEIGHTEDCUT/Solvers/WeightedCutBruteForce.cs +++ b/Problems/NPComplete/NPC_WEIGHTEDCUT/Solvers/WeightedCutBruteForce.cs @@ -10,6 +10,7 @@ class WeightedCutBruteForce : ISolver { public string solverDefinition {get;} = "This is a brute force solver for the Weighted Cut problem"; public string source {get;} = ""; public string[] contributors {get;} = { "Andrija Sevaljevic" }; + public bool timerHasExpired { get; set; } public WeightedCutBruteForce() { @@ -126,4 +127,3 @@ public string solve(WEIGHTEDCUT cut) return "{}"; } } -