Things seem to work again

This commit is contained in:
Pascal Serrarens 2026-08-14 16:16:24 +02:00
parent 8b456e2b7c
commit a55e899c68
3 changed files with 9 additions and 19 deletions

View File

@ -106,13 +106,13 @@ namespace NanoBrain {
} }
if (ix >= 0) { if (ix >= 0) {
Debug.Log($"update {neuronName} {timestamp}"); // Debug.Log($"update {neuronName} {timestamp}");
actions[ix].action = action; actions[ix].action = action;
actions[ix].timestamp = timestamp; actions[ix].timestamp = timestamp;
return; return;
} }
Debug.Log($"new {neuronName} {timestamp}"); // Debug.Log($"new {neuronName} {timestamp}");
// No existing item; compute insertion point (sorted by timestamp ascending) // No existing item; compute insertion point (sorted by timestamp ascending)
for (int i = 0; i < actions.Count; i++) { for (int i = 0; i < actions.Count; i++) {
if (actions[i].timestamp > timestamp) { if (actions[i].timestamp > timestamp) {
@ -126,9 +126,9 @@ namespace NanoBrain {
} }
public static void Check(List<TimedAction> actions) { public static void Check(List<TimedAction> actions) {
long now = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds(); long now = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds();
if (actions.Count > 0) { // if (actions.Count > 0) {
Debug.Log($"{actions.Count} actions, {actions[0].neuronName} {actions[0].timestamp} {now} {actions[0].timestamp - now}"); // Debug.Log($"{actions.Count} actions, {actions[0].neuronName} {actions[0].timestamp} {now} {actions[0].timestamp - now}");
} // }
while (actions.Count > 0 && actions[0].timestamp <= now) { while (actions.Count > 0 && actions[0].timestamp <= now) {
Action action = actions[0].action; Action action = actions[0].action;
actions.RemoveAt(0); actions.RemoveAt(0);

View File

@ -185,16 +185,6 @@ namespace NanoBrain {
/// </summary> /// </summary>
public virtual float3 outputValue { public virtual float3 outputValue {
get { get {
// long now = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds();
// List<Cluster.TimedAction> actions = this.parent.actions;
// if (actions.Count > 0) {
// Debug.Log($"{actions.Count} actions, {actions[0].neuronName} {actions[0].timestamp} {now} {actions[0].timestamp - now}");
// }
// while (actions.Count > 0 && actions[0].timestamp <= now) {
// Action action = actions[0].action;
// actions.RemoveAt(0);
// action();
// }
this.parent.CheckActions(); this.parent.CheckActions();
return _outputValue; return _outputValue;
} }
@ -821,7 +811,7 @@ namespace NanoBrain {
} }
private void ResetStimulus() { private void ResetStimulus() {
Debug.Log($"reset stimulus {this.parent.name + "." +this.name}"); // Debug.Log($"reset stimulus {this.parent.name + "." +this.name}");
this.parent.name = this.parent.baseName; this.parent.name = this.parent.baseName;
this.bias = Vector3.zero; this.bias = Vector3.zero;
this.parent.thingId = 0; this.parent.thingId = 0;

View File

@ -47,7 +47,7 @@ namespace NanoBrain {
Debug.Log($"Selected {i}: {member.performance}"); Debug.Log($"Selected {i}: {member.performance}");
member.initialized = true; member.initialized = true;
selectedMembers.Add(member); selectedMembers.Add(member);
LogTrainableWeights(member.brain); // LogTrainableWeights(member.brain);
} }
} }
@ -87,9 +87,9 @@ namespace NanoBrain {
member.brain.CopyWeightsFrom(ants[parent1].brain); member.brain.CopyWeightsFrom(ants[parent1].brain);
member.brain.ProcessWeightsFrom(ants[parent2].brain, Average); member.brain.ProcessWeightsFrom(ants[parent2].brain, Average);
LogTrainableWeights(member.brain); // LogTrainableWeights(member.brain);
member.brain.GaussianAdditiveMutation(1e-1f); member.brain.GaussianAdditiveMutation(1e-1f);
LogTrainableWeights(member.brain); // LogTrainableWeights(member.brain);
} }
private static float Average(float a, float b) { private static float Average(float a, float b) {