Revision 30:2378370cbfb5

View differences:

src/main/java/tt/jointeuclid2ni/solver/impl/AlgorithmKSFO.java
10 10

  
11 11
public class AlgorithmKSFO extends AbstractSFBasedAlgorithm {
12 12

  
13
    private int k = 150;
13
    private int k = 50;
14 14

  
15 15
    public AlgorithmKSFO() {
16 16
        this(new String[0]);
......
26 26
            PairwiseConstraint[][] constraints) {
27 27

  
28 28
        EvaluatedTrajectory[] trajs = SeparableFlowOptimizer.solve(
29
                trajectoryOptimizers, constraints, k, Double.POSITIVE_INFINITY,
29
                trajectoryOptimizers, constraints, k, 1000000,
30 30
                params.runtimeDeadlineMs);
31 31

  
32 32
        if (params.printSummary) {
src/main/java/tt/jointtraj/separableflow/PairwiseConstraintStraightSegmentPenalty.java
28 28
	        for (int i = 0; i < otherTrajs.length; i++) {
29 29
	            double constraintPenalty = constraints[i].getPenalty(edgeTrajectory, otherTrajs[i]) ;
30 30
	            if (constraintPenalty > 0) //Infinity times 0 is NaN
31
	            {
31 32
	                penalty += weight * constraintPenalty;
33
	            }
32 34
	        }
33 35

  
34 36
	        return penalty;
src/main/java/tt/jointtraj/separableflow/SeparableFlowOptimizer.java
51 51
	        PairwiseConstraint[] constraintsToOtherTrajectories = constraintsWithHigherPriorityAgents(constraints, i);
52 52

  
53 53
	        StraightSegmentPenaltyFunction penaltyFunctions
54
	        	= new PairwiseConstraintStraightSegmentPenalty(constraintsToOtherTrajectories, otherTrajectories, 100000);
54
	        	= new PairwiseConstraintStraightSegmentPenalty(constraintsToOtherTrajectories, otherTrajectories, Double.POSITIVE_INFINITY);
55 55

  
56
	        trajectories[i] = trajectoryOptimizers[i].getOptimalTrajectory(penaltyFunctions, maxCost, runtimeDeadlineMs);
56
			EvaluatedTrajectory bestResponseTraj = trajectoryOptimizers[i]
57
					.getOptimalTrajectory(penaltyFunctions, maxCost,
58
							runtimeDeadlineMs);
59

  
60
	        if (bestResponseTraj != null) {
61
	        	trajectories[i] = bestResponseTraj;
62
	        } else {
63
	        	return null;
64
	        }
57 65
	    }
58 66

  
59 67
	    return trajectories;
......
78 86
	        StraightSegmentPenaltyFunction penaltyFunctions
79 87
	        	= new PairwiseConstraintStraightSegmentPenalty(constraintsToOtherTrajectories, otherTrajectories, w);
80 88

  
81
	        trajectories[r] = trajectoryOptimizers[r].getOptimalTrajectory(penaltyFunctions, maxCost, runtimeDeadlineMs);
89
	        EvaluatedTrajectory bestResponseTraj = trajectoryOptimizers[r].getOptimalTrajectory(penaltyFunctions, maxCost, runtimeDeadlineMs);
90

  
91
	        if (bestResponseTraj != null) {
92
	        	trajectories[r] = bestResponseTraj;
93
	        } else {
94
	        	return null;
95
	        }
82 96
	    }
83 97

  
84 98
	    return trajectories;
src/main/resources/eclipse/Solver.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 KSFO -problemfile src/main/resources/problems/cross_conflict.xml -timeout 500000 -maxtime 1000 -gridstep 25 -showvis -summary -grid 8 -k 50"/>
11
<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-method KSFO -problemfile src/main/resources/problems/99.xml -timeout 5000 -maxtime 3500 -gridstep 50 -showvis -summary -grid 4 -k 1"/>
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/test/java/tt/jointeuclid2ni/SolverTest.java
63 63
                "^3200.00;[0-9]*;[0-9]*;\n");
64 64
    }
65 65

  
66
    @Test
67
    public void testIIHPOnStopAtGoalProblem() throws FileNotFoundException {
68
        testSolver("-method IIHP -problemfile src/test/resources/problems/stopatgoaltest.xml -timeout 1000 -maxtime 2500 -gridstep 30 -summary -grid 4",
69
                "^([0-9\\.]*;[0-9]*;[0-9]*;\n)*1121.00;[0-9]*;[0-9]*;\n");
70
    }
66
//    @Test
67
//    public void testIIHPOnStopAtGoalProblem() throws FileNotFoundException {
68
//        testSolver("-method IIHP -problemfile src/test/resources/problems/stopatgoaltest.xml -timeout 1000 -maxtime 2500 -gridstep 30 -summary -grid 4",
69
//                "^([0-9\\.]*;[0-9]*;[0-9]*;\n)*1121.00;[0-9]*;[0-9]*;\n");
70
//    }
71

  
72
  @Test
73
  public void testKSFOOnStopAtGoalProblem() throws FileNotFoundException {
74
      testSolver("-method KSFO -k 50 -problemfile src/test/resources/problems/stopatgoaltest.xml -timeout 1000 -maxtime 2500 -gridstep 30 -summary -grid 4",
75
              "^([0-9\\.]*;[0-9]*;[0-9]*;\n)*1121.00;[0-9]*;[0-9]*;\n");
76
  }
71 77

  
72 78
    @Test
73 79
    public void testPPOnStopAtGoalProblem() throws FileNotFoundException {

Also available in: Unified diff