Exemplo n.º 1
0
	public ArrayList search(Problem p)  {
		for (int i = 1; i <= limit; i++) {
			DepthLimitedSearch dls = new DepthLimitedSearch(i);
			ArrayList result = dls.search(p);
			iterationMetrics.set(NODES_EXPANDED, iterationMetrics
					.getInt(NODES_EXPANDED)
					+ dls.getMetrics().getInt(NODES_EXPANDED));
			if (!cutOffResult(result)) {
				return result;
			}
		}
		return new ArrayList();//failure
	}
Exemplo n.º 2
0
		private void btnRecursiveDLS_Click(object sender, System.EventArgs e)
		{
			this.textBox1.Text = "NQueensDemo recursive DLS -->" + System.Environment.NewLine;

			Problem problem =  new Problem(new NQueensBoard(8),new NQueensSuccessorFunction(), new NQueensGoalTest());
			Search search = new DepthLimitedSearch(8);
			SearchAgent agent = new SearchAgent(problem, search);
			printActions(agent.getActions());
			printInstrumentation(agent.getInstrumentation());
		}
Exemplo n.º 3
0
		private void btnRecursiveDLS_Click(object sender, System.EventArgs e)
		{
			this.textBox1.Text = "EightPuzzleDemo recursive DLS-->" + System.Environment.NewLine;
			Problem problem = new Problem(random1,
				new EightPuzzleSuccessorFunction(),
				new EightPuzzleGoalTest());
			Search search = new DepthLimitedSearch(9);
			SearchAgent agent = new SearchAgent(problem, search);
			printActions(agent.getActions());
			printInstrumentation(agent.getInstrumentation());
		}