Revision 315:deeecf1bf1e4

View differences:

pom.xml
103 103
        <dependency>
104 104
            <groupId>cz.agents.alite</groupId>
105 105
            <artifactId>alite</artifactId>
106
            <version>1.1.1</version>
106
            <version>1.0-SNAPSHOT</version>
107 107
            <scope>compile</scope>
108 108
        </dependency>
109 109
        <dependency>
110 110
            <groupId>cz.agents.alite</groupId>
111 111
            <artifactId>trajectorytools</artifactId>
112
            <version>2.0.2</version>
112
            <version>2.1-SNAPSHOT</version>
113 113
            <scope>compile</scope>
114 114
        </dependency>
115 115
        <dependency>
src/main/java/tt/euclidtime3i/demo/GSIPPDemo.java
168 168
			dynamicObstacles.add(new MovingCircle(trajArr[i], inflatedRadiuses[i]));
169 169
		}
170 170

  
171
		ConstantSpeedTimeExtension spaceTimeGraph = new ConstantSpeedTimeExtension(spatialGraph, maxtime, new int [] {1}, dynamicObstacles , 1);
171
		ConstantSpeedTimeExtension spaceTimeGraph = new ConstantSpeedTimeExtension(spatialGraph, maxtime, new float[] {1}, dynamicObstacles , 1);
172 172

  
173 173
        System.out.println("\nStarting A* search...");
174 174

  
......
330 330
			dynamicObstacles.add(new MovingCircle(trajArr[i], radiuses[i] + bodyRadius));
331 331
		}
332 332

  
333
		ConstantSpeedTimeExtension spaceTimeGraph = new ConstantSpeedTimeExtension(spatialGraph, maxtime, new int [] {1}, dynamicObstacles , 1);
333
		ConstantSpeedTimeExtension spaceTimeGraph = new ConstantSpeedTimeExtension(spatialGraph, maxtime, new float[] {1}, dynamicObstacles , 1);
334 334

  
335 335
        System.out.println("\nStarting A* search...");
336 336

  
src/main/java/tt/euclidtime3i/demo/SIPPDemo.java
295 295
			dynamicObstacles.add(new MovingCircle(trajArr[i], radiuses[i] + bodyRadius));
296 296
		}
297 297

  
298
		ConstantSpeedTimeExtension spaceTimeGraph = new ConstantSpeedTimeExtension(spatialGraph, maxtime, new int [] {1}, dynamicObstacles , 1);
298
		ConstantSpeedTimeExtension spaceTimeGraph = new ConstantSpeedTimeExtension(spatialGraph, maxtime, new float[] {1}, dynamicObstacles , 1);
299 299

  
300 300
        System.out.println("\nStarting A* search...");
301 301

  
src/main/java/tt/euclidtime3i/sipp/SippWrapper.java
27 27

  
28 28
    private int[] separations;
29 29
    private int bodyRadius;
30
    private int speed;
30
    private float speed;
31 31
    private int step;
