Skip to content

Commit

Permalink
Fix a bug relating to IDM
Browse files Browse the repository at this point in the history
  • Loading branch information
minhduc0711 committed Aug 11, 2021
1 parent 5ef081e commit 09351f2
Showing 1 changed file with 4 additions and 2 deletions.
Expand Up @@ -1367,11 +1367,12 @@ public void primDriveRandom(final IScope scope) throws GamaRuntimeException {
return;
}
double newAccel = laneAndAccPair.getValue();
double speed = computeSpeed(scope, newAccel, newRoad);
double newSpeed = computeSpeed(scope, newAccel, newRoad);
// Check if it is possible to move onto the new road
if (speed == 0.0) {
if (newSpeed == 0.0) {
// TODO: this should only happen once
// double probaBlock = rescaleProba(getProbaBlockNode(vehicle), timeStep);
setSpeed(vehicle, newSpeed);
double probaBlock = getProbaBlockNode(vehicle);
boolean goingToBlock = Random.opFlip(scope, probaBlock);
IAgent currentRoad = getCurrentRoad(vehicle);
Expand Down Expand Up @@ -1525,6 +1526,7 @@ public void primDrive(final IScope scope) throws GamaRuntimeException {
if (newSpeed == 0.0) {
// TODO: this should happen once
// double probaBlock = rescaleProba(getProbaBlockNode(vehicle), timeStep);
setSpeed(vehicle, newSpeed);
double probaBlock = getProbaBlockNode(vehicle);
boolean goingToBlock = Random.opFlip(scope, probaBlock);
IAgent currentRoad = getCurrentRoad(vehicle);
Expand Down

0 comments on commit 09351f2

Please sign in to comment.