Revision 2:68288c5a2c72

View differences:

src/main/java/tt/jointeuclid2ni/Solver.java
261 261
        }
262 262

  
263 263
        if (printSummary) {
264

  
264
            printSummary(result.getTrajectories());
265 265
        } else {
266 266
            // export the solution trajectories
267 267
            if (result.foundSolution()) {
......
298 298
        final IterativeHomotopyPlanner planner = new IterativeHomotopyPlanner(
299 299
                strategy, graph, missions, constraint, integrator, maxTime,
300 300
                waitMoveDuration, new NewSolutionListener() {
301

  
302 301
                    @Override
303 302
                    public void notifyNewSolution(EvaluatedTrajectory[] trajs) {
304
                        printSummary(trajs);
303
                        if (printSummary) {
304
                            printSummary(trajs);
305
                        }
305 306
                    }
306 307
                });
307 308

  
src/main/java/tt/jointtrajineuclidtime3i/solver/ODSolver.java
2 2

  
3 3
import java.util.List;
4 4

  
5
import org.apache.log4j.Level;
5 6
import org.apache.log4j.Logger;
6 7
import org.jgrapht.DirectedGraph;
7 8
import org.jgrapht.GraphPath;
......
34 35

  
35 36
        this.costLimit = costLimit;
36 37
        this.softConstrainingTrajectories = softConstrainingTrajectories;
38
        LOGGER.setLevel(Level.ERROR);
37 39
    }
38 40

  
39 41
    @Override
src/main/resources/eclipse/Solver (dejvice).launch
1 1
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2 2
<launchConfiguration type="org.eclipse.jdt.launching.localJavaApplication">
3 3
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
4
<listEntry value="/deconfliction-common/src/main/java/tt/jointeuclid2ni/Solver.java"/>
4
<listEntry value="/deconflictiontools/src/main/java/tt/jointeuclid2ni/Solver.java"/>
5 5
</listAttribute>
6 6
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
7 7
<listEntry value="1"/>
8 8
</listAttribute>
9 9
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="tt.jointeuclid2ni.Solver"/>
10 10
<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-method PP -problemfile src/main/resources/problems/dejvice.xml -timeout 5000 -maxtime 2500 -gridstep 25 -showvis"/>
11
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="deconfliction-common"/>
11
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="deconflictiontools"/>
12 12
</launchConfiguration>
src/main/resources/eclipse/Solver (test).launch
1 1
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2 2
<launchConfiguration type="org.eclipse.jdt.launching.localJavaApplication">
3 3
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
4
<listEntry value="/deconfliction-common/src/main/java/tt/jointeuclid2ni/Solver.java"/>
4
<listEntry value="/deconflictiontools/src/main/java/tt/jointeuclid2ni/Solver.java"/>
5 5
</listAttribute>
6 6
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
7 7
<listEntry value="1"/>
8 8
</listAttribute>
9 9
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="tt.jointeuclid2ni.Solver"/>
10 10
<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-method IIHP -problemfile src/main/resources/problems/cross_conflict.xml -timeout 5000 -maxtime 2500 -gridstep 100 -showvis -summary -grid 16"/>
11
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="deconfliction-common"/>
11
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="deconflictiontools"/>
12 12
</launchConfiguration>
src/main/resources/eclipse/Solver.launch
1 1
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2 2
<launchConfiguration type="org.eclipse.jdt.launching.localJavaApplication">
3 3
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
4
<listEntry value="/deconfliction-common/src/main/java/tt/jointeuclid2ni/Solver.java"/>
4
<listEntry value="/deconflictiontools/src/main/java/tt/jointeuclid2ni/Solver.java"/>
5 5
</listAttribute>
6 6
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
7 7
<listEntry value="1"/>
8 8
</listAttribute>
9
<stringAttribute key="org.eclipse.jdt.launching.CLASSPATH_PROVIDER" value="org.eclipse.m2e.launchconfig.classpathProvider"/>
9 10
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="tt.jointeuclid2ni.Solver"/>
10
<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-method PP -problemfile src/main/resources/problems/dejvice.xml -timeout 5000 -maxtime 2500 -gridstep 25 -showvis"/>
11
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="deconfliction-common"/>
11
<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-method PP -problemfile src/main/resources/problems/dejvice.xml -timeout 5000 -maxtime 2500 -gridstep 25 -showvis -summary"/>
12
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="deconflictiontools"/>
13
<stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.eclipse.m2e.launchconfig.sourcepathProvider"/>
12 14
</launchConfiguration>
src/test/java/tt/jointeuclid2ni/SolverTest.java
25 25
        System.setErr(null);
26 26
    }
27 27

  
28
    protected void testSolver(String argStr, String expectedOutput) throws FileNotFoundException {
28
    protected void testSolver(String argStr, String expectedOutputRegExp) throws FileNotFoundException {
29 29
        String[] args = argStr.split(" ");
30 30
        Solver.main(args);
31
        org.junit.Assert.assertEquals(expectedOutput, outContent.toString());
31
        String s = outContent.toString();
32
        org.junit.Assert.assertTrue(outContent.toString().matches(expectedOutputRegExp));
32 33
    }
33 34

  
34 35
    @Test
35 36
    public void testPPOnSymobst() throws FileNotFoundException{
36 37
        testSolver("-method PP -problemfile src/test/resources/problems/symmetric_obstacles.xml -timeout 2000 -maxtime 2500 -gridstep 50 -summary -grid 8",
37
                "2881.00\n");
38
                "^2881.00;[0-9]*;[0-9]*;\n");
38 39
    }
39 40

  
40 41
    @Test
41 42
    public void testODOnSymobst() throws FileNotFoundException{
42
        testSolver("-method OD -problemfile src/test/resources/problems/symmetric_obstacles.xml -timeout 10000 -maxtime 2500 -gridstep 200 -summary -grid 4",
43
                "3200.00\n");
43
        testSolver("-method OD_PIN -problemfile src/test/resources/problems/symmetric_obstacles.xml -timeout 10000 -maxtime 2500 -gridstep 200 -summary -grid 4",
44
                "^3200.00;[0-9]*;[0-9]*;\n");
44 45
    }
45 46

  
46 47
    @Test
47 48
    public void testIIHPOnStopAtGoalProblem() throws FileNotFoundException{
48 49
        testSolver("-method IIHP -problemfile src/test/resources/problems/stopatgoaltest.xml -timeout 1000 -maxtime 2500 -gridstep 30 -summary -grid 4",
49
                "1121.00\n");
50
                "^([0-9\\.]*;[0-9]*;[0-9]*;\n)*1121.00;[0-9]*;[0-9]*;\n");
50 51
    }
51 52

  
52 53

  

Also available in: Unified diff