32 32

  
33
    public SippWrapper(DirectedGraph<Point, Line> graph, DynamicObstacles environment, int bodyRadius, int speed, int samplingStep, int maxTime) {
33
    public SippWrapper(DirectedGraph<Point, Line> graph, DynamicObstacles environment, int bodyRadius, float speed, int samplingStep, int maxTime) {
34 34
        this.graph = graph;
35 35
        this.env = environment;
36 36
        this.bodyRadius = bodyRadius;
src/main/java/tt/jointeuclid2ni/operatordecomposition/ODUtils.java
17 17
public class ODUtils {
18 18

  
19 19
    @SuppressWarnings("unchecked")
20
    public static EvaluatedTrajectory[] toTrajectories(GraphPath<ODNode, ODEdge> path, Point[] goals, int maxDuration, int speed, int timeStep) {
20
    public static EvaluatedTrajectory[] toTrajectories(GraphPath<ODNode, ODEdge> path, Point[] goals, int maxDuration, float speed, int timeStep) {
21 21
        if (path == null) {
22 22
            return null;
23 23
        } else {
src/main/java/tt/jointeuclid2ni/probleminstance/AgentMission.java
10 10

  
11 11
    public int getBodyRadius();
12 12

  
13
    public int getMaxSpeed();
13
    public float getMaxSpeed();
14 14

  
15 15
}
16 16

  
src/main/java/tt/jointeuclid2ni/probleminstance/AgentMissionImpl.java
7 7
    private Point start;
8 8
    private Point target;
9 9
    private int bodyRadius;
10
    private int maxSpeed;
10
    private float maxSpeed;
11 11

  
12 12
    public AgentMissionImpl(Point start, Point target, int bodyRadius, int maxSpeed) {
13 13
        this.start = start;
......
35 35
        return bodyRadius;
36 36
    }
37 37

  
38
    public int getMaxSpeed() {
38
    public float getMaxSpeed() {
39 39
        return maxSpeed;
40 40
    }
41 41

  
42 42
    @Override
43
    public boolean equals(Object o) {
44
        if (this == o) return true;
45
        if (o == null || getClass() != o.getClass()) return false;
43
	public int hashCode() {
44
		final int prime = 31;
45
		int result = 1;
46
		result = prime * result + bodyRadius;
47
		result = prime * result + Float.floatToIntBits(maxSpeed);
48
		result = prime * result + ((start == null) ? 0 : start.hashCode());
49
		result = prime * result + ((target == null) ? 0 : target.hashCode());
50
		return result;
51
	}
46 52

  
47
        AgentMissionImpl that = (AgentMissionImpl) o;
53
	@Override
54
	public boolean equals(Object obj) {
55
		if (this == obj)
56
			return true;
57
		if (obj == null)
58
			return false;
59
		if (getClass() != obj.getClass())
60
			return false;
61
		AgentMissionImpl other = (AgentMissionImpl) obj;
62
		if (bodyRadius != other.bodyRadius)
63
			return false;
64
		if (Float.floatToIntBits(maxSpeed) != Float
65
				.floatToIntBits(other.maxSpeed))
66
			return false;
67
		if (start == null) {
68
			if (other.start != null)
69
				return false;
70
		} else if (!start.equals(other.start))
71
			return false;
72
		if (target == null) {
73
			if (other.target != null)
74
				return false;
75
		} else if (!target.equals(other.target))
76
			return false;
77
		return true;
78
	}
48 79

  
49
        if (bodyRadius != that.bodyRadius) return false;
50
        if (maxSpeed != that.maxSpeed) return false;
51
        if (!start.equals(that.start)) return false;
52
        if (!target.equals(that.target)) return false;
53 80

  
54
        return true;
55
    }
56

  
57
    @Override
58
    public int hashCode() {
59
        int result = start.hashCode();
60
        result = 31 * result + target.hashCode();
61
        result = 31 * result + bodyRadius;
62
        result = 31 * result + maxSpeed;
63
        return result;
64
    }
65 81
}
src/main/java/tt/jointeuclid2ni/probleminstance/EarliestArrivalProblem.java
20 20

  
21 21
    public int getBodyRadius(int i);
22 22

  
23
    public int getMaxSpeed(int i);
23
    public float getMaxSpeed(int i);
24 24

  
25 25
    public Point[] getStarts();
26 26

  
......
28 28

  
29 29
    public int[] getBodyRadiuses();
30 30

  
31
    public int[] getMaxSpeeds();
31
    public float[] getMaxSpeeds();
32 32

  
33 33
    public Collection<Region> getObstacles();
34 34

  
src/main/java/tt/jointeuclid2ni/probleminstance/RelocationTaskCoordinationProblem.java
20 20

  
21 21
    public int getBodyRadius(int i);
22 22

  
23
    public int getMaxSpeed(int i);
23
    public float getMaxSpeed(int i);
24 24
    
25 25
    public Point[] getStarts();
26 26

  
27 27
    public int[] getBodyRadiuses();
28 28

  
29
    public int[] getMaxSpeeds();
29
    public float[] getMaxSpeeds();
30 30

  
31 31
    public Collection<Region> getObstacles();
32 32

  
src/main/java/tt/jointeuclid2ni/probleminstance/TrajectoryCoordinationProblemImpl.java
26 26
    protected Point[] starts;
27 27
    protected Point[] targets;
28 28
    protected int[] bodyRadiuses;
29
    protected int[] maxSpeeds;
29
    protected float[] maxSpeeds;
30 30

  
31 31
    private DirectedGraph<Point, Line> planningGraph;
32 32
    protected Point[] docks;
33 33
    private List<RelocationTask> relocationTasks;
34 34
    
35
    public TrajectoryCoordinationProblemImpl(Environment environment, Point[] starts, int[] bodyRadiuses, int[] maxSpeeds, List<RelocationTask> tasks, DirectedGraph<Point, Line> planningGraph) {
35
    public TrajectoryCoordinationProblemImpl(Environment environment, Point[] starts, int[] bodyRadiuses, float[] maxSpeeds, List<RelocationTask> tasks, DirectedGraph<Point, Line> planningGraph) {
36 36
    	this(environment, starts, null, bodyRadiuses, maxSpeeds, planningGraph, null, tasks);
37 37
    }
38 38

  
......
49 49
        Arrays.fill(speeds, speed);
50 50
        return speeds;
51 51
    }
52
    
53
    public TrajectoryCoordinationProblemImpl(Environment environment, Point[] starts, Point[] targets, int[] bodyRadiuses, int[] maxSpeeds, 
54
    		DirectedGraph<Point, Line> planningGraph, Point[] docks, List<RelocationTask> relocationTasks) {
55
    	this(environment,starts, targets, bodyRadiuses, toFloatArr(maxSpeeds), planningGraph, docks, relocationTasks);
56
    }
52 57

  
53
    public TrajectoryCoordinationProblemImpl(Environment environment, Point[] starts, Point[] targets, int[] bodyRadiuses, int[] maxSpeeds, 
58
    private static float[] toFloatArr(int[] intArr) {
59
		float[] floatArr = new float[intArr.length];
60
    	for (int i = 0; i < intArr.length; i++) {
61
			floatArr[i] = intArr[i]; 
62
		}
63
		return floatArr;
64
	}
65

  
66
	public TrajectoryCoordinationProblemImpl(Environment environment, Point[] starts, Point[] targets, int[] bodyRadiuses, float[] maxSpeeds, 
54 67
    		DirectedGraph<Point, Line> planningGraph, Point[] docks, List<RelocationTask> relocationTasks) {
55 68
        super();
56 69
        this.environment = environment;
......
72 85
    public TrajectoryCoordinationProblemImpl(Environment environment, int nAgents) {
73 86
        this.nAgents = nAgents;
74 87
        this.environment = environment;
75
        this.maxSpeeds = new int[nAgents];
88
        this.maxSpeeds = new float[nAgents];
76 89
        Arrays.fill(maxSpeeds, 1);
77 90

  
78 91
        starts = new Point[nAgents];
......
142 155
    }
143 156

  
144 157
    @Override
145
    public int getMaxSpeed(int i) {
158
    public float getMaxSpeed(int i) {
146 159
        return maxSpeeds[i];
147 160
    }
148 161

  
149 162
    @Override
150
    public int[] getMaxSpeeds() {
163
    public float[] getMaxSpeeds() {
151 164
        return maxSpeeds;
152 165
    }
153 166

  
src/main/java/tt/jointeuclid2ni/probleminstance/TrajectoryCoordinationProblemXMLDeserializer.java
52 52
        private List<Point> starts;
53 53
        private List<Point> targets;
54 54
        private List<Integer> radiuses;
55
        private List<Integer> maxSpeeds;
55
        private List<Float> maxSpeeds;
56 56

  
57 57
        private Agents() {
58 58
            this.size = 0;
59 59
            this.starts = new ArrayList<Point>();
60 60
            this.targets = new ArrayList<Point>();
61 61
            this.radiuses = new ArrayList<Integer>();
62
            this.maxSpeeds = new ArrayList<Integer>();
62
            this.maxSpeeds = new ArrayList<Float>();
63 63
        }
64 64

  
65
        public void add(Point start, Point target, int radius, int maxSpeed) {
65
        public void add(Point start, Point target, int radius, float maxSpeed) {
66 66
            starts.add(start);
67 67
            targets.add(target);
68 68
            radiuses.add(radius);
......
242 242

  
243 243
            Point start = null;
244 244
            Point target = null;
245
            int radius, maxSpeed;
245
            int radius;
246
            float maxSpeed;
246 247
            
247 248
            if (agent.hasAttribute(EarliestArrivalProblemXMLConstants.START)) {
248 249
            	// use simple syntax
......
250 251
            	if (agent.hasAttribute(EarliestArrivalProblemXMLConstants.TARGET))
251 252
            		target = stringToPoint(agent.getAttribute(EarliestArrivalProblemXMLConstants.TARGET));
252 253
            	radius = Integer.parseInt(agent.getAttribute(EarliestArrivalProblemXMLConstants.BODY_RADIUS));
253
            	maxSpeed = Integer.parseInt(agent.getAttribute(EarliestArrivalProblemXMLConstants.MAX_SPEED));
254
            	maxSpeed = Float.parseFloat(agent.getAttribute(EarliestArrivalProblemXMLConstants.MAX_SPEED));
254 255
            } else {
255 256
            	// use verbose syntax
256 257
                NodeList startNL = agent.getElementsByTagName(EarliestArrivalProblemXMLConstants.START);
......
276 277

  
277 278
                NodeList maxSpeedNL = agent.getElementsByTagName(EarliestArrivalProblemXMLConstants.MAX_SPEED);
278 279
                try {
279
                    maxSpeed = Integer.parseInt(maxSpeedNL.item(0).getTextContent());
280
                    maxSpeed = Float.parseFloat(maxSpeedNL.item(0).getTextContent());
280 281
                } catch (Exception ex) {
281 282
                    System.err.printf("Error while parsing maxSpeed for %d. agent - value set do default (1)%n", i);
282 283
                    maxSpeed = 1;
src/main/java/tt/jointeuclid2ni/probleminstance/TrajectoryCoordinationProblemXMLSerializer.java
115 115
            if (problem.getTarget(j) != null)
116 116
            	agentElem.setAttribute(EarliestArrivalProblemXMLConstants.TARGET, pointToString(problem.getTarget(j)));
117 117
            agentElem.setAttribute(EarliestArrivalProblemXMLConstants.BODY_RADIUS, Integer.toString(problem.getBodyRadius(j)));
118
            agentElem.setAttribute(EarliestArrivalProblemXMLConstants.MAX_SPEED, Integer.toString(problem.getMaxSpeed(j)));
118
            agentElem.setAttribute(EarliestArrivalProblemXMLConstants.MAX_SPEED, String.format("%.4f", problem.getMaxSpeed(j)));
119 119
        }
120 120
        
121 121
        // docks
src/main/java/tt/jointeuclid2ni/probleminstance/generator/ConflictGenerator.java
337 337

  
338 338
        assert isReachable(start, target, graph);
339 339
        
340
        return SegmentedTrajectoryFactory.createConstantSpeedTrajectory(path, 0, mission.getMaxSpeed(),
340
        return SegmentedTrajectoryFactory.createConstantSpeedTrajectory(path, 0, (int)mission.getMaxSpeed(),
341 341
                maxTime, path.getWeight() / MAX_SPEED);
342 342
    }
343 343

  
src/main/java/tt/jointeuclid2ni/probleminstance/generator/DynamicEnvironmentGenerator.java
93 93
        if (path == null)
94 94
            return null;
95 95
        else
96
            return SegmentedTrajectoryFactory.createConstantSpeedTrajectory(path, 0, missions.getSpeed(), missions.getMaxTime(), path.getWeight());
96
            return SegmentedTrajectoryFactory.createConstantSpeedTrajectory(path, 0, (int) missions.getSpeed(), missions.getMaxTime(), path.getWeight());
97 97
    }
98 98

  
99 99
    private MissionBases.Mission generateRandomMission() {
src/main/java/tt/jointeuclid2ni/probleminstance/generator/GenerateRTInstance.java
33 33
	private static final int FIRSTTASK = 1000;
34 34

  
35 35
	public static TrajectoryCoordinationProblem generateInstance(
36
			String environmentFile, int nAgents, int radius, int nEndpoints, int seed) throws ProblemNotCreatedException {
36
			String environmentFile, int nAgents, int radius, float maxSpeed, int nEndpoints, int seed) throws ProblemNotCreatedException {
37 37

  
38 38
		EarliestArrivalProblem inInstance = readProblem(environmentFile);
39 39
		Random rnd = new Random(seed);
......
67 67
		int[] bodyRadiuses = new int[nAgents];
68 68
		Arrays.fill(bodyRadiuses, radius);
69 69

  
70
		int[] maxSpeeds = new int[nAgents];
71
		Arrays.fill(maxSpeeds, radius);
70
		float[] maxSpeeds = new float[nAgents];
71
		Arrays.fill(maxSpeeds, maxSpeed);
72 72
		
73 73
		Point[] starts = new Point[nAgents];
74 74
		for (int i = 0; i < nAgents; i++) {
......
82 82
			}
83 83
		}
84 84
		
85
		TrajectoryCoordinationProblem outInstance = new TrajectoryCoordinationProblemImpl(inInstance.getEnvironment(), starts, 
86
						bodyRadiuses, maxSpeeds, tasks, inInstance.getPlanningGraph());
85
		TrajectoryCoordinationProblem outInstance 
86
			= new TrajectoryCoordinationProblemImpl(inInstance.getEnvironment(), starts, bodyRadiuses, maxSpeeds, tasks, inInstance.getPlanningGraph());
87 87
		
88 88
		return outInstance;
89 89
	}
......
115 115
		String environmentFile = Args.getArgumentValue(args, "-env", true);
116 116
		int agents = Integer.parseInt(Args.getArgumentValue(args, "-nagents", true));
117 117
		int radius = Integer.parseInt(Args.getArgumentValue(args, "-radius", true));
118
		float maxSpeed = Float.parseFloat(Args.getArgumentValue(args, "-maxspeed", true));
118 119
		int nGoals = Integer.parseInt(Args.getArgumentValue(args, "-ngoals", true));
119 120
		int seed = Integer.parseInt(Args.getArgumentValue(args, "-seed", true));
120 121

  
122
		
121 123
		String outFile = Args.getArgumentValue(args, "-outfile", false);
122 124
		boolean showVis = Args.isArgumentSet(args, "-showvis");
125
		
126
		
123 127

  
124 128
		if (Args.isArgumentSet(args, "-verbose")) {
125 129
			Verbose.setVerbose(true);
126 130
		}
127 131

  
128 132
		TrajectoryCoordinationProblem instance = generateInstance(environmentFile,
129
				agents, radius, nGoals+1, seed);
133
				agents, radius, maxSpeed, nGoals+1, seed);
130 134

  
131 135
		PrintStream outStream = System.out;
132 136

  
src/main/java/tt/jointeuclid2ni/probleminstance/generator/ProblemGenerator.java
69 69
        if (path == null)
70 70
            return null;
71 71
        else
72
            return SegmentedTrajectoryFactory.createConstantSpeedTrajectory(path, 0, missions.getSpeed(), missions.getMaxTime(), path.getWeight());
72
            return SegmentedTrajectoryFactory.createConstantSpeedTrajectory(path, 0, (int) missions.getSpeed(), missions.getMaxTime(), path.getWeight());
73 73
    }
74 74

  
75 75
    private MissionBases.Mission generateRandomMission() {
src/main/java/tt/jointeuclid2ni/probleminstance/generator/missions/MissionBases.java
24 24
    private int speed;
25 25
    private int maxTime;
26 26

  
27
    private int[] radii, speeds;
27
    private int[] radii;
28
	float[] speeds;
28 29
    private Point[] starts, targets;
29 30
    private SegmentedTrajectory[] trajectories;
30 31

  
......
34 35
        this.maxTime = maxTime;
35 36

  
36 37
        this.radii = new int[]{};
37
        this.speeds = new int[]{};
38
        this.speeds = new float[]{};
38 39
        this.starts = new Point[]{};
39 40
        this.targets = new Point[]{};
40 41
        this.trajectories = new SegmentedTrajectory[]{};
......
57 58
        return maxTime;
58 59
    }
59 60

  
60
    public int getSpeed() {
61
    public float getSpeed() {
61 62
        return speed;
62 63
    }
63 64

  
......
81 82
    }
82 83

  
83 84
    @Override
84
    public int[] getSpeeds() {
85
    public float[] getSpeeds() {
85 86
        return speeds;
86 87
    }
87 88

  
src/main/java/tt/jointeuclid2ni/probleminstance/generator/missions/Missions.java
12 12

  
13 13
    public int getBodyRadius();
14 14

  
15
    public int getSpeed();
15
    public float getSpeed();
16 16

  
17 17
    public Point[] getStarts();
18 18

  
......
20 20

  
21 21
    int[] getBodyRadiuses();
22 22

  
23
    int[] getSpeeds();
23
    float[] getSpeeds();
24 24
}
src/main/java/tt/jointeuclid2ni/probleminstance/generator/missions/MissionsComposedProblem.java
44 44
    }
45 45

  
46 46
    @Override
47
    public int getMaxSpeed(int i) {
47
    public float getMaxSpeed(int i) {
48 48
        return missions.getBodyRadius();
49 49
    }
50 50

  
......
64 64
    }
65 65

  
66 66
    @Override
67
    public int[] getMaxSpeeds() {
67
    public float[] getMaxSpeeds() {
68 68
        return missions.getSpeeds();
69 69
    }
70 70

  
src/main/java/tt/jointeuclid2ni/solver/Parameters.java
18 18
    public String fileName;
19 19
    public int maxTime = 10000;
20 20
    public int gridStep = 0;
21
    public int maxSpeed;
21
    public float maxSpeed;
22 22
    public long startedAtMs;
23 23
    public long runtimeDeadlineMs;
24 24
    public int waitMoveDuration;
src/main/java/tt/jointeuclid2ni/solver/impl/AbstractAlgorithm.java
75 75

  
76 76
    protected DirectedGraph<tt.euclidtime3i.Point, Straight> createMotionGraph(final DirectedGraph<tt.euclid2i.Point, Line> spatialGraph,
77 77
                                                                               final tt.euclid2i.Point init, final tt.euclid2i.Point goal,
78
                                                                               int maxSpeed, int maxTime) {
78
                                                                               float maxSpeed, int maxTime) {
79 79

  
80 80
    	// create spatio-temporal graph
81 81
        DirectedGraph<tt.euclidtime3i.Point, Straight> motions 
82
        	= new ConstantSpeedTimeExtension(spatialGraph, maxTime, new int[]{maxSpeed}, new LinkedList<tt.euclidtime3i.Region>(), params.waitMoveDuration, params.timeStep); 
82
        	= new ConstantSpeedTimeExtension(spatialGraph, maxTime, new float[]{maxSpeed}, new LinkedList<tt.euclidtime3i.Region>(), params.waitMoveDuration, params.timeStep); 
83 83
        motions = new FreeOnTargetWaitExtension(motions, goal);
84 84
        motions = new ControlEffortWrapper(motions, 0.000001);
85 85
        return motions;
......
157 157
    
158 158
    protected HeuristicToGoal<tt.euclidtime3i.Point> getHeuristic(
159 159
			HeuristicType heuristic, DirectedGraph<Point, Line> spatialGraph,
160
			Point target, final int maxSpeed, final int timeStep) {
160
			Point target, final float maxSpeed, final int timeStep) {
161 161
    	
162 162
    	 switch (heuristic) {
163 163
         case PERFECT:
src/main/java/tt/jointeuclid2ni/solver/impl/AbstractDPMBasedAlgorithm.java
57 57
        	if (params.timeStep == 1) {
58 58
        		edgeLengthBound = Integer.MAX_VALUE;
59 59
        	} else {
60
        		edgeLengthBound = params.timeStep * problem.getMaxSpeed(i); 
60
        		edgeLengthBound = (int) Math.floor(params.timeStep * problem.getMaxSpeed(i)); 
61 61
        	}
62 62
        	
63 63
        	DirectedGraph<Point, Line> spatialGraph = preparePlanningGraphForAgent(i, edgeLengthBound, i == 0 /* show only first graph*/);
src/main/java/tt/jointeuclid2ni/solver/impl/AlgorithmDPMC.java
110 110
    }
111 111

  
112 112
	private Trajectory[] findDesiredTrajectories(Point[] starts,
113
			Point[] targets, int[] bodyRadiuses, Collection<Region> obstacles, int speed, int maxtime) {
113
			Point[] targets, int[] bodyRadiuses, Collection<Region> obstacles, float speed, int maxtime) {
114 114

  
115 115
		Trajectory[] optimalTrajs = new Trajectory[starts.length];
116 116
		for (int i=0; i<starts.length; i++) {
......
121 121
	}
122 122

  
123 123
	private Trajectory findShortestPath(Point start, final Point target, int radius,
124
			Collection<Region> obstacles, int speed, int maxTime) {
124
			Collection<Region> obstacles, float speed, int maxTime) {
125 125

  
126 126
		Collection<Point> significantPoints = Arrays.asList(new Point[] {start, target});
127 127
		WeightedGraph<Point, Line> visGraph = VisibilityGraph.createVisibilityGraph(obstacles, radius, significantPoints);
src/main/java/tt/jointeuclid2ni/solver/impl/AlgorithmIIHP.java
52 52
        	if (params.timeStep == 1) {
53 53
        		edgeLengthBound = Integer.MAX_VALUE;
54 54
        	} else {
55
        		edgeLengthBound = params.timeStep * problem.getMaxSpeed(i); 
55
        		edgeLengthBound = (int) Math.floor(params.timeStep * problem.getMaxSpeed(i)); 
56 56
        	}
57 57
        	
58 58
            graph[i] = preparePlanningGraphForAgent(i, edgeLengthBound, true);
src/main/java/tt/jointeuclid2ni/solver/impl/AlgorithmODCN.java
59 59
        @SuppressWarnings("unchecked")
60 60
		DirectedGraph<Point, Line> graph[] = new DirectedGraph[problem.nAgents()];
61 61
        for (int i = 0; i < problem.nAgents(); i++) {
62
        	int edgeLengthBound = params.timeStep * problem.getMaxSpeed(i);
62
        	int edgeLengthBound = (int) Math.floor(params.timeStep * problem.getMaxSpeed(i));
63 63
            graph[i] = preparePlanningGraphForAgent(i, edgeLengthBound, i == 0 /* show only first*/);
64 64
        }
65 65
        return graph;
src/main/java/tt/jointeuclid2ni/solver/impl/AlgorithmODPiN.java
27 27
        	if (params.timeStep == 1) {
28 28
        		edgeLengthBound = Integer.MAX_VALUE;
29 29
        	} else {
30
        		edgeLengthBound = params.timeStep * problem.getMaxSpeed(i); 
30
        		edgeLengthBound = (int) Math.floor(params.timeStep * problem.getMaxSpeed(i)); 
31 31
        	}
32 32
        	
33 33
        	DirectedGraph<tt.euclid2i.Point, Line> spatialGraph = preparePlanningGraphForAgent(i, edgeLengthBound, true);
src/main/java/tt/jointeuclid2ni/solver/impl/AlgorithmPP.java
34 34
        	if (params.timeStep == 1) {
35 35
        		edgeLengthBound = Integer.MAX_VALUE;
36 36
        	} else {
37
        		edgeLengthBound = params.timeStep * problem.getMaxSpeed(i); 
37
        		edgeLengthBound = (int) Math.floor(params.timeStep * problem.getMaxSpeed(i)); 
38 38
        	}
39 39
        	
40 40
            spatial[i] = preparePlanningGraphForAgent(i, edgeLengthBound, i == 0 /* show only first */);
src/main/java/tt/jointeuclid2ni/solver/impl/AlgorithmPPSIPP.java
53 53

  
54 54
            DynamicObstaclesImpl environment = new DynamicObstaclesImpl(trajArr, radArr, params.maxTime);
55 55

  
56
            SippWrapper wrapper = new SippWrapper(graph[i], environment, problem.getBodyRadius(i), problem.getMaxSpeed(i), 2, params.maxTime);
56
            SippWrapper wrapper = new SippWrapper(graph[i], environment, problem.getBodyRadius(i), (int) problem.getMaxSpeed(i), 2, params.maxTime);
57 57
            SippNode start = new SippNode(problem.getStart(i), Interval.toInfinity(0), 0);
58 58
            SippHeuristic heuristic = new SippHeuristic(getHeuristic(graph[i], problem.getTarget(i)),1);
59 59
            SippGoal goal = new SippGoal(problem.getTarget(i), params.maxTime);
src/main/java/tt/jointtraj/homotopyiterative/AStarTrajectoryOptimizerWithHomotopyConstriants.java
35 35

  
36 36
    final tt.euclidtime3i.Point start;
37 37
    final tt.euclidtime3i.Point target;
38
    final int vmax;
38
    final float vmax;
39 39
    private HeuristicToGoal<tt.euclidtime3i.Point> heuristic;
40 40
    final DirectedGraph<tt.euclidtime3i.Point, Straight> agentMotions;
41 41
	private HValuePolicy hPolicy;
......
50 50
            DirectedGraph<tt.euclid2i.Point, Line> spatialGraph,
51 51
            Point start,
52 52
            Point target,
53
            int speed,
53
            float speed,
54 54
            int waitDuration,
55 55
            HeuristicToGoal<tt.euclidtime3i.Point> heuristic,
56 56
            HValueIntegrator integrator
......
66 66
        this.spatialGraph = spatialGraph;
67 67

  
68 68
        this.agentMotions = new FreeOnTargetWaitExtension(
69
        		new ConstantSpeedTimeExtension(spatialGraph, target.getTime(), new int[]{vmax},  new LinkedList<Region>(), waitMoveDuration),
70
        												  target.getPosition());
69
        		new ConstantSpeedTimeExtension(spatialGraph, target.getTime(), new float[]{vmax},  new LinkedList<Region>(), waitMoveDuration), target.getPosition());
71 70
    }
72 71

  
73 72
    @Override
src/main/java/tt/jointtraj/homotopyiterative/HomotopyWeightedTimeGraph.java
36 36
                                     final tt.euclid2i.Point target,
37 37
                                     HValueIntegrator integrator,
38 38
                                     StraightSegmentPenaltyFunction penaltyFunction,
39
                                     int speed,
39
                                     float speed,
40 40
                                     int maxTime,
41 41
                                     int waitMoveDuration) {
42 42

  
43 43

  
44 44
		DirectedGraph<Point, Straight> spaceTimeGraph = new FreeOnTargetWaitExtension(
45 45
				new ConstantSpeedTimeExtension(spatialGraph, maxTime,
46
						new int[] { speed }, waitMoveDuration), target);
46
						new float[] { speed }, waitMoveDuration), target);
47 47

  
48 48
        penaltyWrapper = new PenaltyFunctionWrapper(spaceTimeGraph, penaltyFunction);
49 49

  
src/main/java/tt/jointtraj/separableflow/GradientOptimizer.java
35 35
	Point2d start;
36 36
	Point2d target;
37 37
	TrajectoryObjectiveFunctionAtPoint objective;
38
	int maxSpeed;
38
	float maxSpeed;
39 39
	int maxTime;
40 40
	int samplingInterval;
41 41
	double descentStep;
......
45 45
	boolean verbose;
46 46
	int maxIter;
47 47

  
48
	public GradientOptimizer(Point start, Point target, TrajectoryObjectiveFunctionAtPoint objective, int maxSpeed, int maxTime,
48
	public GradientOptimizer(Point start, Point target, TrajectoryObjectiveFunctionAtPoint objective, float maxSpeed, int maxTime,
49 49
			int samplingInterval, double step, double costEps, int maxIter, boolean verbose) {
50 50
		super();
51 51
		this.start = new Point2d(start.x, start.y);
......
113 113

  
114 114
			@Override
115 115
			public double value(double[] point) {
116
				double cost = computeTrajectoryCost(doubleArrayToPointArray(point), objective, maxSpeed, penaltyFunctions, otherTrajectories, samplingInterval);
116
				double cost = computeTrajectoryCost(doubleArrayToPointArray(point), objective, (int) maxSpeed, penaltyFunctions, otherTrajectories, samplingInterval);
117 117
				Verbose.println("Asking for value at " + GradientOptimizer.toString(doubleArrayToPointArray(point)));
118 118
				return cost;
119 119
			}
......
258 258
	private static Vector2d[] computeGradient(Point2d[] traj, TrajectoryObjectiveFunctionAtPoint objective,
259 259
			double originalCost, PenaltyFunction[] penaltyFunctions,
260 260
			Trajectory[] otherTrajectories, double h,
261
			int speed, int samplingInterval) {
261
			float speed, int samplingInterval) {
262 262
		Vector2d[] gradient = new Vector2d[traj.length];
263 263

  
264 264
		if (Double.isNaN(originalCost)) {
......
312 312
	}
313 313

  
314 314
	static double computeTrajectoryCost(Point2d[] traj, TrajectoryObjectiveFunctionAtPoint objectiveFunction,
315
			int maxSpeed, PenaltyFunction[] penaltyFunctions,
315
			float maxSpeed, PenaltyFunction[] penaltyFunctions,
316 316
			Trajectory[] otherTrajectories, int samplingInterval) {
317 317
		double cost = 0;
318 318
		cost += computeObjective(objectiveFunction, traj, samplingInterval);
......
323 323
	}
324 324

  
325 325
	static void printPenalties(int iter, Point2d[] traj, TrajectoryObjectiveFunctionAtPoint objectiveFunction,
326
			int maxSpeed, PenaltyFunction[] penaltyFunctions,
326
			float maxSpeed, PenaltyFunction[] penaltyFunctions,
327 327
			Trajectory[] otherTrajectories, int samplingInterval) {
328 328

  
329 329
		double objectiveValue = computeObjective(objectiveFunction, traj, samplingInterval);
......
352 352
		return cost;
353 353
	}
354 354

  
355
	static double computeMaxSpeedPenalties(Point2d[] traj, int maxSpeed,
355
	static double computeMaxSpeedPenalties(Point2d[] traj, float maxSpeed,
356 356
			int samplingInterval) {
357 357
		double cost = 0;
358 358
		for (int i = 1; i < traj.length; i++) {
src/main/java/tt/vis/problemcreator/main/ExtensibleProblem.java
124 124
    }
125 125

  
126 126
    @Override
127
    public int getMaxSpeed(int i) {
127
    public float getMaxSpeed(int i) {
128 128
        return getAgent(i).getMaxSpeed();
129 129
    }
130 130

  
......
156 156
    }
157 157

  
158 158
    @Override
159
    public int[] getMaxSpeeds() {
160
        int[] speeds = new int[nAgents()];
159
    public float[] getMaxSpeeds() {
160
        float[] speeds = new float[nAgents()];
161 161
        for (int i = 0; i < nAgents(); i++) {
162 162
            speeds[i] = getAgent(i).getMaxSpeed();
163 163
        }
src/test/java/tt/euclidtime3i/sipp/SippWrapperTest.java
156 156
        MovingCircle dynamicObstacle = new MovingCircle(firstTrajectory, BODY_RADIUS * 2);
157 157
        List<MovingCircle> dynamicObstacles = Collections.singletonList(dynamicObstacle);
158 158

  
159
        ConstantSpeedTimeExtension timeExtension = new ConstantSpeedTimeExtension(graph, MAX_TIME, new int[]{MAX_SPEED},
159
        ConstantSpeedTimeExtension timeExtension = new ConstantSpeedTimeExtension(graph, MAX_TIME, new float[]{MAX_SPEED},
160 160
                dynamicObstacles, 50);
161 161

  
162 162
        //DirectedGraph<tt.euclidtime3i.Point, Straight> motionGraph = new FreeOnTargetWaitExtension(timeExtension, problem.getTarget(1));

Also available in: Unified diff