public void GenerateStartProperties(KnowledgeBase kb) { var oldstarts = StartProperties; if (oldstarts == null) { oldstarts = new Dictionary <KnowledgeBase.Record, object>(); } StartProperties = new Dictionary <KnowledgeBase.Record, object>(); foreach (var rec in kb.Records) { if (rec.Computed) { continue; } if (oldstarts.ContainsKey(rec)) { StartProperties.Add(rec, oldstarts[rec]); } else { if (rec.Params == KnowledgeBase.Record.Parameterization.Enumeration) { StartProperties.Add(rec, rec.EnumerationValues.First()); } else { StartProperties.Add(rec, rec.MinimumValue); } } } }
public void ResetAgents(KnowledgeBase kb) { SimulationTime = 0.0; foreach (var agent in Agents) { agent.MoveToStartPosition(RandomNumbers); agent.GenerateStartProperties(kb); agent.Properties = new Dictionary <KnowledgeBase.Record, object>(); foreach (var kvp in agent.StartProperties) { agent.Properties.Add(kvp.Key, kvp.Value); } } foreach (var location in Locations) { location.GenerateStartProperties(kb); location.Properties = new Dictionary <KnowledgeBase.Record, object>(); foreach (var kvp in location.StartProperties) { location.Properties.Add(kvp.Key, kvp.Value); } } }
public void GenerateStartProperties(KnowledgeBase kb) { var oldstarts = StartProperties; if (oldstarts == null) { oldstarts = new Dictionary <string, double>(); } StartProperties = new Dictionary <string, double>(); foreach (var rec in kb.Records) { if (rec.Computed) { continue; } if (oldstarts.ContainsKey(rec.ReadableName)) { StartProperties.Add(rec.ReadableName, oldstarts[rec.ReadableName]); } else { StartProperties.Add(rec.ReadableName, rec.MinimumValue); } } }
public Project() { ReadableName = "New Project"; KB = new KnowledgeBase(); Archetypes = new List <Archetype>(); Inputs = new List <InputAxis>(); Behaviors = new List <Behavior>(); BehaviorSets = new List <BehaviorSet>(); Scenarios = new List <Scenario>(); InputLookupByName = new Dictionary <string, InputAxis>(); }
internal void Attach(KnowledgeBase kb, Project project) { MyKB = kb; EditProject = project; RefreshKBControls(); }