Add parallelization of multiple simulations
This commit is contained in:
parent
4c2d0ccf50
commit
eece2c1d3a
@ -7,6 +7,8 @@ import fr.ntr.scheduler.Scheduler;
|
|||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.concurrent.ExecutorService;
|
||||||
|
import java.util.concurrent.Executors;
|
||||||
|
|
||||||
public class Main {
|
public class Main {
|
||||||
|
|
||||||
@ -26,17 +28,18 @@ public class Main {
|
|||||||
}
|
}
|
||||||
int timeSlotNb = 2;
|
int timeSlotNb = 2;
|
||||||
int subCarrierNb = 100;
|
int subCarrierNb = 100;
|
||||||
for(int i = 2; i <= maximumLoad; i += 2) {
|
try(ExecutorService executor = Executors.newFixedThreadPool(Runtime.getRuntime().availableProcessors())) {
|
||||||
List<User> users = generateUsers(i, timeSlotNb, subCarrierNb);
|
for(int i = 2; i <= maximumLoad; i += 2) {
|
||||||
ResourceBlock[][] frame = new ResourceBlock[timeSlotNb][subCarrierNb];
|
List<User> users = generateUsers(i, timeSlotNb, subCarrierNb);
|
||||||
//Scheduler scheduler = new MaxSNR(frame, users);
|
ResourceBlock[][] frame = new ResourceBlock[timeSlotNb][subCarrierNb];
|
||||||
// Scheduler scheduler = new ProportionalFair(frame, users);
|
//Scheduler scheduler = new MaxSNR(frame, users);
|
||||||
Scheduler scheduler = new RoundRobin(frame, users);
|
// Scheduler scheduler = new ProportionalFair(frame, users);
|
||||||
AccessPoint accessPoint = new AccessPoint(scheduler, frame, users, timeSlotNb, subCarrierNb, 0, 50);
|
Scheduler scheduler = new RoundRobin(frame, users);
|
||||||
accessPoint.startSimulation(numberOfTicks);
|
AccessPoint accessPoint = new AccessPoint(scheduler, frame, users, timeSlotNb, subCarrierNb, 0, 50);
|
||||||
|
executor.submit(() -> accessPoint.startSimulation(numberOfTicks));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
System.err.println("Please give launch arguments");
|
System.err.println("Please give launch arguments");
|
||||||
System.err.println("gradle run --args=\"<number of ticks> <number of users>\"");
|
System.err.println("gradle run --args=\"<number of ticks> <number of users>\"");
|
||||||
System.exit(1);
|
System.exit(1);
|
||||||
|
Reference in New Issue
Block a user