Ant is walking again
This commit is contained in:
parent
3f0ed444bb
commit
fdae20b6b4
@ -180,12 +180,7 @@ namespace NanoBrain {
|
||||
else {
|
||||
string newName = EditorGUILayout.TextField(this.currentNucleus.name, boldTextFieldStyle);
|
||||
if (newName != this.currentNucleus.name) {
|
||||
Nucleus prefabNucleus = this.prefab.GetNucleus(this.currentNucleus.name);
|
||||
prefabNucleus.name = newName;
|
||||
// This changes it in the temporary cluster instance
|
||||
this.currentNucleus.name = newName;
|
||||
this.prefab.cluster.RefreshOutputs();
|
||||
// outputsPopup.choices = this.prefab.outputs.Select(output => output.name).ToList();
|
||||
anythingChanged = true;
|
||||
}
|
||||
}
|
||||
|
||||
@ -188,6 +188,11 @@ namespace NanoBrain {
|
||||
foreach (Cluster sibling in siblings)
|
||||
sibling.siblingClusters = siblingClusters;
|
||||
}
|
||||
|
||||
// Ensure that all neurons are computed to initialize bias
|
||||
foreach (Nucleus clonedNucleus in clonedNuclei) {
|
||||
clonedNucleus.UpdateStateIsolated();
|
||||
}
|
||||
}
|
||||
/*
|
||||
for (int nucleusIx = 0; nucleusIx < clonedNuclei.Length; nucleusIx++) {
|
||||
@ -613,30 +618,25 @@ namespace NanoBrain {
|
||||
if (neuron.synapses.Count == 0)
|
||||
this._inputs.Add(nucleus);
|
||||
}
|
||||
ComputeOrders();
|
||||
RefreshComputeOrders();
|
||||
}
|
||||
return this._inputs;
|
||||
}
|
||||
}
|
||||
|
||||
public Dictionary<Nucleus, List<Nucleus>> computeOrders = new();
|
||||
private void ComputeOrders() {
|
||||
foreach (Nucleus nucleus in this.nuclei) {
|
||||
// if (nucleus is Cluster cluster) {
|
||||
// List<Synapse> synapses = this.CollectSynapsesTo(cluster);
|
||||
// foreach (Synapse synapse in synapses) {
|
||||
// computeOrders[synapse.neuron] = TopologicalSort2(synapse.neuron);
|
||||
// Debug.Log($"{this.baseName}: Order for {cluster.baseName}.{synapse.neuron.name}");
|
||||
// }
|
||||
// // List<Nucleus> receivers = cluster.CollectReceivers();
|
||||
// // foreach (Nucleus receiver in receivers)
|
||||
// // computeOrders[receiver] = TopologicalSort2(receiver);
|
||||
// }
|
||||
// else {
|
||||
computeOrders[nucleus] = TopologicalSort2(nucleus);
|
||||
//Debug.Log($"{this.baseName} Order for {nucleus.name}");
|
||||
// }
|
||||
private Dictionary<Nucleus, List<Nucleus>> _computeOrders;
|
||||
public Dictionary<Nucleus, List<Nucleus>> computeOrders {
|
||||
get {
|
||||
if (_computeOrders == null || _computeOrders.Count == 0) {
|
||||
_computeOrders = new();
|
||||
foreach (Nucleus nucleus in this.nuclei)
|
||||
_computeOrders[nucleus] = TopologicalSort2(nucleus);
|
||||
}
|
||||
return _computeOrders;
|
||||
}
|
||||
}
|
||||
public void RefreshComputeOrders() {
|
||||
this._computeOrders = null;
|
||||
}
|
||||
|
||||
private List<Nucleus> TopologicalSort2(Nucleus startNode) {
|
||||
@ -711,7 +711,7 @@ namespace NanoBrain {
|
||||
protected List<Neuron> _outputs = null;
|
||||
public List<Neuron> outputs {
|
||||
get {
|
||||
if (this._outputs == null) {
|
||||
if (this._outputs == null || this._outputs.Count == 0) {
|
||||
this._outputs = new();
|
||||
foreach (Nucleus nucleus in this.nuclei) {
|
||||
if (nucleus is Neuron neuron && neuron.receivers.Count == 0)
|
||||
@ -911,6 +911,7 @@ namespace NanoBrain {
|
||||
|
||||
public void Refresh() {
|
||||
RefreshOutputs();
|
||||
RefreshComputeOrders();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -50,7 +50,6 @@ namespace NanoBrain {
|
||||
/// It does not have a synapse and therefore no weight of source nucleus
|
||||
public Vector3 bias = Vector3.zero;
|
||||
|
||||
|
||||
#region Synapses
|
||||
|
||||
[SerializeField]
|
||||
@ -329,7 +328,6 @@ namespace NanoBrain {
|
||||
}
|
||||
|
||||
protected virtual void CloneFields(Neuron clone) {
|
||||
clone.parent = this.parent;
|
||||
clone.bias = this.bias;
|
||||
clone.combinator = this.combinator;
|
||||
clone.curve = this.curve;
|
||||
|
||||
@ -23,6 +23,7 @@ MonoBehaviour:
|
||||
- rid: 4201949831649034327
|
||||
- rid: 4201949831649034328
|
||||
- rid: 4201949831649034329
|
||||
- rid: 4201949831649034476
|
||||
references:
|
||||
version: 2
|
||||
RefIds:
|
||||
@ -201,3 +202,54 @@ MonoBehaviour:
|
||||
trace: 0
|
||||
_receivers:
|
||||
- rid: 4201949831649034327
|
||||
- rid: 4201949831649034476
|
||||
type: {class: Neuron, ns: NanoBrain, asm: Assembly-CSharp}
|
||||
data:
|
||||
name: Beat
|
||||
parent:
|
||||
rid: 4201949831649034477
|
||||
bias: {x: 0, y: 0, z: 0}
|
||||
_synapses: []
|
||||
combinator: 0
|
||||
_curvePreset: 0
|
||||
curve:
|
||||
serializedVersion: 2
|
||||
m_Curve:
|
||||
- serializedVersion: 3
|
||||
time: 0
|
||||
value: 0
|
||||
inSlope: 0
|
||||
outSlope: 1
|
||||
tangentMode: 0
|
||||
weightedMode: 0
|
||||
inWeight: 0
|
||||
outWeight: 0
|
||||
- serializedVersion: 3
|
||||
time: 1000
|
||||
value: 1000
|
||||
inSlope: 1
|
||||
outSlope: 0
|
||||
tangentMode: 0
|
||||
weightedMode: 0
|
||||
inWeight: 0
|
||||
outWeight: 0
|
||||
m_PreInfinity: 2
|
||||
m_PostInfinity: 2
|
||||
m_RotationOrder: 4
|
||||
curveMax: 1
|
||||
trace: 0
|
||||
_receivers: []
|
||||
- rid: 4201949831649034477
|
||||
type: {class: Cluster, ns: NanoBrain, asm: Assembly-CSharp}
|
||||
data:
|
||||
name: New Cluster Prefab
|
||||
parent:
|
||||
rid: -2
|
||||
prefab: {fileID: 11400000}
|
||||
instanceCount: 1
|
||||
nuclei:
|
||||
- rid: 4201949831649034325
|
||||
- rid: 4201949831649034327
|
||||
- rid: 4201949831649034328
|
||||
- rid: 4201949831649034329
|
||||
- rid: 4201949831649034476
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user