Revision 117:b65b68ac914a

View differences:

src/main/java/cz/agents/dimaptools/search/MultiheuristicDistributedAStar.java
180 180
//		        	heurCount ++;
181 181
//		        	LOGGER.info(comm.getAddress() + " HEUR++ " + heurCount);
182 182
		        	
183
		        	final List<Action> applicableActions = new LinkedList<Action>();
184
		        	for (Action action : problem.getMyActions()) {
185
                        if (action.isApplicableIn(state)) {
186
                        	applicableActions.add(action);
187
                        }
188
                    }
189
		        	
190
		        	
183 191
		        	for(final HeuristicOpenList open : openLists){
184 192
		        		
185 193
//		        		LOGGER.info(comm.getAddress() + "("+open.label+") get heuristic of state " + state.hashCode()); 
......
200 208
		                        state.setHeuristics(result.getValue());
201 209
	
202 210
		                        if (state.wasReachedByPublicAction()) {
203
		                            sendState(state);
211
		                            sendState(state);	 
204 212
		                        }
205 213
	
206 214
		                        DataAccumulator.getAccumulator().expandedStates ++;
......
208 216
		                        int applicable = 0;
209 217
		                        int pref = 0;
210 218
		                        
211
//                                TODO: consider adding the expanded state to all open lists
212
		                        
213
		                        for (Action action : problem.getMyActions()) {
214
		                            if (action.isApplicableIn(state)) {
215
		                            	++applicable;
216
		                                if(open.usePreferred() && result.hasHelpfulActions() && result.getHelpfulActions().contains(action.hashCode())){
219
		                        for (Action action : applicableActions) {
220
		                            ++applicable;
221
		                            if(open.usePreferred() && result.hasHelpfulActions() && result.getHelpfulActions().contains(action.hashCode())){
217 222
		                                	SearchState newState = state.transformBy(action,true);
218 223

  
219 224
		                                	open.add(newState, false);
220 225
		                                	open.add(newState, true);
221
//		                                	for(HeuristicOpenList aopen : openLists){
222
//			                                	aopen.add(newState, false);
223
//			                                	aopen.add(newState, true);
224
//		                                	}
226
//		                                	
225 227
		                                	++pref;
226
		                                }else{
228
		                            }else{
227 229
		                                	SearchState newState = state.transformBy(action);
228 230
		                                	open.add(newState, false);
229
//		                                	for(HeuristicOpenList aopen : openLists){
230
//		                                		aopen.add(newState, false);
231
//		                                	}
232
		                                }
233
		                                
234 231
		                            }
235 232
		                        }
236 233
		                        

Also available in: Unified diff