mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-11-09 20:41:10 +00:00
bug3484 recursive level as parameter & refactored task
This commit is contained in:
1 parent
8334d5312d
commit
d3b5d77ab5
17 files changed
+177
-61
No files matched your search
@@ -0,0 +1,9 @@
|
||||
---
|
||||
VM version: Oct 9 2017 15:07:17 - 81_REL - optU - windows amd64 - 6 - bas2:294982 (mixed mode)
|
||||
|
||||
Time:2017-11-1609:24:18
|
||||
Pid: 10260
|
||||
Hostname: WDFN34222622A
|
||||
current dir: C:\Users\D070307\.git\.projects\git\java\com.sap.sse.test
|
||||
---
|
||||
: [15080] 09:24:18 ***Warning: DebuggingOnDemand was deactivated
|
||||
@@ -0,0 +1,9 @@
|
||||
---
|
||||
VM version: Oct 9 2017 15:07:17 - 81_REL - optU - windows amd64 - 6 - bas2:294982 (mixed mode)
|
||||
|
||||
Time:2017-11-1609:22:59
|
||||
Pid: 1032
|
||||
Hostname: WDFN34222622A
|
||||
current dir: C:\Users\D070307\.git\.projects\git\java\com.sap.sse.test
|
||||
---
|
||||
: [8920] 09:22:59 ***Warning: DebuggingOnDemand was deactivated
|
||||
@@ -0,0 +1,9 @@
|
||||
---
|
||||
VM version: Oct 9 2017 15:07:17 - 81_REL - optU - windows amd64 - 6 - bas2:294982 (mixed mode)
|
||||
|
||||
Time:2017-11-1608:37:46
|
||||
Pid: 10608
|
||||
Hostname: WDFN34222622A
|
||||
current dir: C:\Users\D070307\.git\.projects\git\java\com.sap.sse.test
|
||||
---
|
||||
: [12984] 08:37:46 ***Warning: DebuggingOnDemand was deactivated
|
||||
@@ -0,0 +1,9 @@
|
||||
---
|
||||
VM version: Oct 9 2017 15:07:17 - 81_REL - optU - windows amd64 - 6 - bas2:294982 (mixed mode)
|
||||
|
||||
Time:2017-11-1609:14:46
|
||||
Pid: 10936
|
||||
Hostname: WDFN34222622A
|
||||
current dir: C:\Users\D070307\.git\.projects\git\java\com.sap.sse.test
|
||||
---
|
||||
: [14860] 09:14:46 ***Warning: DebuggingOnDemand was deactivated
|
||||
@@ -0,0 +1,9 @@
|
||||
---
|
||||
VM version: Oct 9 2017 15:07:17 - 81_REL - optU - windows amd64 - 6 - bas2:294982 (mixed mode)
|
||||
|
||||
Time:2017-11-1608:48:50
|
||||
Pid: 10948
|
||||
Hostname: WDFN34222622A
|
||||
current dir: C:\Users\D070307\.git\.projects\git\java\com.sap.sse.test
|
||||
---
|
||||
: [5880] 08:48:50 ***Warning: DebuggingOnDemand was deactivated
|
||||
@@ -0,0 +1,9 @@
|
||||
---
|
||||
VM version: Oct 9 2017 15:07:17 - 81_REL - optU - windows amd64 - 6 - bas2:294982 (mixed mode)
|
||||
|
||||
Time:2017-11-1608:49:10
|
||||
Pid: 13784
|
||||
Hostname: WDFN34222622A
|
||||
current dir: C:\Users\D070307\.git\.projects\git\java\com.sap.sse.test
|
||||
---
|
||||
: [13668] 08:49:10 ***Warning: DebuggingOnDemand was deactivated
|
||||
@@ -0,0 +1,9 @@
|
||||
---
|
||||
VM version: Oct 9 2017 15:07:17 - 81_REL - optU - windows amd64 - 6 - bas2:294982 (mixed mode)
|
||||
|
||||
Time:2017-11-1609:10:51
|
||||
Pid: 14872
|
||||
Hostname: WDFN34222622A
|
||||
current dir: C:\Users\D070307\.git\.projects\git\java\com.sap.sse.test
|
||||
---
|
||||
: [2828] 09:10:51 ***Warning: DebuggingOnDemand was deactivated
|
||||
@@ -0,0 +1,9 @@
|
||||
---
|
||||
VM version: Oct 9 2017 15:07:17 - 81_REL - optU - windows amd64 - 6 - bas2:294982 (mixed mode)
|
||||
|
||||
Time:2017-11-1608:23:54
|
||||
Pid: 15076
|
||||
Hostname: WDFN34222622A
|
||||
current dir: C:\Users\D070307\.git\.projects\git\java\com.sap.sse.test
|
||||
---
|
||||
: [552] 08:23:54 ***Warning: DebuggingOnDemand was deactivated
|
||||
@@ -0,0 +1,9 @@
|
||||
---
|
||||
VM version: Oct 9 2017 15:07:17 - 81_REL - optU - windows amd64 - 6 - bas2:294982 (mixed mode)
|
||||
|
||||
Time:2017-11-1609:12:41
|
||||
Pid: 2056
|
||||
Hostname: WDFN34222622A
|
||||
current dir: C:\Users\D070307\.git\.projects\git\java\com.sap.sse.test
|
||||
---
|
||||
: [12856] 09:12:41 ***Warning: DebuggingOnDemand was deactivated
|
||||
@@ -0,0 +1,9 @@
|
||||
---
|
||||
VM version: Oct 9 2017 15:07:17 - 81_REL - optU - windows amd64 - 6 - bas2:294982 (mixed mode)
|
||||
|
||||
Time:2017-11-1609:20:54
|
||||
Pid: 2692
|
||||
Hostname: WDFN34222622A
|
||||
current dir: C:\Users\D070307\.git\.projects\git\java\com.sap.sse.test
|
||||
---
|
||||
: [1164] 09:20:54 ***Warning: DebuggingOnDemand was deactivated
|
||||
@@ -0,0 +1,9 @@
|
||||
---
|
||||
VM version: Oct 9 2017 15:07:17 - 81_REL - optU - windows amd64 - 6 - bas2:294982 (mixed mode)
|
||||
|
||||
Time:2017-11-1608:49:38
|
||||
Pid: 3068
|
||||
Hostname: WDFN34222622A
|
||||
current dir: C:\Users\D070307\.git\.projects\git\java\com.sap.sse.test
|
||||
---
|
||||
: [2228] 08:49:38 ***Warning: DebuggingOnDemand was deactivated
|
||||
@@ -0,0 +1,9 @@
|
||||
---
|
||||
VM version: Oct 9 2017 15:07:17 - 81_REL - optU - windows amd64 - 6 - bas2:294982 (mixed mode)
|
||||
|
||||
Time:2017-11-1609:11:20
|
||||
Pid: 4156
|
||||
Hostname: WDFN34222622A
|
||||
current dir: C:\Users\D070307\.git\.projects\git\java\com.sap.sse.test
|
||||
---
|
||||
: [11636] 09:11:20 ***Warning: DebuggingOnDemand was deactivated
|
||||
@@ -0,0 +1,9 @@
|
||||
---
|
||||
VM version: Oct 9 2017 15:07:17 - 81_REL - optU - windows amd64 - 6 - bas2:294982 (mixed mode)
|
||||
|
||||
Time:2017-11-1609:12:54
|
||||
Pid: 7316
|
||||
Hostname: WDFN34222622A
|
||||
current dir: C:\Users\D070307\.git\.projects\git\java\com.sap.sse.test
|
||||
---
|
||||
: [7244] 09:12:54 ***Warning: DebuggingOnDemand was deactivated
|
||||
@@ -0,0 +1,9 @@
|
||||
---
|
||||
VM version: Oct 9 2017 15:07:17 - 81_REL - optU - windows amd64 - 6 - bas2:294982 (mixed mode)
|
||||
|
||||
Time:2017-11-1609:14:32
|
||||
Pid: 9484
|
||||
Hostname: WDFN34222622A
|
||||
current dir: C:\Users\D070307\.git\.projects\git\java\com.sap.sse.test
|
||||
---
|
||||
: [7252] 09:14:32 ***Warning: DebuggingOnDemand was deactivated
|
||||
@@ -0,0 +1,9 @@
|
||||
---
|
||||
VM version: Oct 9 2017 15:07:17 - 81_REL - optU - windows amd64 - 6 - bas2:294982 (mixed mode)
|
||||
|
||||
Time:2017-11-1608:21:49
|
||||
Pid: 9896
|
||||
Hostname: WDFN34222622A
|
||||
current dir: C:\Users\D070307\.git\.projects\git\java\com.sap.sse.test
|
||||
---
|
||||
: [14852] 08:21:49 ***Warning: DebuggingOnDemand was deactivated
|
||||
+6
-19
@@ -3,7 +3,6 @@ package com.sap.see.pairinglist.test;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.stream.IntStream;
|
||||
|
||||
import org.junit.Before;
|
||||
@@ -61,13 +60,13 @@ public class PairingListTemplateFactoryTest {
|
||||
@Test
|
||||
public void testGeneration() {
|
||||
PairingListTemplateFactoryImpl factoryImpl = new PairingListTemplateFactoryImpl();
|
||||
// PairingListTemplate example1 = factoryImpl.getOrCreatePairingListTemplate(new PairingFrameProviderTest(15, 3, 18));
|
||||
// PairingListTemplate example2 = factoryImpl.getOrCreatePairingListTemplate(new PairingFrameProviderTest(45, 6, 18));
|
||||
PairingListTemplate example3 = factoryImpl.getOrCreatePairingListTemplate(new PairingFrameProviderTest(8, 3, 30));
|
||||
|
||||
// assertNotNull(example1);
|
||||
// assertNotNull(example2);
|
||||
PairingListTemplate example1 = factoryImpl.getOrCreatePairingListTemplate(new PairingFrameProviderTest(15, 3, 18));
|
||||
PairingListTemplate example2 = factoryImpl.getOrCreatePairingListTemplate(new PairingFrameProviderTest(45, 6, 18));
|
||||
PairingListTemplate example3 = factoryImpl.getOrCreatePairingListTemplate(new PairingFrameProviderTest(10, 3, 30));
|
||||
assertNotNull(example1);
|
||||
assertNotNull(example2);
|
||||
assertNotNull(example3);
|
||||
|
||||
/*
|
||||
for(int[] row : example1.getPairingListTemplate()) {
|
||||
System.out.println(Arrays.toString(row));
|
||||
@@ -124,16 +123,4 @@ public class PairingListTemplateFactoryTest {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testArrayCopy() {
|
||||
int[] test1 = {1,2,3,4,5};
|
||||
int[] test2 = new int[test1.length];
|
||||
for(int i = test1.length; i>0; i--) {
|
||||
test2[i-1] = test1[i-1];
|
||||
}
|
||||
if(!Arrays.toString(test1).equals(Arrays.toString(test2))) {
|
||||
Assert.fail();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -126,7 +126,7 @@ public class PairingListTemplateImpl implements PairingListTemplate {
|
||||
|
||||
ArrayList<Future<int[][]>> futures = this.createConstantFlights(flightCount, groupCount, competitors,
|
||||
new int[competitors][competitors], new int[flightCount * groupCount][competitors / groupCount], seeds,
|
||||
new ArrayList<>());
|
||||
new ArrayList<>(), 0);
|
||||
|
||||
for (Future<int[][]> f : futures) {
|
||||
try {
|
||||
@@ -181,10 +181,9 @@ public class PairingListTemplateImpl implements PairingListTemplate {
|
||||
return seeds;
|
||||
}
|
||||
|
||||
//TODO: rename
|
||||
class Task implements Callable<int[][]> {
|
||||
int flights,groups,competitors, seedLength;
|
||||
int[][] plt,associations;
|
||||
class SuffixCreationTask implements Callable<int[][]> {
|
||||
int flights, groups, competitors, seedLength;
|
||||
int[][] plt, associations;
|
||||
//TODO document array copies
|
||||
/**
|
||||
* This task is created every time a constant is generated. It generates a specific number of PairingListTemplates,which is based on the constant flights
|
||||
@@ -195,7 +194,7 @@ public class PairingListTemplateImpl implements PairingListTemplate {
|
||||
* @param constantPLT constant generated flights on which the tasks is based on
|
||||
* @param associations associations created from constantPLT
|
||||
*/
|
||||
Task(int flights, int groups, int competitors, int[][] constantPLT, int[][] associations, int seedLength) {
|
||||
SuffixCreationTask(int flights, int groups, int competitors, int[][] constantPLT, int[][] associations, int seedLength) {
|
||||
this.flights = flights;
|
||||
this.groups = groups;
|
||||
this.competitors = competitors;
|
||||
@@ -228,51 +227,46 @@ public class PairingListTemplateImpl implements PairingListTemplate {
|
||||
* @param associations
|
||||
* @param currentPLT
|
||||
* @param seeds
|
||||
* @return <code>ArrayList</code> of <code>Futures</code> in which the result of a single task saved
|
||||
* @return <code>ArrayList</code> of <code>Futures</code> in which the result of a single task is saved
|
||||
*/
|
||||
private ArrayList<Future<int[][]>> createConstantFlights(int flights, int groups, int competitors, int[][] associations,
|
||||
int[][]currentPLT, int[] seeds, ArrayList<Future<int[][]>> futures) {
|
||||
// TODO: change depth of groups
|
||||
int level = Integer.MAX_VALUE;
|
||||
for (int z = 0; z < currentPLT.length; z++) {
|
||||
if (z < this.maxConstantFlights * groups) {
|
||||
if (currentPLT[z][0] == 0) {
|
||||
level = z;
|
||||
// calculate Flights for current recurrence level
|
||||
for (int seedIndex = 0; seedIndex < seeds.length; seedIndex++) {
|
||||
int[][] temp = this.createFlight(flights, groups, competitors, associations, seeds[seedIndex]);
|
||||
// TODO: change arraycopy + refactor fleet
|
||||
for (int m = 0; m < groups; m++) {
|
||||
System.arraycopy(temp[m], 0, currentPLT[level + m], 0, competitors / groups);
|
||||
}
|
||||
associations = this.incrementAssociations(temp, associations);
|
||||
this.createConstantFlights(flights, groups, competitors, associations, currentPLT, seeds,
|
||||
futures);
|
||||
associations = this.decrementAssociations(temp, associations);
|
||||
int[][]currentPLT, int[] seeds, ArrayList<Future<int[][]>> futures, int level) {
|
||||
|
||||
if (level < this.maxConstantFlights) {
|
||||
if (currentPLT[level * groups][0] == 0) {
|
||||
// calculate Flights for current recurrence level
|
||||
for (int seedIndex = 0; seedIndex < seeds.length; seedIndex++) {
|
||||
int[][] temp = this.createFlight(flights, groups, competitors, associations, seeds[seedIndex]);
|
||||
// TODO: change arraycopy + refactor fleet
|
||||
for (int m = 0; m < groups; m++) {
|
||||
System.arraycopy(temp[m], 0, currentPLT[level * groups + m], 0, competitors / groups);
|
||||
}
|
||||
int[][] temp = new int[groups][competitors / groups];
|
||||
|
||||
// reset last recurrence step
|
||||
for (int i = level; i < level + groups; i++) {
|
||||
System.arraycopy(currentPLT[i], 0, temp[i - level], 0, competitors / groups);
|
||||
Arrays.fill(currentPLT[i], 0);
|
||||
}
|
||||
|
||||
break;
|
||||
level++;
|
||||
associations = this.incrementAssociations(temp, associations);
|
||||
this.createConstantFlights(flights, groups, competitors, associations, currentPLT, seeds,
|
||||
futures, level);
|
||||
level--;
|
||||
associations = this.decrementAssociations(temp, associations);
|
||||
}
|
||||
} else {
|
||||
// Task start
|
||||
Future<int[][]> future = executorService.submit((new Task(flights, groups, competitors, currentPLT, associations, seeds.length)));
|
||||
futures.add(future);
|
||||
|
||||
int[][] temp = new int[groups][competitors / groups];
|
||||
|
||||
// reset last recurrence step
|
||||
for (int i = maxConstantFlights * groups - 1; i >= maxConstantFlights * groups - groups; i--) {
|
||||
System.arraycopy(currentPLT[i], 0, temp[i - maxConstantFlights * groups + groups], 0, competitors / groups);
|
||||
for (int i = level * groups; i < level * groups + groups; i++) {
|
||||
System.arraycopy(currentPLT[i], 0, temp[i - level * groups], 0, competitors / groups);
|
||||
Arrays.fill(currentPLT[i], 0);
|
||||
}
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
// Task start
|
||||
Future<int[][]> future = executorService.submit((new SuffixCreationTask(flights, groups, competitors, currentPLT, associations, seeds.length)));
|
||||
futures.add(future);
|
||||
|
||||
int[][] temp = new int[groups][competitors / groups];
|
||||
|
||||
// reset last recurrence step
|
||||
for (int i = maxConstantFlights * groups - 1; i >= maxConstantFlights * groups - groups; i--) {
|
||||
System.arraycopy(currentPLT[i], 0, temp[i - maxConstantFlights * groups + groups], 0, competitors / groups);
|
||||
Arrays.fill(currentPLT[i], 0);
|
||||
}
|
||||
}
|
||||
return futures;
|
||||
|
||||
Reference in new issue
Block a user