Revision 71:109db18dc8f9

View differences:

misc/eclipse/Solver (test).launch
8 8
</listAttribute>
9 9
<stringAttribute key="org.eclipse.jdt.launching.CLASSPATH_PROVIDER" value="org.eclipse.m2e.launchconfig.classpathProvider"/>
10 10
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="tt.jointeuclid2ni.Solver"/>
11
<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-method KDPMD -k 1 -problemfile src/main/resources/problems/superconflict4.xml -maxtime 2500 -gridstep 25 -grid 8 -summary -showvis"/>
11
<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-method KDPMD -k  10 -problemfile src/main/resources/problems/superconflict4.xml -maxtime 2500 -gridstep 40 -grid 16 -summary -showvis"/>
12 12
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="deconflictiontools"/>
13 13
<stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.eclipse.m2e.launchconfig.sourcepathProvider"/>
14 14
</launchConfiguration>
src/main/java/tt/jointeuclid2ni/Solver.java
1 1
package tt.jointeuclid2ni;
2 2

  
3
import static tt.jointtraj.util.Util.getSumCost;
4

  
5
import java.io.File;
6
import java.io.FileInputStream;
7
import java.io.FileNotFoundException;
8
import java.io.PrintWriter;
9

  
3 10
import tt.euclid2i.EvaluatedTrajectory;
4 11
import tt.euclid2i.discretization.LazyGrid;
5 12
import tt.jointeuclid2ni.probleminstance.EarliestArrivalProblem;
......
10 17
import tt.jointeuclid2ni.solver.HeuristicType;
11 18
import tt.jointeuclid2ni.solver.ObjectiveType;
12 19
import tt.jointeuclid2ni.solver.Parameters;
13
import tt.jointeuclid2ni.solver.impl.*;
20
import tt.jointeuclid2ni.solver.impl.AlgorithmDPMC;
21
import tt.jointeuclid2ni.solver.impl.AlgorithmDPMD;
22
import tt.jointeuclid2ni.solver.impl.AlgorithmIIHP;
23
import tt.jointeuclid2ni.solver.impl.AlgorithmODCN;
24
import tt.jointeuclid2ni.solver.impl.AlgorithmODPiN;
25
import tt.jointeuclid2ni.solver.impl.AlgorithmPP;
14 26
import tt.jointtraj.solver.SearchResult;
15 27
import tt.util.Args;
16 28
import tt.util.Counters;
17 29

  
18
import java.io.File;
19
import java.io.FileInputStream;
20
import java.io.FileNotFoundException;
21
import java.io.PrintWriter;
22

  
23
import static tt.jointtraj.util.Util.getSumCost;
24

  
25 30

  
26 31
public class Solver {
27 32

  
......
96 101

  
97 102
        params.maxTime = Integer.parseInt(maxtimeStr);
98 103
        if (gridStepStr != null) {
99
        	params.gridStep = Integer.parseInt(gridStepStr);
104
            params.gridStep = Integer.parseInt(gridStepStr);
100 105
        }
101 106

  
102 107
        params.waitMoveDuration = params.gridStep;
src/main/java/tt/jointeuclid2ni/solver/impl/AbstractAlgorithm.java
115 115
    }
