Revision 192:81be8165faab

View differences:

src/main/java/cz/agents/dimaptools/search/MultiheuristicDistributedBestFirstSearch.java
60 60
    protected void addReceivedState(final StateMessage sm, String sender){
61 61
    	final SearchState newState = new SearchState(problem.initState.getDomain(),sm,sender);
62 62
    	
63
    	if(recomputeHeuristicOnReceive){ //should be probably done for projected heuristics
64
    		for(final HeuristicOpenList open : openLists){
65
                open.getHeuristic(newState, new HeuristicComputedCallback() {
66
    				
67
    				@Override
68
    				public void heuristicComputed(HeuristicResult result) {
69
    					open.add(newState,sm.isPreferred());
70
    				}
71
    			});
72
            }
73
    	}else{
74
    		for(HeuristicOpenList open : openLists){
75
                open.add(newState,sm.isPreferred());
76
            }
63
    	for(final HeuristicOpenList open : openLists){
64
	    	if(open.recomputeHeuristicOnReceive()){ 
65
	                open.getHeuristic(newState, new HeuristicComputedCallback() {
66
	    				@Override
67
	    				public void heuristicComputed(HeuristicResult result) {
68
	    					newState.setHeuristics(Math.max(result.getValue(), sm.getH()));
69
	    					open.add(newState,sm.isPreferred());
70
	    				}
71
	    			});
72
	    	}else{
73
	    		open.add(newState,sm.isPreferred());
74
	    	}
77 75
    	}
78 76
    }
79 77

  

Also available in: Unified diff