Revision 217:8da17ae99f1e

View differences:

src/main/java/tt/jointeuclid2ni/probleminstance/generator/ConflictGenerator.java
48 48
    private static final int MAX_ATTEMPTS_MISSION = 150;
49 49
    private static final int MAX_ATTEMPTS_START = 500;
50 50
    private static final int MAX_ATTEMPTS_TARGET = 500;
51
    private static final int RADIUS_BUFFER_GRACE = 1; 
51
    private static final float RADIUS_BUFFER_GRACE_COEF = 1.3f; 
52 52

  
53 53
    private static DirectedGraph<Point, Line>[] toGraphArray(DirectedGraph<Point, Line> planningGraph, int nAgents) {
54 54

  
......
97 97
                    vertexList[i].add(vertex);
98 98
                }
99 99
            }
100

  
101

  
102 100
        }
103 101
        return vertexList;
104 102
    }
......
350 348
    	Collection<Region> startTargetRegions = new LinkedList<Region>();
351 349

  
352 350
    	for (int i=0; i<missions.length; i++) {
353
    		startTargetRegions.add(new Circle(missions[i].getStart(), missions[i].getBodyRadius() + bodyRadius + RADIUS_BUFFER_GRACE));
354
    		startTargetRegions.add(new Circle(missions[i].getTarget(), missions[i].getBodyRadius()  + bodyRadius + RADIUS_BUFFER_GRACE));
351
    		startTargetRegions.add(new Circle(missions[i].getStart(), missions[i].getBodyRadius() + (int) Math.ceil(bodyRadius*RADIUS_BUFFER_GRACE_COEF)));
352
    		startTargetRegions.add(new Circle(missions[i].getTarget(), missions[i].getBodyRadius()  + (int) Math.ceil(bodyRadius*RADIUS_BUFFER_GRACE_COEF)));
355 353
    	}
356 354

  
357 355
    	return new ObstacleWrapper<Point, Line>(directedGraph, startTargetRegions);
......
360 358
	static private boolean collidesWithOtherStart(Point start, int bodyRadius, ExtensibleProblem currentProblem) {
361 359
		AgentMission[] otherMissions = currentProblem.getAgentMissions();
362 360
        for (AgentMission mission : otherMissions) {
363
            double sep = mission.getBodyRadius() + bodyRadius;
361
            double sep = mission.getBodyRadius() + (int) Math.ceil(bodyRadius*RADIUS_BUFFER_GRACE_COEF);
364 362
            double distance = mission.getStart().distance(start);
365 363

  
366 364
            // sometimes it happened that agents with exactly sep == distance were considered in collision by separation detector
......
373 371
	static private boolean collidesWithOtherTarget(Point start, int bodyRadius, ExtensibleProblem currentProblem) {
374 372
        AgentMission[] otherMissions = currentProblem.getAgentMissions();
375 373
        for (AgentMission mission : otherMissions) {
376
            double sep = mission.getBodyRadius() + bodyRadius;
374
            double sep = mission.getBodyRadius() + (int) Math.ceil(bodyRadius*RADIUS_BUFFER_GRACE_COEF);
377 375
            double distance = mission.getTarget().distance(start);
378 376

  
379 377
            // sometimes it happend that agents with exactly sep == distance were considered in collision by separation detector

Also available in: Unified diff