Revision 116:3dfe41608a15

View differences:

src/main/java/cz/agents/dimaptools/landmarks/LMCutHeuristic.java
100 100
	        
101 101
	        int cut_cost = Integer.MAX_VALUE;
102 102
	        for (UnaryOperator op : cut) {
103
	            cut_cost = Math.min(cut_cost, op.cost);
103
	            cut_cost = Math.min(cut_cost, op.base_cost);
104 104
	        }
105 105
	        for (UnaryOperator op : cut){
106 106
	        	op.cost -= cut_cost;
src/main/java/cz/agents/dimaptools/search/DistributedAStar.java
101 101
			@Override
102 102
			public void receivePlanningFinishedMessage(PlanningFinishedMessage msg) {
103 103
				
104
				LOGGER.warn(comm.getAddress() + " receive PLANNING_FINISHED!" );
105

  
106
				
104 107
				run = false;
105 108
				
106 109
			}
......
150 153

  
151 154
		        	if (solutionFound(state)){
152 155
	                    if (state.wasExpandedByMe(problem.agent)) {
153
	                    	LOGGER.warn(" by me ("+problem.agent+")");
156
	                    	long time =  System.currentTimeMillis() - DataAccumulator.getAccumulator().startTimeMs;
157
	                    	LOGGER.warn(" by me ("+problem.agent+") - " + time);
154 158

  
155 159
	                    	List<String> plan = new LinkedList<String>();
156 160
	                    	reconstructPlan(state, plan);
......
209 213

  
210 214
			commPerformer.performReceive();
211 215
			
212
			heuristic.processMessages();
213
			requestHeuristic.processMessages();
216
			if(search){
217
				heuristic.processMessages();
218
				requestHeuristic.processMessages();
219
			}
214 220

  
215 221
			
216 222

  
......
230 236
        if(lastState.getParentActionOwner() == null){
231 237
        	LOGGER.info(comm.getAddress() + " plan found " + state.hashCode() + " - " + plan);
232 238
        	
233
        	planCallback.planFound(plan);
239
        	LOGGER.warn(comm.getAddress() + " send PLANNING_FINISHED!" );
234 240
        	protocol.sendPlanningFinishedMessage();
235 241
        	run = false;
242
        	
243
        	planCallback.planFound(plan);
244
        	
236 245

  
237 246
        }else{
238 247
        	
src/main/java/cz/agents/dimaptools/search/MultiheuristicDistributedAStar.java
72 72
			public void receiveStateMessage(StateMessage sm, String sender) {
73 73
				if (!sender.equals(comm.getAddress())) { //TODO get rid of this expensive and stupid check!
74 74

  
75
					LOGGER.info(comm.getAddress() + " receive state " + Arrays.toString(sm.getValues()));
75
//					LOGGER.info(comm.getAddress() + " receive state " + Arrays.toString(sm.getValues()));
76 76

  
77 77
	            	for(HeuristicOpenList open : openLists){
78 78
	            		SearchState newState = new SearchState(problem.initState.getDomain(),sm,sender); 
......
158 158

  
159 159
		        	if (solutionFound(state)){
160 160
	                    if (state.wasExpandedByMe(problem.agent)) {
161
	                    	LOGGER.warn(" by me ("+problem.agent+")");
161
	                    	long time =  System.currentTimeMillis() - DataAccumulator.getAccumulator().startTimeMs;
162
	                    	LOGGER.warn(" by me ("+problem.agent+") - " + time);
162 163

  
163 164
	                    	List<String> plan = new LinkedList<String>();
164 165
	                    	reconstructPlan(state, plan);
......
233 234
		                            }
234 235
		                        }
235 236
		                        
236
		                        LOGGER.info(comm.getAddress() + " applicable(pref):"+applicable + "(" + pref + ")");
237
//		                        LOGGER.info(comm.getAddress() + " applicable(pref):"+applicable + "(" + pref + ")");
237 238
	
238 239
		                    }
239 240
		                });
......
253 254
			
254 255
			commPerformer.performReceive();
255 256

  
256
			openLists.get(currentOpenList).processMessages();
257
			if(search){
258
				openLists.get(currentOpenList).processMessages();
259
			}
257 260

  
258 261
			currentOpenList = (currentOpenList + 1) % openLists.size();
259 262

  
......
273 276
        if(lastState.getParentActionOwner() == null){
274 277
        	LOGGER.info(comm.getAddress() + " plan found " + state.hashCode() + " - " + plan);
275 278
        	
276
        	planCallback.planFound(plan);
279
        	
277 280
        	protocol.sendPlanningFinishedMessage();
278 281
        	run = false;
282
        	
283
        	planCallback.planFound(plan);
279 284

  
280 285
        }else{
281 286
        	
src/main/java/cz/agents/dimaptools/search/SearchState.java
61 61

  
62 62
		if (g > maxG) {
63 63
			maxG = g;
64
			LOGGER.info("Reached new maximal [" + parentAction.getOwner() + "] /g/: " + g);
64
			if(LOGGER.isInfoEnabled())LOGGER.info("Reached new maximal [" + parentAction.getOwner() + "] /g/: " + g);
65 65
		}
66 66

  
67 67
		//heuristic (lazy)
......
107 107
       h = heuristicValue;
108 108
       if (h < minH) {
109 109
           minH = h;
110
           LOGGER.info("Reached new minimal [" + (parentAction != null ? parentAction.getOwner() : "null") + "] /h/: " + h + (createdByPreferred?" (P) ":""));//+ ", state:"+this);
110
           if(LOGGER.isInfoEnabled())LOGGER.info("Reached new minimal [" + (parentAction != null ? parentAction.getOwner() : "null") + "] /h/: " + h + (createdByPreferred?" (P) ":""));//+ ", state:"+this);
111 111
       }
112 112
    }
113 113

  
src/test/java/cz/agents/dimaptools/landmarks/TestLMCutHeuristic.java
12 12

  
13 13
	@Test
14 14
	public void test() {
15
//		testProblem("truck-a1");
15
		testProblem("truck-a1");
16 16
//		testProblem("truck-crane-a2");
17 17
//		testProblem("logistics-a2");
18 18
//		testProblem("logistics-a4");

Also available in: Unified diff