Ant is walking again
This commit is contained in:
parent
3f0ed444bb
commit
fdae20b6b4
@ -180,12 +180,7 @@ namespace NanoBrain {
|
|||||||
else {
|
else {
|
||||||
string newName = EditorGUILayout.TextField(this.currentNucleus.name, boldTextFieldStyle);
|
string newName = EditorGUILayout.TextField(this.currentNucleus.name, boldTextFieldStyle);
|
||||||
if (newName != this.currentNucleus.name) {
|
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.currentNucleus.name = newName;
|
||||||
this.prefab.cluster.RefreshOutputs();
|
|
||||||
// outputsPopup.choices = this.prefab.outputs.Select(output => output.name).ToList();
|
|
||||||
anythingChanged = true;
|
anythingChanged = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -188,6 +188,11 @@ namespace NanoBrain {
|
|||||||
foreach (Cluster sibling in siblings)
|
foreach (Cluster sibling in siblings)
|
||||||
sibling.siblingClusters = siblingClusters;
|
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++) {
|
for (int nucleusIx = 0; nucleusIx < clonedNuclei.Length; nucleusIx++) {
|
||||||
@ -613,30 +618,25 @@ namespace NanoBrain {
|
|||||||
if (neuron.synapses.Count == 0)
|
if (neuron.synapses.Count == 0)
|
||||||
this._inputs.Add(nucleus);
|
this._inputs.Add(nucleus);
|
||||||
}
|
}
|
||||||
ComputeOrders();
|
RefreshComputeOrders();
|
||||||
}
|
}
|
||||||
return this._inputs;
|
return this._inputs;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public Dictionary<Nucleus, List<Nucleus>> computeOrders = new();
|
private Dictionary<Nucleus, List<Nucleus>> _computeOrders;
|
||||||
private void ComputeOrders() {
|
public Dictionary<Nucleus, List<Nucleus>> computeOrders {
|
||||||
foreach (Nucleus nucleus in this.nuclei) {
|
get {
|
||||||
// if (nucleus is Cluster cluster) {
|
if (_computeOrders == null || _computeOrders.Count == 0) {
|
||||||
// List<Synapse> synapses = this.CollectSynapsesTo(cluster);
|
_computeOrders = new();
|
||||||
// foreach (Synapse synapse in synapses) {
|
foreach (Nucleus nucleus in this.nuclei)
|
||||||
// computeOrders[synapse.neuron] = TopologicalSort2(synapse.neuron);
|
_computeOrders[nucleus] = TopologicalSort2(nucleus);
|
||||||
// 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}");
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
return _computeOrders;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public void RefreshComputeOrders() {
|
||||||
|
this._computeOrders = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<Nucleus> TopologicalSort2(Nucleus startNode) {
|
private List<Nucleus> TopologicalSort2(Nucleus startNode) {
|
||||||
@ -711,7 +711,7 @@ namespace NanoBrain {
|
|||||||
protected List<Neuron> _outputs = null;
|
protected List<Neuron> _outputs = null;
|
||||||
public List<Neuron> outputs {
|
public List<Neuron> outputs {
|
||||||
get {
|
get {
|
||||||
if (this._outputs == null) {
|
if (this._outputs == null || this._outputs.Count == 0) {
|
||||||
this._outputs = new();
|
this._outputs = new();
|
||||||
foreach (Nucleus nucleus in this.nuclei) {
|
foreach (Nucleus nucleus in this.nuclei) {
|
||||||
if (nucleus is Neuron neuron && neuron.receivers.Count == 0)
|
if (nucleus is Neuron neuron && neuron.receivers.Count == 0)
|
||||||
@ -911,6 +911,7 @@ namespace NanoBrain {
|
|||||||
|
|
||||||
public void Refresh() {
|
public void Refresh() {
|
||||||
RefreshOutputs();
|
RefreshOutputs();
|
||||||
|
RefreshComputeOrders();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -50,7 +50,6 @@ namespace NanoBrain {
|
|||||||
/// It does not have a synapse and therefore no weight of source nucleus
|
/// It does not have a synapse and therefore no weight of source nucleus
|
||||||
public Vector3 bias = Vector3.zero;
|
public Vector3 bias = Vector3.zero;
|
||||||
|
|
||||||
|
|
||||||
#region Synapses
|
#region Synapses
|
||||||
|
|
||||||
[SerializeField]
|
[SerializeField]
|
||||||
@ -329,7 +328,6 @@ namespace NanoBrain {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected virtual void CloneFields(Neuron clone) {
|
protected virtual void CloneFields(Neuron clone) {
|
||||||
clone.parent = this.parent;
|
|
||||||
clone.bias = this.bias;
|
clone.bias = this.bias;
|
||||||
clone.combinator = this.combinator;
|
clone.combinator = this.combinator;
|
||||||
clone.curve = this.curve;
|
clone.curve = this.curve;
|
||||||
|
|||||||
@ -23,6 +23,7 @@ MonoBehaviour:
|
|||||||
- rid: 4201949831649034327
|
- rid: 4201949831649034327
|
||||||
- rid: 4201949831649034328
|
- rid: 4201949831649034328
|
||||||
- rid: 4201949831649034329
|
- rid: 4201949831649034329
|
||||||
|
- rid: 4201949831649034476
|
||||||
references:
|
references:
|
||||||
version: 2
|
version: 2
|
||||||
RefIds:
|
RefIds:
|
||||||
@ -201,3 +202,54 @@ MonoBehaviour:
|
|||||||
trace: 0
|
trace: 0
|
||||||
_receivers:
|
_receivers:
|
||||||
- rid: 4201949831649034327
|
- 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