private void button1_Click(object sender, System.EventArgs e) { CSP csp = MapCSP.getMap(); this.textBox1.Text = "Map Colouring - Backtracking " + System.Environment.NewLine; this.textBox1.Text += (csp.backTrackingSearch()); this.textBox1.Text += "Map Colouring - Minimum Conflicts " + System.Environment.NewLine; this.textBox1.Text += (csp.mcSearch(100)); }
static void Main(params string[] args) { CSP <Variable, string> csp = new MapCSP(); CspListenerStepCounter <Variable, string> stepCounter = new CspListenerStepCounter <Variable, string>(); CspSolver <Variable, string> solver; solver = new FlexibleBacktrackingSolver <Variable, string>().setAll(); solver.addCspListener(stepCounter); stepCounter.reset(); System.Console.WriteLine("Map Coloring (Backtracking + MRV & DEG + LCV + AC3)"); System.Console.WriteLine(solver.solve(csp)); System.Console.WriteLine(stepCounter.getResults() + "\n"); }
static void Main(params string[] args) { CSP <Variable, string> csp = new MapCSP(); CspListenerStepCounter <Variable, string> stepCounter = new CspListenerStepCounter <Variable, string>(); CspSolver <Variable, string> solver; solver = new MinConflictsSolver <Variable, string>(1000); solver.addCspListener(stepCounter); stepCounter.reset(); System.Console.WriteLine("Map Coloring (Minimum Conflicts)"); System.Console.WriteLine(solver.solve(csp)); System.Console.WriteLine(stepCounter.getResults() + "\n"); }