Skip to content

Commit

Permalink
22.5 --
Browse files Browse the repository at this point in the history
  • Loading branch information
dmitry committed Dec 14, 2017
1 parent aef44f9 commit d98f7e7
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 12 deletions.
Binary file added 22.5.jar
Binary file not shown.
34 changes: 23 additions & 11 deletions core/src/MyStrategy.java
Original file line number Diff line number Diff line change
Expand Up @@ -356,13 +356,19 @@ private PlainArray calcMap(VehicleGroupInfo group) { //TODO improve logic at fin
if (myArrvs.isEmpty()) {
addToArrayNotOurFacilities(plainArray, range, 1, group);
} else {
HashSet<Map.Entry<Point2D, Integer>> entries = new HashSet<>(myArrvs);
for (Map.Entry<Point2D, Integer> en : entries) {
en.setValue(1);
VehicleGroupInfo maxArrvG = myGroups.stream().filter(g -> g.vehicleType == ARRV).max(Comparator.comparingInt(g -> g.vehicles.size())).orElse(null);

HashSet<Map.Entry<Point2D, Integer>> entries = new HashSet<>();
if (maxArrvG != null) {
entries.add(new AbstractMap.SimpleEntry<>(maxArrvG.getCellAveragePoint(), 1));
} else {
entries.addAll(myArrvs);
for (Map.Entry<Point2D, Integer> en : entries) {
en.setValue(1);
}
}
//TODO go to single point
addToArray(plainArray, entries, range, .1f);

addToArray(plainArray, myArrvs, range, .1f);
}

} else {
Expand Down Expand Up @@ -451,12 +457,18 @@ private PlainArray calcMap(VehicleGroupInfo group) { //TODO improve logic at fin
if (myIfvs.isEmpty()) {
addToArrayNotOurFacilities(plainArray, range, 1, group);
} else {
HashSet<Map.Entry<Point2D, Integer>> entries = new HashSet<>(myIfvs);
for (Map.Entry<Point2D, Integer> en : entries) {
en.setValue(1);
VehicleGroupInfo maxIfvG = myGroups.stream().filter(g -> g.vehicleType == IFV).max(Comparator.comparingInt(g -> g.vehicles.size())).orElse(null);

HashSet<Map.Entry<Point2D, Integer>> entries = new HashSet<>();
if (maxIfvG != null) {
entries.add(new AbstractMap.SimpleEntry<>(maxIfvG.getCellAveragePoint(), 1));
} else {
entries.addAll(myIfvs);
for (Map.Entry<Point2D, Integer> en : entries) {
en.setValue(1);
}
}
//TODO go to single point
addToArray(plainArray, myIfvs, range, .1f);
addToArray(plainArray, entries, range, .1f);
}
}

Expand Down Expand Up @@ -873,7 +885,7 @@ private void addToArrayNotOurFacilities(PlainArray plainArray, double range, flo
addToArray(plainArray, fc.get(-1L).get(VEHICLE_FACTORY).entrySet(), range, factor);
} else {
HashSet<Map.Entry<Point2D, Integer>> counts = new HashSet<>();
counts.add(new AbstractMap.SimpleEntry<Point2D, Integer>(group.goToFacility.getCenterCellPos(), 1));
counts.add(new AbstractMap.SimpleEntry<>(group.goToFacility.getCenterCellPos(), 1));
addToArray(plainArray, counts, range, factor);
}
}
Expand Down
3 changes: 2 additions & 1 deletion core/src/Runner.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ public static void main(String[] args) throws IOException {
//runProc(null, true, "java", "-cp", "19.jar", "Runner");
//runProc(null, true, "java", "-cp", "21.jar", "Runner");
//runProc(null, true, "java", "-cp", "22.jar", "Runner");
runProc(null, true, "java", "-cp", "22.3.jar", "Runner");
//runProc(null, true, "java", "-cp", "22.3.jar", "Runner");
runProc(null, true, "java", "-cp", "22.4.jar", "Runner");
}
}).start();
new Runner(new String[]{"127.0.0.1", hasArgs ? "31001" : "31002", "0000000000000000"}).run();
Expand Down

0 comments on commit d98f7e7

Please sign in to comment.