Skip to content

Commit

Permalink
Clamp the avg energy heuristic
Browse files Browse the repository at this point in the history
  • Loading branch information
RedTachyon committed May 26, 2023
1 parent 82a700a commit 82219b9
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
4 changes: 3 additions & 1 deletion Assets/Scenes/NormalScene.unity
Original file line number Diff line number Diff line change
Expand Up @@ -600,7 +600,7 @@ MonoBehaviour:
spawnScale: 7
gridSpawn: 1
groupSpawnScale: 1.5
enableObstacles: 1
enableObstacles: 0
blockScale: 3
randomMass: 1
randomEnergy: 0
Expand All @@ -621,6 +621,7 @@ MonoBehaviour:
rewardVelocityMatching: 1
rewardGoal: 1
rewardFinal: 1
rewardAvgFinal: 1
sightRadius: 10
sightAgents: 12
sightAngle: 180
Expand Down Expand Up @@ -6263,6 +6264,7 @@ MonoBehaviour:
PreferredSpeed: 1.33
mass: 1
squasherType: 3
startPosition: {x: 0, y: 0, z: 0}
CollectedGoal: 0
rewardDisabled: 0
distanceTraversed: 0
Expand Down
3 changes: 3 additions & 0 deletions Assets/Scripts/MLUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using System.Collections.Generic;
using System.Diagnostics.Contracts;
using System.Linq;
using System.Reflection;
using Managers;
using UnityEngine;
using Random = UnityEngine.Random;
Expand Down Expand Up @@ -259,6 +260,8 @@ public static float AverageEnergyHeuristic(Vector3 position, Vector3 target, Vec


var avgSpeed = (totalDistance - finalDistance) / timeLimit; // v'

avgSpeed = Mathf.Max(avgSpeed, Params.HeuristicEpsilon);

var remainingTime = finalDistance / avgSpeed; // T'

Expand Down
3 changes: 3 additions & 0 deletions Assets/Scripts/Params.cs
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,9 @@ private void Awake()
public float rewardAvgFinal = 1f;
public static float RewAvgFinal => Get("r_avg_final", Instance.rewardAvgFinal);

public float heuristicEpsilon = 0.1f;
public static float HeuristicEpsilon => Get("heuristic_epsilon", Instance.heuristicEpsilon);




Expand Down

0 comments on commit 82219b9

Please sign in to comment.