Revision 126:242390b3f4be

View differences:

src/main/java/cz/agents/dimaptools/search/DistributedAStar.java
14 14

  
15 15
import cz.agents.alite.communication.CommunicationPerformer;
16 16
import cz.agents.alite.communication.Communicator;
17
import cz.agents.alite.communication.channel.CommunicationChannelBroadcast;
18 17
import cz.agents.alite.configurator.ConfigurationInterface;
19 18
import cz.agents.dimaptools.DIMAPWorldInterface;
20 19
import cz.agents.dimaptools.domain.Action;
......
231 230
	 * @param state
232 231
	 * @param plan
233 232
	 */
234
	private void reconstructPlan(SearchState state, List<String> plan){
233
	private void reconstructPlan(SearchState state, List<String> globalPlan){
235 234
//		System.out.println(comm.getAddress() + " reconstruct " + state.hashCode() + " - " + plan);
235
		
236
		List<String> plan = new LinkedList<String>();
236 237
		ParentState lastState = state.reconstructPlan(plan);
238
		
239
		planCallback.partialPlanReconstructed(plan);
240
		
241
		plan.addAll(globalPlan);
237 242
        if(lastState.getParentActionOwner() == null){
238 243
        	LOGGER.info(comm.getAddress() + " plan found " + state.hashCode() + " - " + plan);
239 244
        	
src/main/java/cz/agents/dimaptools/search/SearchInterface.java
20 20

  
21 21
	public interface SearchCallback{
22 22

  
23
		/**
24
		 * Once the whole plan is reconstructed this method is called by the agent reaching the initial state
25
		 * @param plan Complete plan with actions of all agents
26
		 */
23 27
		public void planFound(List<String> plan);
28
		
29
		/**
30
		 * Called each time the agent reconstructs part of the plan
31
		 * @param plan Part of the plan reconstructed by the agent - contains only the agent's actions
32
		 */
33
		public void partialPlanReconstructed(List<String> plan);
24 34

  
25 35
		public void planFoundByOther();
26 36

  
src/test/java/cz/agents/dimaptools/relaxed/TestRecursiveDistributedFFHeuristic.java
2 2

  
3 3
import org.junit.Test;
4 4

  
5
import cz.agents.alite.communication.Communicator;
6 5
import cz.agents.alite.configurator.MapConfiguration;
7 6
import cz.agents.dimaptools.DIMAPWorldInterface;
8
import cz.agents.dimaptools.domain.Problem;
9 7
import cz.agents.dimaptools.heuristic.HeuristicInterface;
10 8
import cz.agents.dimaptools.search.AbstractDistributedAStarTest;
11 9
import cz.agents.dimaptools.search.DistributedAStar;
......
14 12

  
15 13
	@Test
16 14
	public void test() {
15
//		Logger.getRootLogger().setLevel(Level.INFO);
17 16
//		testProblem("truck-crane-a2");
18 17
//		testProblem("truck-crane-factory-a3");
19 18
//		testProblem("logistics-a2");
src/test/java/cz/agents/dimaptools/search/AbstractDistributedAStarTest.java
62 62
		public void planFoundByOther() {
63 63
			System.out.println("plan found by other agent");
64 64
		}
65

  
66
		@Override
67
		public void partialPlanReconstructed(List<String> plan) {
68
			System.out.println("partial plan:\n"+plan);
69
		}
65 70
	};
66 71

  
67 72

  
src/test/java/cz/agents/dimaptools/search/TestAStar.java
75 75
			public void planFoundByOther() {
76 76

  
77 77
			}
78
			
79
			@Override
80
			public void partialPlanReconstructed(List<String> plan) {
81
				System.out.println("partial plan:\n"+plan);
82
			}
78 83
		});
79 84

  
80 85
	}
src/test/java/cz/agents/dimaptools/search/TestDistributedAStar.java
42 42
			public void planFoundByOther() {
43 43

  
44 44
			}
45
			
46
			@Override
47
			public void partialPlanReconstructed(List<String> plan) {
48
				System.out.println("partial plan:\n"+plan);
49
			}
45 50
		});
46 51
	}
47 52

  

Also available in: Unified diff