Revision 85:59e22d3e8124

View differences:

src/main/java/tt/jointeuclid2ni/SIPPDebug.java
1
package tt.jointeuclid2ni;
2

  
3

  
4
import tt.euclid2i.Point;
5
import tt.euclid2i.Region;
6
import tt.euclid2i.discretization.LazyGrid;
7
import tt.euclid2i.probleminstance.Environment;
8
import tt.euclid2i.region.Rectangle;
9
import tt.jointeuclid2ni.probleminstance.EarliestArrivalProblem;
10
import tt.jointeuclid2ni.probleminstance.generator.ConflictGenerator;
11
import tt.jointeuclid2ni.probleminstance.generator.exception.ProblemNotCreatedException;
12
import tt.jointeuclid2ni.solver.Algorithms;
13
import tt.jointeuclid2ni.solver.HeuristicType;
14
import tt.jointeuclid2ni.solver.ObjectiveType;
15
import tt.jointeuclid2ni.solver.Parameters;
16

  
17
import java.util.Arrays;
18
import java.util.Collection;
19
import java.util.Collections;
20

  
21
public class SIPPDebug {
22
    public static void main(String[] args) throws ProblemNotCreatedException {
23

  
24

  
25
        int[] radiuses = bodyRadiuses(4, 50);
26
        final Rectangle rectangle = new Rectangle(new Point(0, 0), new Point(1000, 1000));
27

  
28
        Environment environment = new Environment() {
29
            @Override
30
            public Collection<Region> getObstacles() {
31
                return Collections.emptyList();
32
            }
33

  
34
            @Override
35
            public Rectangle getBounds() {
36
                return rectangle;
37
            }
38
        };
39

  
40
        EarliestArrivalProblem problem = ConflictGenerator.generateSingleInstance(environment, radiuses, LazyGrid.PATTERN_8_WAY_WAIT, 50, 1, rectangle);
41
        Parameters parameters = parameters(LazyGrid.PATTERN_8_WAY_WAIT, Algorithms.PP);
42

  
43
        LocalSolver solver = new LocalSolver(problem, parameters);
44
        solver.solve(args);
45
    }
46

  
47
    public static Parameters parameters(int[][] PATTERN_4_WAY, Algorithms algorithm) {
48
        Parameters parameters = new Parameters();
49

  
50
        parameters.showVis = true;
51
        parameters.printSummary = true;
52
        parameters.summaryPrefix = "";
53
        parameters.verbose = false;
54
        parameters.maxTime = 5000;
55
        parameters.gridStep = 50;
56
        parameters.maxSpeed = 1;
57
        parameters.startedAtMs = 0;
58
        parameters.runtimeDeadlineMs = Long.MAX_VALUE;
59
        parameters.waitMoveDuration = 50;
60
        parameters.gridPattern = PATTERN_4_WAY;
61
        parameters.heuristic = HeuristicType.L2;
62
        parameters.objective = ObjectiveType.ARRIVAL;
63
        parameters.selectedAlgorithm = algorithm;
64

  
65
        return parameters;
66
    }
67

  
68
    private static int[] bodyRadiuses(int N, int r) {
69
        int[] ints = new int[N];
70
        Arrays.fill(ints, r);
71
        return ints;
72
    }
73

  
74
}

Also available in: Unified diff