116 116

  
117 117
    protected void initVisualization() {
118
        VisManager.setInitParam("Trajectory Tools Vis " + params.method, 1024, 768);
118
        VisManager.setInitParam("Trajectory Tools Vis " + params.method, 700, 700);
119 119
        VisManager.setSceneParam(new VisManager.SceneParams() {
120 120

  
121 121
            @Override
122 122
            public Point2d getDefaultLookAt() {
123
                return new Point2d(problem.getEnvironment().getBounds().getCorner2().x / 2,
124
                        problem.getEnvironment().getBounds().getCorner2().y / 2);
123

  
124
                double x = problem.getEnvironment().getBounds().getCorner1().x
125
                            + ((problem.getEnvironment().getBounds().getCorner2().x - problem.getEnvironment().getBounds().getCorner1().x) / 2);
126
                double y = problem.getEnvironment().getBounds().getCorner1().y
127
                            + ((problem.getEnvironment().getBounds().getCorner2().y - problem.getEnvironment().getBounds().getCorner1().y) / 2);
128

  
129
                return new Point2d(x,y);
125 130
            }
126 131

  
127 132
            @Override
src/main/java/tt/jointeuclid2ni/solver/impl/AbstractDPMBasedAlgorithm.java
10 10
import tt.euclidtime3i.L1Heuristic;
11 11
import tt.euclidtime3i.L2Heuristic;
12 12
import tt.euclidtime3i.PerfectBasedHeuristic;
13
import tt.euclidtime3i.discretization.softconstraints.ConstantSeparationPenaltyFunction;
13
import tt.euclidtime3i.discretization.softconstraints.BumpSeparationPenaltyFunction;
14 14
import tt.euclidtime3i.discretization.softconstraints.PenaltyFunction;
15 15
import tt.jointtraj.separableflow.AStarTrajectoryOptimizer;
16 16
import tt.jointtraj.separableflow.TrajectoryOptimizer;
......
82 82
        for (int i = 0; i < problem.nAgents(); i++) {
83 83
            for (int j = 0; j < problem.nAgents(); j++) {
84 84
                if (i != j) {
85
                    softSeparationFunctions[i][j] = new ConstantSeparationPenaltyFunction(MAX_PENALTY, problem.getBodyRadius(i) + problem.getBodyRadius(j));
85
                    softSeparationFunctions[i][j] = new BumpSeparationPenaltyFunction(MAX_PENALTY, problem.getBodyRadius(i) + problem.getBodyRadius(j)+1, 1);
86 86
                }
87 87
            }
88 88
        }
src/main/java/tt/jointtraj/separableflow/SeparableFlowOptimizer.java
1 1
package tt.jointtraj.separableflow;
2 2

  
3 3
import java.awt.Color;
4
import java.io.IOException;
4 5
import java.util.Arrays;
5 6

  
6 7
import tt.euclid2i.EvaluatedTrajectory;
......
25 26

  
26 27
public class SeparableFlowOptimizer {
27 28

  
28
    private static final int TAN_COEF = 5;
29
    private static final int TAN_COEF = 1;
29 30
    private static boolean showProgress;
30 31
    protected static EvaluatedTrajectory[] currentTrajectories;
31 32
    protected static int[] bodyRadiuses;
......
153 154

  
154 155
            Verbose.printf("Prioritized planning for agent %d. \n", i);
155 156

  
157
            try {
158
                System.in.read();
159
            } catch (IOException e) {
160
                e.printStackTrace();
161
            }
162

  
156 163
            Trajectory[] otherTrajectories = higherPriorityTrajectories(
157 164
                    trajectories, i);
158 165
            PenaltyFunction[] penaltyFunctionsToOtherTrajectories = constraintsWithHigherPriorityAgents(
......
190 197
        for (int i = 0; i < nIterations; i++) {
191 198
            int r = i % nAgents;
192 199

  
193

  
200
            try {
201
                System.in.read();
202
            } catch (IOException e) {
203
                e.printStackTrace();
204
            }
194 205

  
195 206

  
196 207
            double w = calculateSoftConstraintsWeight(i, nIterations);
......
363 374

  
364 375
    private static double calculateSoftConstraintsWeight(int i,
365 376
            int maxIterations) {
366
        return TAN_COEF * Math.tan(Math.PI / 2 * i / (maxIterations + 1));
377
        return TAN_COEF * Math.tan(Math.PI / 2 * (i+1) / (maxIterations + 1));
367 378
    }
368 379

  
369 380
    private static Trajectory[] higherPriorityTrajectories(Trajectory[] trajs,
src/main/resources/problems/superconflict4.xml
30 30
<y>500</y>
31 31
</point>
32 32
</target>
33
<radius>70</radius>
33
<radius>90</radius>
34 34
<maxspeed>1</maxspeed>
35 35
</agent>
36 36

  
......
48 48
<y>100</y>
49 49
</point>
50 50
</target>
51
<radius>70</radius>
51
<radius>90</radius>
52 52
<maxspeed>1</maxspeed>
53 53
</agent>
54 54

  
......
66 66
<y>500</y>
67 67
</point>
68 68
</target>
69
<radius>70</radius>
69
<radius>90</radius>
70 70
<maxspeed>1</maxspeed>
71 71
</agent>
72 72

  
......
83 83
<y>900</y>
84 84
</point>
85 85
</target>
86
<radius>70</radius>
86
<radius>90</radius>
87 87
<maxspeed>1</maxspeed>
88 88
</agent>
89 89

  
src/main/resources/problems/superconflict8.xml
30 30
<y>500</y>
31 31
</point>
32 32
</target>
33
<radius>70</radius>
33
<radius>90</radius>
34 34
<maxspeed>1</maxspeed>
35 35
</agent>
36 36

  
......
47 47
<y>217</y>
48 48
</point>
49 49
</target>
50
<radius>70</radius>
50
<radius>90</radius>
51 51
<maxspeed>1</maxspeed>
52 52
</agent>
53 53

  
......
64 64
<y>100</y>
65 65
</point>
66 66
</target>
67
<radius>70</radius>
67
<radius>90</radius>
68 68
<maxspeed>1</maxspeed>
69 69
</agent>
70 70

  
......
81 81
<y>217</y>
82 82
</point>
83 83
</target>
84
<radius>70</radius>
84
<radius>90</radius>
85 85
<maxspeed>1</maxspeed>
86 86
</agent>
87 87

  
......
98 98
<y>500</y>
99 99
</point>
100 100
</target>
101
<radius>70</radius>
101
<radius>90</radius>
102 102
<maxspeed>1</maxspeed>
103 103
</agent>
104 104

  
......
115 115
<y>782</y>
116 116
</point>
117 117
</target>
118
<radius>70</radius>
118
<radius>90</radius>
119 119
<maxspeed>1</maxspeed>
120 120
</agent>
121 121

  
......
132 132
<y>900</y>
133 133
</point>
134 134
</target>
135
<radius>70</radius>
135
<radius>90</radius>
136 136
<maxspeed>1</maxspeed>
137 137
</agent>
138 138

  
......
149 149
<y>782</y>
150 150
</point>
151 151
</target>
152
<radius>70</radius>
152
<radius>90</radius>
153 153
<maxspeed>1</maxspeed>
154 154
</agent>
155 155

  

Also available in: Unified diff