Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Blackouts - division by zero error when using timeLimit = 0 #42

Closed
alhasacademy96 opened this issue Sep 12, 2024 · 0 comments · Fixed by #41
Closed

Blackouts - division by zero error when using timeLimit = 0 #42

alhasacademy96 opened this issue Sep 12, 2024 · 0 comments · Fixed by #41
Labels
bug fix A fix to a known bug

Comments

@alhasacademy96
Copy link
Contributor

Describe the Bug

From AAI 3.1.3 upwards it seems the ability to use blackouts with timeLimit = 0 is broken.

Specific Error produced:
Division by zero: In the LightStatus method, the step is compared against _nextFrameSwitch * agentDecisionInterval. If agentDecisionInterval is 0 (which is possible if timeLimit is 0), it will result in a division by zero error. Furthermore, the error occurs because If timeLimit is set to 0 and blackouts are specified (can be any value), it creates a contradiction. The blackouts are meant to occur at specific steps within the episode, but an episode with a timeLimit of 0 has no steps to begin with.

To Reproduce
Steps to reproduce the behavior:

!ArenaConfig
arenas:
  0: !Arena
    passMark: 2
    timeLimit: 0
    blackouts: [25, 60]
    items:
    - !Item
      name: Agent
      positions:
      - !Vector3 {x: 20, y: 1, z: 2}
      rotations: [0]
      frozenAgentDelays: [10]
    - !Item
      name: Wall
      positions:
      - !Vector3 {x: 20, y: 0, z: 10}
      - !Vector3 {x: 20, y: .5, z: 2.5}
      - !Vector3 {x: 30, y: 0, z: 30}
      - !Vector3 {x: 5, y: 0, z: 38}
      - !Vector3 {x: 35, y: 0, z: 38}
      - !Vector3 {x: 20, y: 0, z: 38}
      - !Vector3 {x: 20, y: 0, z: 39.9}
      rotations: [0,0,0,0,0,45,0]
      colors:
      - !RGB {r: 0, g: 0, b: 255}
      - !RGB {r: 0, g: 0, b: 255}
      - !RGB {r: -1, g: -1, b: -1} #color parameter
      - !RGB {r: 0, g: 0, b: 255}
      - !RGB {r: 0, g: 0, b: 255} 
      - !RGB {r: 222, g: 0, b: 0}
      - !RGB {r: 222, g: 0, b: 0}
      sizes:
      - !Vector3 {x: 2, y: .5, z: 19.5}
      - !Vector3 {x: 2, y: .5, z: 5}
      - !Vector3 {x: 10, y: 0.5, z: 1}
      - !Vector3 {x: 1, y: .5, z: 2}
      - !Vector3 {x: 1, y: .5, z: 2}
      - !Vector3 {x: 2, y: 2, z: 2}
      - !Vector3 {x: 10, y: 2, z: 0.1}

Expected Behavior
AAI handles the scenario where timeLimit is 0 and blackouts are used correctly. It allows for infinite blackout patterns using negative values in the blackout sequence, and the episodeLength (timeLimit) does not impact the blackout functionality.

Desktop (please complete the following information):

  • OS: [Windows, Linux, macOS]
  • Unity Version [e.g. 2021.3.21f1]

Additional Context
Add any other context about the problem here.

Screenshots
If applicable, add screenshots to help explain your problem.

@alhasacademy96 alhasacademy96 added the bug fix A fix to a known bug label Sep 12, 2024
@alhasacademy96 alhasacademy96 linked a pull request Sep 12, 2024 that will close this issue
10 tasks
alhasacademy96 added a commit that referenced this issue Sep 17, 2024
- removed unnecessary exception handling.
- removed explicit call to console.write to avoid unnecessary console logs
The method is now more streamlined and clearer.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug fix A fix to a known bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant