From e2df807f64e248fe7e24b91cc06f0c0c824a5f4e Mon Sep 17 00:00:00 2001 From: dmitry Date: Sun, 17 Dec 2017 02:48:49 +0300 Subject: [PATCH] - proper facility switch --- core/src/MyStrategy.java | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/core/src/MyStrategy.java b/core/src/MyStrategy.java index fe20650..56fff56 100755 --- a/core/src/MyStrategy.java +++ b/core/src/MyStrategy.java @@ -1011,7 +1011,17 @@ private void switchGoToFacility(VehicleGroupInfo myGroup) { Point2D otherAp = other.getAveragePoint(); FacilityWrapper otherF = other.goToFacility; - boolean f1 = otherAp.getDistanceTo(otherF) > otherAp.getDistanceTo(myF); + + double distanceTo = otherAp.getDistanceTo(otherF); + if (distanceTo == 0) { + distanceTo = 1; + } + if (myAp.getDistanceTo(otherF) / distanceTo < 0.78 && distanceTo > 64) { + myGroup.goToFacility = other.goToFacility; + other.goToFacility = null; //TODO mb do not reset + } + + /* boolean f1 = otherAp.getDistanceTo(otherF) > otherAp.getDistanceTo(myF); boolean f2 = myAp.getDistanceTo(myF) > myAp.getDistanceTo(otherAp); double currentDistance = myAp.getDistanceTo(myF) + otherAp.getDistanceTo(otherF); @@ -1023,7 +1033,7 @@ private void switchGoToFacility(VehicleGroupInfo myGroup) { other.goToFacility = myF; other.switchCount++; myGroup.switchCount++; - } + }*/ } } } @@ -1964,7 +1974,7 @@ private List getGroups(Ownership ownership) { } for (Map.Entry e : bestSetup.map.entrySet()) { - e.getKey().goToFacility = e.getValue(); + e.getKey().goToFacility = e.getValue(); } }