Revision 199:1021ef528603

View differences:

src/main/java/cz/agents/dimaptools/search/DistributedBestFirstSearch.java
296 296

  
297 297
        plan.addAll(globalPlan);
298 298
        if(lastState.getParentActionOwner() == null){
299
            LOGGER.info(comm.getAddress() + " plan found " + state.hashCode() + " - " + plan);
300

  
301
            LOGGER.warn(comm.getAddress() + " send PLANNING_FINISHED!" );
302
            protocol.sendPlanningFinishedMessage();
303
            run = false;
304

  
305
            planCallback.planFound(plan);
299
        	if(bestReconstructedPlanCost >= solutionCost){
300
        		if(LOGGER.isInfoEnabled()){
301
		            LOGGER.info(comm.getAddress() + " plan found " + state.hashCode() + " - " + plan);
302
		            LOGGER.info(comm.getAddress() + " send PLANNING_FINISHED!" );
303
        		}
304
	            protocol.sendPlanningFinishedMessage();
305
	            run = false;
306
	
307
	            planCallback.planFound(plan);
308
        	}
306 309

  
307 310

  
308 311
        }else{
......
356 359

  
357 360
    protected boolean solutionFound(SearchState state) {
358 361
        if (state.unifiesWith(problem.goalSuperState)) {
359
            LOGGER.info("SOLUTION of cost "+state.getG()+" FOUND[" + problem.agent + "]: " + Arrays.toString(state.getValues()));
360

  
361
            LOGGER.info("OPEN-SIZE[" + problem.agent + "]" + open.size());
362
            LOGGER.info("CLOSED-SIZE[" + problem.agent + "]" + closed.size());
362
        	if(LOGGER.isInfoEnabled()){
363
	            LOGGER.info("SOLUTION of cost "+state.getG()+" FOUND[" + problem.agent + "]: " + Arrays.toString(state.getValues()));
364
	
365
	            LOGGER.info("OPEN-SIZE[" + problem.agent + "]" + open.size());
366
	            LOGGER.info("CLOSED-SIZE[" + problem.agent + "]" + closed.size());
367
        	}
363 368

  
364 369
            return true;
365 370
        }
src/main/java/cz/agents/dimaptools/search/GlobalLocalDistributedBestFirstSearch.java
401 401
            bestReconstructedPlanBy = initiator;
402 402
            bestReconstructedPlanCost = solutionCost;
403 403
        }else{
404
            if(bestReconstructedPlanCost < solutionCost || bestReconstructedPlanBy.compareTo(initiator) < 0){
405
                LOGGER.info(comm.getAddress() +  " plan("+bestReconstructedPlanCost+") already reconstructed by "+initiator+" stop reconstruction of plan("+solutionCost+")");
406
                return;
407
            }
404
//            if(bestReconstructedPlanCost < solutionCost || bestReconstructedPlanBy.compareTo(initiator) < 0){
405
//                LOGGER.info(comm.getAddress() +  " plan("+bestReconstructedPlanCost+") already reconstructed by "+initiator+" stop reconstruction of plan("+solutionCost+")");
406
//                return;
407
//            }
408 408
        }
409 409

  
410 410
        List<String> plan = new LinkedList<String>();
......
414 414

  
415 415
        plan.addAll(globalPlan);
416 416
        if(lastState.getParentActionOwner() == null){
417
            LOGGER.info(comm.getAddress() + " plan found " + state.hashCode() + " - " + plan);
418

  
419
            LOGGER.warn(comm.getAddress() + " send PLANNING_FINISHED!" );
420
            protocol.sendPlanningFinishedMessage();
421
            run = false;
422

  
423
            planCallback.planFound(plan);
417
        	
418
        	if(bestReconstructedPlanCost >= solutionCost){
419
        		if(LOGGER.isInfoEnabled()){
420
        			LOGGER.info(comm.getAddress() + " plan found " + state.hashCode() + " - " + plan);
421
        			LOGGER.info(comm.getAddress() + " send PLANNING_FINISHED!" );
422
        		}
423
	            protocol.sendPlanningFinishedMessage();
424
	            run = false;
425
	
426
	            planCallback.planFound(plan);
427
        	}
424 428

  
425 429

  
426 430
        }else{
......
474 478

  
475 479
    protected boolean solutionFound(SearchState state) {
476 480
        if (state.unifiesWith(problem.goalSuperState)) {
477
            LOGGER.info("SOLUTION of cost "+state.getG()+" FOUND[" + problem.agent + "]: " + Arrays.toString(state.getValues()));
478

  
479
            LOGGER.info("LOCAL-OPEN-SIZE[" + problem.agent + "]" + openLocal.size());
480
            LOGGER.info("GLOBAL-OPEN-SIZE[" + problem.agent + "]" + openGlobal.size());
481
            LOGGER.info("CLOSED-SIZE[" + problem.agent + "]" + closed.size());
481
        	if(LOGGER.isInfoEnabled()){
482
	            LOGGER.info("SOLUTION of cost "+state.getG()+" FOUND[" + problem.agent + "]: " + Arrays.toString(state.getValues()));
483
	
484
	            LOGGER.info("LOCAL-OPEN-SIZE[" + problem.agent + "]" + openLocal.size());
485
	            LOGGER.info("GLOBAL-OPEN-SIZE[" + problem.agent + "]" + openGlobal.size());
486
	            LOGGER.info("CLOSED-SIZE[" + problem.agent + "]" + closed.size());
487
        	}
482 488

  
483 489
            return true;
484 490
        }

Also available in: Unified diff