From f91fd9f076a6ee618eb4d4628945c4a0bf6679fb Mon Sep 17 00:00:00 2001 From: PaoloForte95 Date: Wed, 27 Sep 2023 17:34:20 +0200 Subject: [PATCH] Optional check for blocking. --- .../problems/ConstraintOptimizationProblem.java | 11 ++++++++++- .../problems/LinearOptimizationProblem.java | 13 ++++++++++++- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/src/main/java/se/oru/assignment/assignment_oru/problems/ConstraintOptimizationProblem.java b/src/main/java/se/oru/assignment/assignment_oru/problems/ConstraintOptimizationProblem.java index d673cd6..24fb756 100644 --- a/src/main/java/se/oru/assignment/assignment_oru/problems/ConstraintOptimizationProblem.java +++ b/src/main/java/se/oru/assignment/assignment_oru/problems/ConstraintOptimizationProblem.java @@ -73,6 +73,8 @@ public class ConstraintOptimizationProblem extends ConstraintOptimization{ protected int numAllocation; + protected boolean checkBlocking; + //Paths protected HashMap pathsToTargetGoal = new HashMap(); protected ArrayList pathsDrivingRobots = new ArrayList (); @@ -198,6 +200,7 @@ public ConstraintOptimizationProblem(boolean instanceFleetMaster){ } metaCSPLogger = MetaCSPLogging.getLogger(this.getClass()); numAllocation = 1; + checkBlocking = false; } @@ -1098,11 +1101,17 @@ protected double[][][] computeTardiness(double [][][]PAll) { return BFunction; } + + public void checkforBlocking(){ + this.checkBlocking = true; + } public int [][][] findOptimalAssignment(AbstractOptimizationAlgorithm optimizationSolver){ realRobotsIDs = coordinator.getIdleRobots(); - checkOnBlocking(); + if(checkBlocking){ + checkOnBlocking(); + } return super.findOptimalAssignment(optimizationSolver); } diff --git a/src/main/java/se/oru/assignment/assignment_oru/problems/LinearOptimizationProblem.java b/src/main/java/se/oru/assignment/assignment_oru/problems/LinearOptimizationProblem.java index 1432293..2ec2f13 100644 --- a/src/main/java/se/oru/assignment/assignment_oru/problems/LinearOptimizationProblem.java +++ b/src/main/java/se/oru/assignment/assignment_oru/problems/LinearOptimizationProblem.java @@ -72,6 +72,8 @@ public class LinearOptimizationProblem extends LinearOptimization{ protected int numAllocation; + protected boolean checkBlocking; + //Paths protected HashMap pathsToTargetGoal = new HashMap(); protected ArrayList pathsDrivingRobots = new ArrayList (); @@ -91,6 +93,8 @@ public class LinearOptimizationProblem extends LinearOptimization{ protected String scenario; protected boolean saveFutureAllocations = false; + + /** * The default footprint used for robots if none is specified. * NOTE: coordinates in footprints must be given in in CCW or CW order. @@ -197,6 +201,7 @@ public LinearOptimizationProblem(boolean instanceFleetMaster){ } metaCSPLogger = MetaCSPLogging.getLogger(this.getClass()); numAllocation = 1; + checkBlocking = false; } @@ -1100,11 +1105,17 @@ protected double[][][] computeTardiness(double [][][]PAll) { return BFunction; } + + public void checkforBlocking(){ + this.checkBlocking = true; + } public int [][][] findOptimalAssignment(AbstractOptimizationAlgorithm optimizationSolver){ realRobotsIDs = coordinator.getIdleRobots(); - checkOnBlocking(); + if(checkBlocking){ + checkOnBlocking(); + } return super.findOptimalAssignment(optimizationSolver); }