コード例 #1
0
        private void Run(IAgentUpdater updater, float timeStep = 1f)
        {
            var agents = GenerateAgents(numberOfAgents, numberOfWalls, random);

            for (int i = 0; i < ticks; i++)
            {
                updater.Tick(timeStep, agents);
            }
        }
コード例 #2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="AgentsTracker"/> class.
 /// </summary>
 /// <param name="agents">The agents.</param>
 /// <param name="options">The options.</param>
 /// <param name="log">The log.</param>
 /// <param name="providers">The providers.</param>
 /// <param name="connectionProvider">The connection provider.</param>
 /// <param name="agentUpdater">The agent updater.</param>
 public AgentsTracker(AgentsCollection agents, IConnectionsHostOptions options, ILog log,
                      IEnumerable<IAgentsProvider> providers, IConnectionProvider connectionProvider, IAgentUpdater agentUpdater)
 {
     this.agents = agents;
     this.options = options;
     this.log = log;
     this.providers = providers;
     this.connectionProvider = connectionProvider;
     this.agentUpdater = agentUpdater;
 }
        private void ConnectToRemotingHost(out IAgentUpdater agentUpdater)
        {
            try
            {
                //Try connecting to the IPC server
                IpcClientChannel clientChannel = new IpcClientChannel();
                clientChannel.IsSecured = true;
                ChannelServices.RegisterChannel(clientChannel);

                agentUpdater = (IAgentUpdater)Activator.GetObject(typeof(IAgentUpdater), BuildIpcRemotingUri());
                agentUpdater.Equals(null);
            }
            catch (RemotingException rex)
            {
                _logger.Log(string.Format("Error connecting to the Updater service via IPC: {0}", rex));

                //IPC Server connection failed, try connecting to the TCP server if it exists, allow the exception to bubble up if it fails.
                agentUpdater = (IAgentUpdater)Activator.GetObject(typeof(IAgentUpdater), BuildTcpRemotingUri());
                agentUpdater.Equals(null);
            }
        }
        private void ConnectToRemotingHost(out IAgentUpdater agentUpdater)
        {
            try
            {
                //Try connecting to the IPC server
                IpcClientChannel clientChannel = new IpcClientChannel();
                clientChannel.IsSecured = true;
                ChannelServices.RegisterChannel(clientChannel);

                agentUpdater = (IAgentUpdater)Activator.GetObject(typeof(IAgentUpdater), BuildIpcRemotingUri());
                agentUpdater.Equals(null);
            }
            catch (RemotingException rex)
            {
                _logger.Log(string.Format("Error connecting to the Updater service via IPC: {0}", rex));

                //IPC Server connection failed, try connecting to the TCP server if it exists, allow the exception to bubble up if it fails.
                agentUpdater = (IAgentUpdater)Activator.GetObject(typeof(IAgentUpdater), BuildTcpRemotingUri());
                agentUpdater.Equals(null);
            }
        }
 public void Initialise(IAgentUpdater updater, IEnumerable <AbstractAgent> agents, float timeStep)
 {
     this.updater  = updater;
     this.agents   = agents;
     this.timeStep = timeStep;
 }
コード例 #6
0
 private void ConnectToRemotingHost(out IAgentUpdater agentUpdater)
 {
     agentUpdater = (IAgentUpdater)Activator.GetObject(typeof(IAgentUpdater), BuildRemotingUri());
 }
 private void ConnectToRemotingHost(out IAgentUpdater agentUpdater)
 {
     agentUpdater = (IAgentUpdater)Activator.GetObject(typeof(IAgentUpdater), BuildRemotingUri());
 }