Skip to content

Commit

Permalink
better interface for RunManagerMovingAIBenchmark and RunManagerWarehouse
Browse files Browse the repository at this point in the history
  • Loading branch information
J-morag committed Feb 9, 2023
1 parent 17f2909 commit 45da63d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@
public class RunManagerMovingAIBenchmark extends A_RunManager{

private final String entireBenchmarkDir;
private final Integer maxNumAgents;
private final int[] agentNums;

public RunManagerMovingAIBenchmark(String entireBenchmarkDir, Integer maxNumAgents) {
public RunManagerMovingAIBenchmark(String entireBenchmarkDir, int[] agentNums) {
this.entireBenchmarkDir = entireBenchmarkDir;
this.maxNumAgents = maxNumAgents;
this.agentNums = agentNums;
}


Expand All @@ -27,19 +27,17 @@ void setSolvers() {

@Override
void setExperiments() {
addAllMapsAndInstances(this.maxNumAgents, this.entireBenchmarkDir);
addAllMapsAndInstances(this.entireBenchmarkDir, this.agentNums);
}

/* = Experiments = */

private void addAllMapsAndInstances(Integer maxNumAgents, String entireBenchmarkDir){
maxNumAgents = maxNumAgents != null ? maxNumAgents : -1;

private void addAllMapsAndInstances(String entireBenchmarkDir, int[] agentNums){
/* = Set Properties = */
InstanceProperties properties = new InstanceProperties(null, -1, IntStream.rangeClosed(1, maxNumAgents).toArray());
InstanceProperties properties = new InstanceProperties(null, -1, agentNums);

/* = Set Instance Manager = */
InstanceManager instanceManager = new InstanceManager(entireBenchmarkDir, new InstanceBuilder_MovingAI(),properties);
InstanceManager instanceManager = new InstanceManager(entireBenchmarkDir, new InstanceBuilder_MovingAI(), properties);

/* = Add new experiment = */
Experiment EntireMovingAIBenchmark = new Experiment("EntireMovingAIBenchmark", instanceManager);
Expand Down
14 changes: 6 additions & 8 deletions src/main/java/Environment/RunManagers/RunManagerWarehouse.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@
public class RunManagerWarehouse extends A_RunManager{

private final String warehouseMaps;
private final Integer maxNumAgents;
private final int[] agentNums;

public RunManagerWarehouse(String warehouseMaps, Integer maxNumAgents) {
public RunManagerWarehouse(String warehouseMaps, int[] agentNums) {
this.warehouseMaps = warehouseMaps;
this.maxNumAgents = maxNumAgents;
this.agentNums = agentNums;
}

@Override
Expand All @@ -26,16 +26,14 @@ void setSolvers() {

@Override
void setExperiments() {
addAllMapsAndInstances(this.maxNumAgents, this.warehouseMaps);
addAllMapsAndInstances(this.warehouseMaps, this.agentNums);
}

/* = Experiments = */

private void addAllMapsAndInstances(Integer maxNumAgents, String instancesDir){
maxNumAgents = maxNumAgents != null ? maxNumAgents : -1;

private void addAllMapsAndInstances(String instancesDir, int[] agentNums){
/* = Set Properties = */
InstanceProperties properties = new InstanceProperties(null, -1, IntStream.rangeClosed(1, maxNumAgents).toArray());
InstanceProperties properties = new InstanceProperties(null, -1, agentNums);

/* = Set Instance Manager = */
InstanceManager instanceManager = new InstanceManager(instancesDir, new InstanceBuilder_Warehouse(),properties);
Expand Down

0 comments on commit 45da63d

Please sign in to comment.