public static string ToTypeName(AgentType type) { string typeName = null; switch (type) { case AgentType.SERVICE_BROKER: typeName = ProcessAgentType.SERVICE_BROKER; break; case AgentType.BATCH_SERVICE_BROKER: typeName = ProcessAgentType.BATCH_SERVICE_BROKER; break; case AgentType.REMOTE_SERVICE_BROKER: typeName = ProcessAgentType.REMOTE_SERVICE_BROKER; break; case AgentType.LAB_SERVER: typeName = ProcessAgentType.LAB_SERVER; break; case AgentType.BATCH_LAB_SERVER: typeName = ProcessAgentType.BATCH_LAB_SERVER; break; case AgentType.EXPERIMENT_STORAGE_SERVER: typeName = ProcessAgentType.EXPERIMENT_STORAGE_SERVER; break; case AgentType.SCHEDULING_SERVER: typeName = ProcessAgentType.SCHEDULING_SERVER; break; case AgentType.LAB_SCHEDULING_SERVER: typeName = ProcessAgentType.LAB_SCHEDULING_SERVER; break; default: break; } return typeName; }
public void SetNpcTbl(Npc_Tbl tbl, AgentType agType) { if (null == tbl) { Log.LogError("BlackBoard.SetNpcTbl : Npc_Tbl is null."); return; } if (agType <= AgentType.None || agType >= AgentType.Max) { Log.LogError("BlackBoard.SetNpcTbl : AgentType is invaild."); return; } npcTbl = tbl; agentType = agType; speed = tbl.speed; health = tbl.hp; skillDic.Clear(); if (agentType == AgentType.Monster || agentType == AgentType.Player) { for (int i = 0; i < npcTbl.skills.Length; i++) { int skillID = npcTbl.skills[i]; if (skillID != 0) { skillDic.Add(i, skillID); SkillManager.Instance.AddSkill(guid, skillID); } } } }
public override void SetProperty(DesignerPropertyInfo property, object obj) { base.SetProperty(property, obj); _resetMethods = false; DesignerMethodEnum enumAtt = property.Attribute as DesignerMethodEnum; if (enumAtt != null && property.Property.PropertyType == null) { throw new Exception(string.Format(Resources.ExceptionDesignerAttributeExpectedEnum, property.Property.Name)); } Nodes.Behavior behavior = GetBehavior(); _agentType = (behavior != null) ? behavior.AgentType : null; SetTypes(); object action = property.Property.GetValue(obj, null); MethodDef method = action as MethodDef; int typeIndex = -1; if (method != null) { typeIndex = getTypeIndex(method.Owner); } if (typeIndex < 0) { typeIndex = 0; } // Keep only one type for efficiency. _currentNames.Clear(); _currentNames.Add(_names[typeIndex]); this.typeComboBox.Items.Clear(); this.typeComboBox.Items.Add(_types[typeIndex]); this.typeComboBox.SelectedIndex = 0; }
public AgentCutaway(AgentType agTy, Int32 ID, Coordinates pos_, AgentState state_) { type = agTy; agentID = ID; pos = pos_; state = state_; }
public int SortDegreeFromAgentType(AgentType agentType) { LSAgent agent = GetAgent (); if (agent == null) return -1; if (agentType == agent.MyAgentType) return 1; return 0; }
public AbstractImprov(string name, string description, int scoreMultiplier, AgentType affectedType) { this.name = name; this.description = description; this.ScoreMultiplier = scoreMultiplier; this.AffectedType = affectedType; inUse = false; }
public Agent(AgentType agtType, string login, string lastname, string firstname, string extension, string description, CSQ[] csq) { _agenttype = agtType; _loginid = login; _lastname = lastname; _firstname = firstname; _extension = extension; _description = description; _csqs = csq; }
public Agent(AgentType type) { Name = CreateName(type); Type = type; Energy = MaxEnergy / 2; Age = 0; Generation = 1; Location = new Location(-1, -1); Direction = Direction.West; }
public Agent(AgentModule module, AgentType type, int hp) { AgentModule = module; AgentModule.Agent = this; ActiveEmotions = new List<Emotion>(); ActiveEmotionPairs = new Dictionary<ActiveEmotionPair, float>(); AgentType = type; HP = hp; EmotionState = EmotionState.resilent; }
public AgentInfo(Color colour_, float radius_, AgentType agType_, Int32 ID_, AgentState state_, float communicateRad_, Coordinates coord_, float speed_, float viewRadius_) { agentID = ID_; agentColor = colour_; agentRadius = radius_; agentType = agType_; agentState = state_; communicteRadius = communicateRad_; coord = coord_; speed = speed_; viewRadius = viewRadius_; }
/// <summary> /// This is the method that actually does the work. /// </summary> /// <param name="DA">The DA object is used to retrieve from inputs and store in outputs.</param> protected override void SolveInstance(IGH_DataAccess DA) { // First, we need to retrieve all data from the input parameters. // We'll start by declaring variables and assigning them starting values. AgentType agent = new AgentType(); // Then we need to access the input parameters individually. // When data cannot be extracted from a parameter, we should abort this method. if (!DA.GetData(0, ref agent)) return; // We should now validate the data and warn the user if invalid data is supplied. // We're set to create the output now. To keep the size of the SolveInstance() method small, // The actual functionality will be in a different method: // Finally assign the spiral to the output parameter. DA.SetData(0, agent.Position); DA.SetData(1, agent.Velocity); DA.SetData(2, agent.Acceleration); DA.SetData(3, agent.Lifespan); }
public static Agent EducateAgent(AgentType agentType) { var agent = new Agent(agentType); var tmpInputs = agent.Inputs; ArtificialBrain choosenBrain; while (true) { var brain = CreateBrain(); SetBrain(agent, brain); var scores = FitnessFunction(agent, StandardTests[agentType]); if (scores >= 1700) { choosenBrain = brain; break; } } SetBrain(agent, choosenBrain); agent.Inputs = tmpInputs; return agent; }
public void ShowPreview(string url) { Show(); RequestUrl = url; PreviewUrl = url; linkLabel1.Text = RequestUrl; var extension = Path.GetExtension(url); if (extension != null && new[] {".jpg", ".png", ".gif", ".bmp"}.Contains(extension.ToLower())) { var imagePath = Application.StartupPath+ @"\preview.html"; var imageHtml = @" <!DOCTYPE html> <html lang='en' xmlns='http://www.w3.org/1999/xhtml'> <head> <meta charset='utf-8' /> <title></title> <style>* { margin: 0;}</style> </head> <body> <img src='{src}' style='border: 0; width: 100%;' alt=''/> </body> </html>".Replace("{src}", url); File.WriteAllText(imagePath, imageHtml); chromeBrowser.Load(imagePath); chromeBrowser.Reload(true); PreviewUrl = imagePath; return; } CurrAgent = AgentType.None; Match m; if ((m = Regex.Match(url, @"//www\.youtube\.com/watch\?v=(.+)")).Success) { PreviewUrl = "http://www.youtube.com/embed/" + m.Groups[1].Value.Replace("&", "?"); } else if ((m = Regex.Match(url, @"//www\.flickr\.com/(.+)")).Success) { PreviewUrl = "https://m.flickr.com/" + m.Groups[1].Value; CurrAgent = AgentType.Chrome; } else if ((m = Regex.Match(url, @"instagram\.com/")).Success) { } else if ((m = Regex.Match(url, @"pinterest\.com/")).Success) { CurrAgent = AgentType.Chrome; } else if ((m = Regex.Match(url, @"dbpedia\.org/resource/(.+)")).Success) { PreviewUrl = "http://en.m.wikipedia.org/wiki/" + m.Groups[1].Value; } else if ((m = Regex.Match(url, @"en\.wikipedia\.org/wiki/(.+)")).Success) { PreviewUrl = "http://en.m.wikipedia.org/wiki/" + m.Groups[1].Value; } if (CurrAgent == AgentType.None) CurrAgent = AgentType.Android; chromeBrowser.Load(PreviewUrl); }
public void Initialize(bool canBeEdit, AgentType agent, StructType structType, PropertyDef prop, bool canBePar) { Debug.Check(agent != null || structType != null); _initialized = false; _isModified = false; _shouldCheckMembersInWorkspace = false; _isNew = (prop == null); _agent = agent; _structType = structType; _originalProperty = prop; setTypes(); if (_isNew) { this.Text = canBeEdit ? Resources.AddProperty : Resources.ViewProperty; if (_structType == null) { if (agent != null) { _property = new PropertyDef(agent, null, agent.Name, "", "", ""); } } else { _property = new PropertyDef(null, null, _structType.Name, "", "", ""); } _property.IsPublic = false; resetProperty(_property, _property.IsPar); } else { this.Text = canBeEdit ? Resources.EditProperty : Resources.ViewProperty; resetProperty(prop, prop.IsPar); } //this.customizedCheckBox.Visible = canBeEdit && !_property.IsInherited && agent != null; this.customizedCheckBox.Visible = false; this.isLocalCheckBox.Checked = _structType == null && _property.IsPar; this.isLocalCheckBox.Visible = canBePar && _structType == null && !_property.IsMember; this.isLocalCheckBox.Enabled = canBeEdit; this.nameTextBox.Enabled = canBeEdit; this.arrayCheckBox.Enabled = canBeEdit || (_structType == null || _structType.IsCustomized) && _property.IsChangeableType; this.typeComboBox.Enabled = canBeEdit || (_structType == null || _structType.IsCustomized) && _property.IsChangeableType; this.isStaticCheckBox.Enabled = canBeEdit; this.isPublicCheckBox.Enabled = canBeEdit; this.isConstCheckBox.Enabled = canBeEdit; this.dispTextBox.Enabled = canBeEdit; this.descTextBox.Enabled = canBeEdit; this.nameTextBox.Focus(); if (this.nameTextBox.TextLength > 0) { this.nameTextBox.SelectionStart = this.nameTextBox.TextLength; } else { this.nameTextBox.Select(); } _initialized = true; }
public virtual void ResetMembers(AgentType agentType, bool resetPar) { if (this.EnterAction != null && this.EnterAction.ShouldBeReset(agentType, resetPar)) { this.EnterAction = null; } if (this.ExitAction != null && this.ExitAction.ShouldBeReset(agentType, resetPar)) { this.ExitAction = null; } foreach (Node child in this.Children) { child.ResetMembers(agentType, resetPar); } }
/// <summary> /// Gets the default implementation of the <see cref="StepConfiguration"/> for the given <paramref name="agentType"/>. /// </summary> /// <param name="agentType">Type of the agent.</param> /// <returns></returns> public static StepConfiguration GetDefaultStepConfigurationForAgentType(AgentType agentType) { return(DefaultAgentStepRegistry.GetDefaultStepConfigurationFor(agentType)); }
/// <summary> /// Gets the default implementation of the <see cref="Receiver"/> for a given <paramref name="agentType"/>. /// </summary> /// <param name="agentType">Type of the agent.</param> /// <returns></returns> public static Receiver GetDefaultReceiverForAgentType(AgentType agentType) { return(DefaultAgentReceiverRegistry.GetDefaultReceiverFor(agentType)); }
public void WriteBitWise(string dbName, Int64 CTID, int value, AgentType agentType) { throw new NotImplementedException("Vertica is only supported as a slave!"); }
public static VariableDef parsePropertyVar(List <Nodes.Node.ErrorCheck> result, DefaultObject node, string str) { Debug.Check(!str.StartsWith("const")); List <string> tokens = SplitTokens(str); if (tokens.Count < 2) { return(null); } string arrayIndexStr = string.Empty; string propertyType = string.Empty; string propertyName = string.Empty; if (tokens[0] == "static") { if (tokens.Count == 3) { //e.g. static int Property; propertyType = tokens[1]; propertyName = tokens[2]; } else { Debug.Check(tokens.Count == 4); //e.g. static int Property[int Property1]; propertyType = tokens[1]; propertyName = tokens[2] + "[]"; arrayIndexStr = tokens[3]; } } else { if (tokens.Count == 2) { //e.g. int Property; propertyType = tokens[0]; propertyName = tokens[1]; } else { Debug.Check(tokens.Count == 3); //e.g. int Property; propertyType = tokens[0]; propertyName = tokens[1] + "[]"; arrayIndexStr = tokens[2]; } } AgentType agentType = node.Behavior.AgentType; // Convert the Par to the Property if (!propertyName.Contains(".") && !propertyName.Contains(":")) { propertyName = "Self." + agentType.AgentTypeName + "::" + propertyName; } VariableDef v = null; int pointIndex = propertyName.IndexOf('.'); if (pointIndex > -1) { string ownerName = propertyName.Substring(0, pointIndex); propertyName = propertyName.Substring(pointIndex + 1, propertyName.Length - pointIndex - 1); agentType = Plugin.GetInstanceAgentType(ownerName, agentType); string valueType = ownerName; v = setProperty(result, node, agentType, propertyName, arrayIndexStr, valueType); } else { string className = Plugin.GetClassName(propertyName); // Assume it was global type. if (className != null) { v = setProperty(result, node, Plugin.GetInstanceAgentType(className), propertyName, arrayIndexStr, className); if (v == null) { Nodes.Behavior behavior = node.Behavior as Nodes.Behavior; if (behavior != null) { // Assume it was Agent type. v = setProperty(result, node, behavior.AgentType, propertyName, arrayIndexStr, VariableDef.kSelf); } } } } return(v); }
bool IsOccupied(int x, int y, AgentType actor) { return(LevelFeature.BlocksAgent(levelData[x, y])); }
public void Initialize(object typeObject) { _initialized = false; _isModified = false; _isNew = (typeObject == null); this.Text = _isNew ? Resources.AddType : Resources.EditType; MetaTypes metaType = MetaTypes.Agent; if (typeObject != null) { if (typeObject is AgentType) { metaType = MetaTypes.Agent; _customizedAgent = typeObject as AgentType; } else if (typeObject is EnumType) { metaType = MetaTypes.Enum; _enumType = typeObject as EnumType; } else if (typeObject is StructType) { metaType = MetaTypes.Struct; _structType = typeObject as StructType; } } this.typeComboBox.Enabled = _isNew; this.typeComboBox.Items.Clear(); foreach (string type in Enum.GetNames(typeof(MetaTypes))) { this.typeComboBox.Items.Add(type); } this.typeComboBox.SelectedIndex = (int)metaType; if (this.GetMetaType() == MetaTypes.Agent) { Debug.Check(_customizedAgent != null); if (_customizedAgent != null) { if (_customizedAgent.Base != null) { this.baseComboBox.SelectedText = _customizedAgent.Base.Name; } this.exportCodeCheckBox.Checked = !_customizedAgent.IsImplemented; this.nameTextBox.Text = _customizedAgent.BasicName; this.namespaceTextBox.Text = _customizedAgent.Namespace; this.isRefCheckBox.Checked = true; this.locationTextBox.Text = Workspace.Current.MakeAbsolutePath(_customizedAgent.ExportLocation); this.dispTextBox.Text = _customizedAgent.DisplayName; this.descTextBox.Text = _customizedAgent.Description; this.exportCodeCheckBox.Enabled = (_customizedAgent.Name != "behaviac::Agent"); this.baseComboBox.Enabled = true; this.isRefCheckBox.Enabled = false; } } else { if (this.GetMetaType() == MetaTypes.Enum) { Debug.Check(_enumType != null); if (_enumType != null) { this.exportCodeCheckBox.Checked = !_enumType.IsImplemented; this.nameTextBox.Text = _enumType.Name; this.namespaceTextBox.Text = _enumType.Namespace; this.isRefCheckBox.Checked = false; this.locationTextBox.Text = Workspace.Current.MakeAbsolutePath(_enumType.ExportLocation); this.dispTextBox.Text = _enumType.DisplayName; this.descTextBox.Text = _enumType.Description; this.exportCodeCheckBox.Enabled = true; this.baseComboBox.Enabled = false; this.isRefCheckBox.Enabled = false; } } else if (this.GetMetaType() == MetaTypes.Struct) { Debug.Check(_structType != null); if (_structType != null) { this.exportCodeCheckBox.Checked = !_structType.IsImplemented; this.nameTextBox.Text = _structType.Name; this.namespaceTextBox.Text = _structType.Namespace; this.baseComboBox.SelectedText = _structType.BaseName; this.isRefCheckBox.Checked = _structType.IsRef; this.locationTextBox.Text = Workspace.Current.MakeAbsolutePath(_structType.ExportLocation); this.dispTextBox.Text = _structType.DisplayName; this.descTextBox.Text = _structType.Description; this.exportCodeCheckBox.Enabled = true; this.baseComboBox.Enabled = true; this.isRefCheckBox.Enabled = true; } } } if (_isNew && string.IsNullOrEmpty(this.namespaceTextBox.Text)) { this.namespaceTextBox.Text = Settings.Default.DefaultNamespace; } setControlsByExportCode(); this.nameTextBox.Focus(); if (this.nameTextBox.TextLength > 0) { this.nameTextBox.SelectionStart = this.nameTextBox.TextLength; } else { this.nameTextBox.Select(); } _initialized = true; }
public Agent(AgentType newType) { configureAs(newType, true); }
////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////// #region Agent type definitions // since we don't seem to have defaults in whatever C# I'm getting via Mono... public void configureAs(AgentType newType) { configureAs(newType, false); }
/// <summary> /// Returns a instance of a Hearthstone agent based on the profited card class and agent type. /// The card class of the hero is key for configuring the agent correctly, especially the predator MCTS. /// </summary> /// <param name="cardClass">the card class of the agent's hero</param> /// <param name="deck">the deck of the agent</param> /// <param name="type">the type of agent</param> /// <returns></returns> public AbstractAgent GetAgent(CardClass cardClass, List <Card> deck, AgentType type) { double simulationTime = 15000; IScore scoring = new WeightedScore(); AbstractAgent agent = new ExhaustiveSeachAgent(10, 200, scoring); switch (type) { case AgentType.FlatMCTS: agent = new FlatMCAgent(scoring); break; case AgentType.MCTS: /*agent = new MCTSAgent(scoring, * new MCTSParameters * { * SimulationTime = simulationTime, * AggregationTime = 100, * RolloutDepth = 5, * UCTConstant = 9000 * });*/ break; case AgentType.PredatorMCTS: // the default decks if (cardClass == CardClass.WARRIOR) { Console.WriteLine("Aggro Deck"); agent = new PredatorMCTSAgent(scoring, new MCTSParameters { SimulationTime = simulationTime, AggregationTime = 100, RolloutDepth = 5, UCTConstant = 9000 }, new PredictionParameters { File = Environment.CurrentDirectory + @"\src\Bigramms\bigramm_1-2017-12-2016.json.gz", DecayFactor = 1, CardCount = 10, StepWidth = 2, DeckCount = 1, SetCount = 3, LeafCount = 5, SimulationDepth = 1, OverallLeafCount = 5 }); } else if (cardClass == CardClass.SHAMAN) { agent = new PredatorMCTSAgent(scoring, new MCTSParameters { SimulationTime = simulationTime, AggregationTime = 100, RolloutDepth = 5, UCTConstant = 9000 }, new PredictionParameters { File = Environment.CurrentDirectory + @"\src\Bigramms\bigramm_1-2017-12-2016.json.gz", DecayFactor = 1, CardCount = 10, StepWidth = 2, DeckCount = 1, SetCount = 3, LeafCount = 5, SimulationDepth = 3, OverallLeafCount = 5 }); } else if (cardClass == CardClass.MAGE) { agent = new PredatorMCTSAgent(scoring, new MCTSParameters { SimulationTime = simulationTime, AggregationTime = 100, RolloutDepth = 5, UCTConstant = 9000 }, new PredictionParameters { File = Environment.CurrentDirectory + @"\src\Bigramms\bigramm_1-2017-12-2016.json.gz", DecayFactor = 1, CardCount = 10, StepWidth = 2, DeckCount = 1, SetCount = 3, LeafCount = 5, SimulationDepth = 5, OverallLeafCount = 5 }); } else if (cardClass == CardClass.WARLOCK) { agent = new PredatorMCTSAgent(scoring, new MCTSParameters { SimulationTime = simulationTime, AggregationTime = 100, RolloutDepth = 5, UCTConstant = 9000 }, new PredictionParameters { File = Environment.CurrentDirectory + @"\src\Bigramms\bigramm_3-2018-10-2017.json.gz", DecayFactor = 1, CardCount = 10, StepWidth = 2, DeckCount = 1, SetCount = 3, LeafCount = 5, SimulationDepth = 1, OverallLeafCount = 5 }); } break; } ; return(agent); }
/// <summary> /// Reads the value of the CLASSPATH variable defined in a script and stores it into the configuration. /// This method checks if the provided ProActive location contains \bin\windows\init.bat script. /// </summary> /// <param name="config">The user defined configuration.</param> public static void readClasspath(AgentType configuration) { AgentConfigType config = configuration.config; if (config.proactiveHome == null || config.proactiveHome.Equals("")) { throw new ApplicationException("Unable to read the classpath, the ProActive location is unknown"); } // 1) Use the java location if it's specified in the configuration // 2) If not specified use JAVA_HOME variable // 3) If JAVA_HOME is not defined or empty throw exception if (String.IsNullOrEmpty(config.javaHome)) { // The classpath will be filled using the JAVA_HOME variable defined in the parent environement config.javaHome = System.Environment.GetEnvironmentVariable(Constants.JAVA_HOME); if (String.IsNullOrEmpty(config.javaHome)) { throw new ApplicationException("Unable to read the classpath, please specify the java location in the configuration or set JAVA_HOME environement variable"); } } // If bin\init.bat exists use it to get the classpath // If bin\windows\init.bat exists use it to get the classpath // If none of them exists use standard classpath string binInit = config.proactiveHome + @"\bin\init.bat"; string binWindowsInit = config.proactiveHome + @"\bin\windows\init.bat"; // First check if the proactiveHome or javaHome path are in UNC format if (config.proactiveHome.StartsWith(@"\\") || config.javaHome.StartsWith(@"\\")) { string username = null; string domain = null; string password = null; // Get forker credentials from registry RegistryKey confKey = Registry.LocalMachine.OpenSubKey(Constants.REG_CREDS_SUBKEY); if (confKey == null) { throw new ApplicationException("Unable to read credentials from registry"); } username = (string)confKey.GetValue("username"); domain = (string)confKey.GetValue("domain"); // The password is encrypted, decryption is needed string encryptedPassword = (string)confKey.GetValue("password"); confKey.Close(); // To decrypt the password call the decryptData using pinvoke StringBuilder decryptedPassword = new StringBuilder(32); // suppose passwords are 32 chars max { // Save current dir string cd = Directory.GetCurrentDirectory(); // Current dir must be the location of the agent Directory.SetCurrentDirectory(configuration.agentInstallLocation); // Decrypt the password int res = decryptData(encryptedPassword, decryptedPassword); password = decryptedPassword.ToString(); if (res != 0) { throw new ApplicationException("Problem unable to decrypt the password, exitCode=" + res); } // Restore current dir Directory.SetCurrentDirectory(cd); } bool readClasspathFromScript = false; string initScript = null; string initScriptParentAbsolutePath = null; // Impersonate the forker (get its access rights) in his context UNC paths are accepted using (new Impersonator(username, domain, password)) { if (Directory.Exists(config.javaHome)) { if (File.Exists(binInit)) { initScript = binInit; initScriptParentAbsolutePath = config.proactiveHome + @"\bin"; readClasspathFromScript = true; } else if (File.Exists(binWindowsInit)) { initScript = binWindowsInit; initScriptParentAbsolutePath = config.proactiveHome + @"\bin\windows"; readClasspathFromScript = true; } else { readClasspathFromScript = false; } } else { readClasspathFromScript = false; } } if (readClasspathFromScript) { config.classpath = VariableEchoer.echoVariableAsForker( config.javaHome, // the Java install dir configuration.agentInstallLocation, // the ProActive Agent install dir initScriptParentAbsolutePath, // the current directory where to run the initScript initScript, // the full path of the initScript Constants.CLASSPATH); // the name of the variable to echo } else { config.classpath = config.proactiveHome + @"\dist\lib\*;" + config.proactiveHome + @"\addons\*"; } } else { // The paths are local no need to impersonate ProcessStartInfo info = new ProcessStartInfo(); info.EnvironmentVariables["PA_SCHEDULER"] = config.proactiveHome; info.EnvironmentVariables["PROACTIVE"] = config.proactiveHome; info.EnvironmentVariables[Constants.JAVA_HOME] = config.javaHome; bool javaHomeExists = Directory.Exists(config.javaHome); if (File.Exists(binInit) && javaHomeExists) { config.classpath = VariableEchoer.echoVariable(binInit, Constants.CLASSPATH, info); } else if (File.Exists(binWindowsInit) && javaHomeExists) { config.classpath = VariableEchoer.echoVariable(binWindowsInit, Constants.CLASSPATH, info); } else { config.classpath = config.proactiveHome + @"\dist\lib\*;" + config.proactiveHome + @"\addons\*"; } } }
private static VariableDef createVariable(List <Nodes.Node.ErrorCheck> result, DefaultObject node, AgentType agentType, string instacneName, string propertyName) { List <string> tokens = DesignerPropertyEnum.SplitTokens(propertyName); Debug.Check(tokens.Count > 0); string arrayIndexStr = null; if (tokens.Count > 1) { propertyName = tokens[0] + "[]"; arrayIndexStr = tokens[1]; } Nodes.Behavior behavior = node.Behavior as Nodes.Behavior; agentType = Plugin.GetInstanceAgentType(instacneName, behavior, agentType); if (agentType != null) { IList <PropertyDef> properties = agentType.GetProperties(); foreach (PropertyDef p in properties) { if (p.Name == propertyName #if BEHAVIAC_NAMESPACE_FIX || p.Name.EndsWith(propertyName) #endif ) { VariableDef v = new VariableDef(p, instacneName); if (v != null && !string.IsNullOrEmpty(arrayIndexStr)) { v.ArrayIndexElement = new MethodDef.Param("ArrayIndex", typeof(int), "int", "ArrayIndex", "ArrayIndex"); v.ArrayIndexElement.IsArrayIndex = true; DesignerMethodEnum.parseParam(result, node, null, v.ArrayIndexElement, arrayIndexStr); } return(v); } } } return(null); }
private static VariableDef createVariable(List<Nodes.Node.ErrorCheck> result, DefaultObject node, AgentType agentType, string instacneName, string propertyName) { List<string> tokens = DesignerPropertyEnum.SplitTokens(propertyName); Debug.Check(tokens.Count > 0); string arrayIndexStr = null; if (tokens.Count > 1) { propertyName = tokens[0] + "[]"; arrayIndexStr = tokens[1]; } Nodes.Behavior behavior = node.Behavior as Nodes.Behavior; agentType = Plugin.GetInstanceAgentType(instacneName, behavior, agentType); if (agentType != null) { IList<PropertyDef> properties = agentType.GetProperties(); foreach(PropertyDef p in properties) { if (p.Name == propertyName #if BEHAVIAC_NAMESPACE_FIX || p.Name.EndsWith(propertyName) #endif ) { VariableDef v = new VariableDef(p, instacneName); if (v != null && !string.IsNullOrEmpty(arrayIndexStr)) { v.ArrayIndexElement = new MethodDef.Param("ArrayIndex", typeof(int), "int", "ArrayIndex", "ArrayIndex"); v.ArrayIndexElement.IsArrayIndex = true; DesignerMethodEnum.parseParam(result, node, null, v.ArrayIndexElement, arrayIndexStr); } return v; } } } return null; }
private void resetBaseTypes() { this.baseComboBox.Items.Clear(); this.baseComboBox.Enabled = false; this.isRefCheckBox.Checked = false; this.isRefCheckBox.Enabled = false; if (this.GetMetaType() == MetaTypes.Agent || this.GetMetaType() == MetaTypes.Struct) { this.baseComboBox.Enabled = true; int baseIndex = -1; if (this.GetMetaType() == MetaTypes.Agent) // agent { this.isRefCheckBox.Checked = true; for (int i = 0; i < Plugin.AgentTypes.Count; ++i) { AgentType agentType = Plugin.AgentTypes[i]; this.baseComboBox.Items.Add(agentType.Name); if (this._customizedAgent != null && this._customizedAgent.Base != null && this._customizedAgent.Base.Name == agentType.Name) { baseIndex = i; } } if (baseIndex < 0 && Plugin.AgentTypes.Count > 0) { baseIndex = 0; } } else // struct { if (this._structType != null) { this.isRefCheckBox.Checked = this._structType.IsRef; } this.isRefCheckBox.Enabled = true; this.baseComboBox.Items.Add(""); for (int i = 0; i < TypeManager.Instance.Structs.Count; ++i) { StructType structType = TypeManager.Instance.Structs[i]; if (this._structType == null || string.IsNullOrEmpty(this._structType.Name) || this._structType.Fullname != structType.Fullname && this._structType.Fullname != structType.BaseName) { this.baseComboBox.Items.Add(structType.Fullname); if (this._structType != null && this._structType.BaseName == structType.Fullname) { baseIndex = i + 1; } } } } this.baseComboBox.SelectedIndex = baseIndex; } }
public static MethodDef parseMethodString(List <Nodes.Node.ErrorCheck> result, DefaultObject node, AgentType agentType, MethodType methodType, string str) { try { if (agentType != null) { int pos = str.IndexOf('('); if (pos < 0) { return(null); } string ownerName = agentType.ToString(); int pointIndex = str.IndexOf('.'); if (pointIndex > -1 && pointIndex < pos) { ownerName = str.Substring(0, pointIndex); Nodes.Behavior behavior = node.Behavior as Nodes.Behavior; if (ownerName != VariableDef.kSelf && !Plugin.IsInstanceName(ownerName, behavior)) { throw new Exception("The instance does not exist."); } str = str.Substring(pointIndex + 1, str.Length - pointIndex - 1); agentType = Plugin.GetInstanceAgentType(ownerName, behavior, agentType); //if (agentType == node.Behavior.AgentType) // ownerName = VariableDef.kSelf; pos = str.IndexOf('('); } IList <MethodDef> actions = agentType.GetMethods(methodType); string actionName = str.Substring(0, pos); foreach (MethodDef actionTypeIt in actions) { if (actionTypeIt.Name == actionName #if BEHAVIAC_NAMESPACE_FIX || actionTypeIt.Name.EndsWith(actionName) #endif ) { MethodDef method = new MethodDef(actionTypeIt); method.Owner = ownerName; List <string> paras = parseParams(str.Substring(pos + 1, str.Length - pos - 2)); //Debug.Check((paras.Count == actionTypeIt.Params.Count)); //if (paras.Count == actionTypeIt.Params.Count) { for (int i = 0; i < paras.Count; ++i) { if (i >= method.Params.Count) { break; } string param = paras[i]; MethodDef.Param par = method.Params[i]; bool bOk = parseParam(result, node, method, par, param); if (!bOk) { throw new Exception(string.Format(Resources.ExceptionDesignerAttributeIllegalFloatValue, str)); } } } return(method); } } } } catch (Exception) { //System.Windows.Forms.MessageBox.Show(str, Resources.LoadError, System.Windows.Forms.MessageBoxButtons.OK); if (result != null) { Nodes.Node n = node as Nodes.Node; string label = ""; if (n == null) { Attachments.Attachment a = node as Attachments.Attachment; if (a != null) { n = a.Node; label = a.Label; } } else { label = n.Label; } Nodes.Node.ErrorCheck error = new Nodes.Node.ErrorCheck(n, node.Id, label, Nodes.ErrorCheckLevel.Error, str); result.Add(error); } } return(null); }
public override void SetProperty(DesignerPropertyInfo property, object obj) { base.SetProperty(property, obj); _resetProperties = false; Type enumtype = null; DesignerPropertyEnum enumAtt = property.Attribute as DesignerPropertyEnum; if (enumAtt != null) { enumtype = property.Property.PropertyType; } if (enumtype == null) { throw new Exception(string.Format(Resources.ExceptionDesignerAttributeExpectedEnum, property.Property.Name)); } Nodes.Behavior behavior = GetBehavior(); _agentType = (behavior != null) ? behavior.AgentType : null; object propertyMember = property.Property.GetValue(obj, null); VariableDef variable = propertyMember as VariableDef; RightValueDef variableRV = propertyMember as RightValueDef; if (variable != null && variable.ValueClass != VariableDef.kSelf) { _valueOwner = variable.ValueClass; _agentType = Plugin.GetInstanceAgentType(_valueOwner, behavior, _agentType); } if (variableRV != null && variableRV.ValueClassReal != VariableDef.kSelf) { _valueOwner = variableRV.ValueClassReal; _agentType = Plugin.GetInstanceAgentType(_valueOwner, behavior, _agentType); } string selectionName = string.Empty; if (variable != null && variable.Property != null) { selectionName = variable.Property.DisplayName; } else if (variableRV != null && variableRV.Var != null && variableRV.Var.Property != null) { selectionName = variableRV.Var.Property.DisplayName; } this.FilterType = null; if (enumAtt != null) { if (enumAtt.DependedProperty != "") { Type objType = _object.GetType(); PropertyInfo pi = objType.GetProperty(enumAtt.DependedProperty); object propMember = pi.GetValue(obj, null); VariableDef var = propMember as VariableDef; if (var != null) { this.FilterType = var.GetValueType(); } else { MethodDef method = propMember as MethodDef; if (method != null) { this.FilterType = method.ReturnType; } else { RightValueDef varRV = propMember as RightValueDef; if (varRV != null) { this.FilterType = varRV.ValueType; } } } } else { this.FilterType = enumAtt.FilterType; } } setComboBox(selectionName); //after the left is changed, the right might need to be invalidated if (this.comboBox.Text != selectionName) { property.Property.SetValue(_object, null, null); } }
protected static VariableDef setProperty(List <Nodes.Node.ErrorCheck> result, DefaultObject node, AgentType agentType, string propertyName, string arrayIndexStr, string valueType) { if (agentType != null) { IList <PropertyDef> properties = agentType.GetProperties(); foreach (PropertyDef p in properties) { if (p.Name == propertyName #if BEHAVIAC_NAMESPACE_FIX || p.Name.EndsWith(propertyName) #endif ) { VariableDef v = new VariableDef(p.Clone(), valueType); if (v != null && !string.IsNullOrEmpty(arrayIndexStr)) { v.ArrayIndexElement = new MethodDef.Param("ArrayIndex", typeof(int), "int", "ArrayIndex", "ArrayIndex"); v.ArrayIndexElement.IsArrayIndex = true; DesignerMethodEnum.parseParam(result, node, null, v.ArrayIndexElement, arrayIndexStr); } return(v); } } } return(null); }
public virtual bool ResetMembers(bool check, AgentType agentType, bool clear, MethodDef method = null, PropertyDef property = null) { return false; }
public static MethodDef parseMethodString(NodeTag.DefaultObject node, AgentType agentType, MethodType methodType, string str) { try { if (agentType != null) { int pos = str.IndexOf('('); if (pos < 0) { return(null); } string ownerName = agentType.ToString(); int pointIndex = str.IndexOf('.'); if (pointIndex > -1 && pointIndex < pos) { ownerName = str.Substring(0, pointIndex); str = str.Substring(pointIndex + 1, str.Length - pointIndex - 1); agentType = Plugin.GetInstanceAgentType(ownerName, agentType); if (agentType == node.Behavior.AgentType) { ownerName = VariableDef.kSelf; } pos = str.IndexOf('('); } IList <MethodDef> actions = agentType.GetMethods(methodType); string actionName = str.Substring(0, pos); foreach (MethodDef actionTypeIt in actions) { if (actionTypeIt.Name == actionName #if BEHAVIAC_NAMESPACE_FIX || actionTypeIt.Name.EndsWith(actionName) #endif ) { MethodDef method = new MethodDef(actionTypeIt); method.Owner = ownerName; List <string> paras = parseParams(str.Substring(pos + 1, str.Length - pos - 2)); //Debug.Check((paras.Count == actionTypeIt.Params.Count)); //if (paras.Count == actionTypeIt.Params.Count) { for (int i = 0; i < paras.Count; ++i) { string param = paras[i]; string[] tokens = null; if (param[0] == '\"') { param = param.Substring(1, param.Length - 2); } else if (param[0] == '{') { //struct //to set it as action.Method is used in the following parsing Nodes.Action action = node as Nodes.Action; if (action != null) { action.Method = method; } } else { tokens = param.Split(' '); } if (i < method.Params.Count) { MethodDef.Param par = method.Params[i]; if (tokens != null && tokens.Length > 1) { //par VariableDef var = setParameter(node, tokens[tokens.Length - 1]); if (var != null) { par.Value = var; } //else // throw new Exception(string.Format(Resources.ExceptionDesignerAttributeIllegalFloatValue, str)); } else { bool bOk = Plugin.InvokeTypeParser(par.Type, param, (object value) => par.Value = value, node, par.Name); if (!bOk) { throw new Exception(string.Format(Resources.ExceptionDesignerAttributeIllegalFloatValue, str)); } } } else { break; } } } return(method); } } } } catch (Exception) { System.Windows.Forms.MessageBox.Show(str, Resources.LoadError, System.Windows.Forms.MessageBoxButtons.OK); } return(null); }
protected VariableDef setProperty(AgentType agentType, string propertyName, string valueType) { if (agentType != null) { IList<PropertyDef> properties = agentType.GetProperties(); foreach (PropertyDef p in properties) { if (p.Name == propertyName #if BEHAVIAC_NAMESPACE_FIX || p.Name.EndsWith(propertyName) #endif ) { VariableDef v = new VariableDef(p, valueType); return v; } } } return null; }
/// <summary> /// Gets the default implementation of the <see cref="TransformerConfigEntry"/> for the given <paramref name="agentType"/>. /// </summary> /// <param name="agentType">Type of the agent.</param> /// <returns></returns> public static TransformerConfigEntry GetDefaultTransformerForAgentType(AgentType agentType) { return(DefaultAgentTransformerRegistry.GetDefaultTransformerFor(agentType)); }
public void LoadZonalData(AgentType currType) { if (currType == AgentType.Household || currType == AgentType.HouseholdPersonComposite) { //LoadMobelData(); //updated LoadMarginalsForCars(); //updated LoadMarginalsForDwellings(); //LoadMarginalsForPersons(); LoadMarginalsForAge(); LoadMarginalsForSex (); } /*else if(currType == AgentType.Person) { foreach(var ent in ZonalCollection) { OpenCensusFiles(currType); SpatialZone currZone = (SpatialZone)ent.Value; LoadPesronCensusData(currZone); CloseCensusFiles(currType); } LoadMarginalsForHhldSize2(); LoadMarginalsForAge(); LoadMarginalsForSex(); //added LoadMarginalForOccupation(); }*/ GC.KeepAlive(ZonalCollection); }
public NewAgentForm(AgentType agentType) { InitializeComponent(); }
void CloseCensusFiles(AgentType currType) { if (currType == AgentType.Household) { CensusDwellFileReader.Dispose(); CensusCarFileReader.Dispose(); CensusPersonFileReader.Dispose(); } else if (currType == AgentType.Person) { CensusAgeFileReader.Dispose(); CensusSexFileReader.Dispose(); CensusHhldSizeFileReader.Dispose(); CensusEduLevelFileReader.Dispose(); } }
public void DeleteOldCTVersionsMaster(string p, DateTime chopDate, AgentType agentType) { throw new NotImplementedException(); }
private void OpenCensusFiles(AgentType currType) { if (currType == AgentType.Household) { CensusPersonFileReader = new InputDataReader( Constants.DATA_DIR + "\\Household\\CensusNumOfPers.csv"); CensusDwellFileReader = new InputDataReader( Constants.DATA_DIR + "\\Household\\CensusDwellingType.csv"); CensusCarFileReader = new InputDataReader( Constants.DATA_DIR + "\\Household\\CensusNumOfCars.csv"); CensusPersonFileReader.GetConditionalList(); CensusDwellFileReader.GetConditionalList(); CensusCarFileReader.GetConditionalList(); } else if (currType == AgentType.Person) { CensusAgeFileReader = new InputDataReader( Constants.DATA_DIR + "\\Person\\Person Z-Stats.csv"); CensusSexFileReader = new InputDataReader( Constants.DATA_DIR + "\\Person\\Person Z-Stats.csv"); CensusHhldSizeFileReader = new InputDataReader( Constants.DATA_DIR + "\\Person\\Person Z-Stats.csv"); CensusEduLevelFileReader = new InputDataReader( Constants.DATA_DIR + "\\Person\\Person Z-Stats.csv"); CensusEduLevelFileReader.GetConditionalList(); } }
public int ReadBitWise(string dbName, Int64 CTID, AgentType agentType) { throw new NotImplementedException("Vertica is only supported as a slave!"); }
public TestAgent GetAgent( AgentType type ) { return GetAgent( type, 5000 ); }
public virtual bool ResetMembers(bool check, AgentType agentType, bool clear, MethodDef method = null, PropertyDef property = null) { bool bReset = false; foreach(Attachments.Attachment attach in this.Attachments) { bReset |= attach.ResetMembers(check, agentType, clear, method, property); } foreach(Node child in this.GetChildNodes()) { bReset |= child.ResetMembers(check, agentType, clear, method, property); } return bReset; }
private AgentRecord FindAvailableRemoteAgent(AgentType type) { foreach( AgentRecord r in agentData ) if ( r.Status == AgentStatus.Ready ) { NTrace.DebugFormat( "Reusing agent {0}", r.Id ); r.Status = AgentStatus.Busy; return r; } return null; }
public static MethodDef parseMethodString(List<Nodes.Node.ErrorCheck> result, DefaultObject node, AgentType agentType, MethodType methodType, string str) { try { if (agentType != null) { int pos = str.IndexOf('('); if (pos < 0) { return null; } string ownerName = agentType.ToString(); int pointIndex = str.IndexOf('.'); if (pointIndex > -1 && pointIndex < pos) { ownerName = str.Substring(0, pointIndex); Nodes.Behavior behavior = node.Behavior as Nodes.Behavior; if (ownerName != VariableDef.kSelf && !Plugin.IsInstanceName(ownerName, behavior)) { throw new Exception("The instance does not exist."); } str = str.Substring(pointIndex + 1, str.Length - pointIndex - 1); agentType = Plugin.GetInstanceAgentType(ownerName, behavior, agentType); //if (agentType == node.Behavior.AgentType) // ownerName = VariableDef.kSelf; pos = str.IndexOf('('); } IList<MethodDef> actions = agentType.GetMethods(methodType); string actionName = str.Substring(0, pos); foreach(MethodDef actionTypeIt in actions) { if (actionTypeIt.Name == actionName #if BEHAVIAC_NAMESPACE_FIX || actionTypeIt.Name.EndsWith(actionName) #endif ) { MethodDef method = new MethodDef(actionTypeIt); method.Owner = ownerName; List<string> paras = parseParams(str.Substring(pos + 1, str.Length - pos - 2)); //Debug.Check((paras.Count == actionTypeIt.Params.Count)); //if (paras.Count == actionTypeIt.Params.Count) { for (int i = 0; i < paras.Count; ++i) { if (i >= method.Params.Count) { break; } string param = paras[i]; MethodDef.Param par = method.Params[i]; bool bOk = parseParam(result, node, method, par, param); if (!bOk) { throw new Exception(string.Format(Resources.ExceptionDesignerAttributeIllegalFloatValue, str)); } } } return method; } } } } catch (Exception) { //System.Windows.Forms.MessageBox.Show(str, Resources.LoadError, System.Windows.Forms.MessageBoxButtons.OK); if (result != null) { Nodes.Node n = node as Nodes.Node; string label = ""; if (n == null) { Attachments.Attachment a = node as Attachments.Attachment; if (a != null) { n = a.Node; label = a.Label; } } else { label = n.Label; } Nodes.Node.ErrorCheck error = new Nodes.Node.ErrorCheck(n, node.Id, label, Nodes.ErrorCheckLevel.Error, str); result.Add(error); } } return null; }
private string getValueType(MethodDef.Param param, string propertyName) { if (param.IsLocalVar) { Behaviac.Design.Nodes.Node node = _object as Behaviac.Design.Nodes.Node; if (node == null) { Attachments.Attachment attach = (_object as Attachments.Attachment); if (attach != null) { node = attach.Node; } } Behaviac.Design.Nodes.Behavior behavior = (node != null) ? node.Behavior as Behaviac.Design.Nodes.Behavior : null; // Try to find the Agent property with the name. if (behavior != null && behavior.AgentType != null) { IList <PropertyDef> properties = behavior.AgentType.GetProperties(); foreach (PropertyDef p in properties) { if (p.Name == propertyName #if BEHAVIAC_NAMESPACE_FIX || p.Name.EndsWith(propertyName) #endif ) { return(VariableDef.kSelf); } } } // Try to find the global property with the name. string className = Plugin.GetClassName(propertyName); if (!string.IsNullOrEmpty(className)) { AgentType agent = Plugin.GetInstanceAgentType(className); if (agent != null) { IList <PropertyDef> properties = agent.GetProperties(); foreach (PropertyDef p in properties) { if (p.Name == propertyName #if BEHAVIAC_NAMESPACE_FIX || p.Name.EndsWith(propertyName) #endif ) { return(className); } } } } } return(VariableDef.kConst); }
public override void ResetMembers(AgentType agentType, bool resetPar) { if (!this._isVisiting) { this._isVisiting = true; base.ResetMembers(agentType, resetPar); this._isVisiting = false; } }
private async Task <IEnumerable <IDictionary <string, string> > > GetAddressInformationAsync(AgentType type) { List <TimelineRecord> timelineRecords = await GetTimelineRecords(); return(timelineRecords .Select(r => r.Variables) .Where(v => v.ContainsKey(Constants.MachineHostName) && v.ContainsKey(Constants.MachineIpV4Address) && v.TryGetValue(Constants.MachineType, out var t) && ((AgentType)Enum.Parse(typeof(AgentType), t.Value)) == type) .Select(e => e.ToDictionary(kv => kv.Key, kv => kv.Value.Value))); }
public void Initialize(bool createPool, AgentType currType) { InitializeInputData(currType); if (createPool == true) { LoadZones(currType); LoadZonalData(currType); } else { if (currType != AgentType.Person) { using (InputDataReader currReader = new InputDataReader(Constants.DATA_DIR + "Household\\CensusHhldCountByDwell.csv")) { zonalControlTotals = new Hashtable(); currReader.FillControlTotalsByDwellType(zonalControlTotals); } } } }
public void ShowPreview(string url) { Show(); RequestUrl = url; PreviewUrl = url; linkLabel1.Text = RequestUrl; var extension = Path.GetExtension(url); if (extension != null && new[] { ".jpg", ".png", ".gif", ".bmp" }.Contains(extension.ToLower())) { var imagePath = Application.StartupPath + @"\preview.html"; var imageHtml = @" <!DOCTYPE html> <html lang='en' xmlns='http://www.w3.org/1999/xhtml'> <head> <meta charset='utf-8' /> <title></title> <style>* { margin: 0;}</style> </head> <body> <img src='{src}' style='border: 0; width: 100%;' alt=''/> </body> </html>".Replace("{src}", url); File.WriteAllText(imagePath, imageHtml); chromeBrowser.Load(imagePath); chromeBrowser.Reload(true); PreviewUrl = imagePath; return; } CurrAgent = AgentType.None; Match m; if ((m = Regex.Match(url, @"//www\.youtube\.com/watch\?v=(.+)")).Success) { PreviewUrl = "http://www.youtube.com/embed/" + m.Groups[1].Value.Replace("&", "?"); } else if ((m = Regex.Match(url, @"//www\.flickr\.com/(.+)")).Success) { PreviewUrl = "https://m.flickr.com/" + m.Groups[1].Value; CurrAgent = AgentType.Chrome; } else if ((m = Regex.Match(url, @"instagram\.com/")).Success) { } else if ((m = Regex.Match(url, @"pinterest\.com/")).Success) { CurrAgent = AgentType.Chrome; } else if ((m = Regex.Match(url, @"dbpedia\.org/resource/(.+)")).Success) { PreviewUrl = "http://en.m.wikipedia.org/wiki/" + m.Groups[1].Value; } else if ((m = Regex.Match(url, @"en\.wikipedia\.org/wiki/(.+)")).Success) { PreviewUrl = "http://en.m.wikipedia.org/wiki/" + m.Groups[1].Value; } if (CurrAgent == AgentType.None) { CurrAgent = AgentType.Android; } chromeBrowser.Load(PreviewUrl); }
public void LoadZones(AgentType CurrType) { if (CurrType == AgentType.Household) { using (var currReader = new InputDataReader( Constants.DATA_DIR + "Household\\CensusZonalData.csv")) { currReader.FillZonalData(ZonalCollection); } } else if (CurrType == AgentType.Person) { CreateSpatialZones(); } else if (CurrType == AgentType.HouseholdPersonComposite) { CreateSpatialZones(); } }
#pragma warning disable 0618 public static WorkbookAppInstallation Locate(AgentType agentType) => LookupById(AgentIdentity.GetFlavorId(agentType));
private void InitializeInputData(AgentType currType) { if (currType == AgentType.Household) { mobelWrkrsConditionals = new DiscreteCondDistribution(); mobelKidsConditionals = new DiscreteCondDistribution(); mobelPersConditionals = new DiscreteCondDistribution(); } }
public AgentConnection(AgentType agentType) { Type = agentType; AssemblySearchPaths = ImmutableArray <string> .Empty; }
public Pedestrian(int id, float radius, Policies policy = Policies.RVO, AgentType agentType = AgentType.PEDESTRIAN) { this.id = id; this.radius = radius; }
public Pedestrian(int id, Pose2D pose, Point velocity, Point goalPosition, float radius, float prefSpeed, Policies policy = Policies.RVO, AgentType agentType = AgentType.PEDESTRIAN) { this.id = id; this.pose = pose; this.velocity = velocity; this.goalPosition = goalPosition; this.radius = radius; this.prefSpeed = prefSpeed; this.policy = policy; this.agentType = agentType; }
public TestAgent GetAgent(AgentType type, int waitTime) { if ( type == AgentType.Default ) type = defaultAgentType; if ( (type & supportedAgentTypes) == 0 ) throw new ArgumentException( string.Format( "AgentType {0} is not supported by this agency", type ), "type" ); AgentRecord r = FindAvailableRemoteAgent(type); if ( r == null ) r = CreateRemoteAgent(type, waitTime); return new TestAgent( this, r.Process.Id, r.Agent ); }
/// <summary> /// The get agents count. /// return list of agents of specified type and their count in specified state /// </summary> /// <param name="totalAgentsCount"> /// The total agents count. /// </param> /// <param name="stateCount"> /// The state count. /// </param> /// <param name="agentType"> /// The agent type. /// </param> /// <param name="agentState"> /// The agent state. /// </param> private void GetAgentsCount(ref double totalAgentsCount, ref double stateCount, AgentType agentType, AgentState agentState) { LogTrace.WriteTraceFormatted("Attempt to get information about {0} agents int {1} state for {2}", agentType, agentState, NodeServer.IPAddr); List <AgentCurrentStatus> totalAgents = agents.FindAll(agent => agent.AgentId.AgentType == agentType); totalAgentsCount = totalAgents.Count; stateCount = totalAgents.FindAll(agent => agent.AgentState == agentState).Count; LogTrace.WriteTraceFormatted( "{0} agents found of type {1} on server {2}. {3} of them are in state {4}", totalAgents.Count, agentType, NodeServer.IPAddr, stateCount, agentState); }
private AgentRecord CreateRemoteAgent(AgentType type, int waitTime) { int pid = LaunchAgentProcess(); NTrace.DebugFormat( "Waiting for agent {0} to register", pid ); while( waitTime > 0 ) { int pollTime = Math.Min( 200, waitTime ); Thread.Sleep( pollTime ); waitTime -= pollTime; if ( agentData[pid].Agent != null ) { NTrace.DebugFormat( "Returning new agent record {0}", pid ); return agentData[pid]; } } return null; }
public DateTime GetLastStartTime(string dbName, Int64 CTID, int syncBitWise, AgentType type, string slaveIdentifier = null) { throw new NotImplementedException("Vertica is only supported as a slave!"); }