How to use _finish_agent method in autotest

Best Python code snippet using autotest_python

Judge.py

Source:Judge.py Github

copy

Full Screen

...100 def update_finished(self):101 for handle in list(self.active_agents):102 if (self.env.agents[handle].state == TrainState.DONE \103 or check_for_deadlock(handle, self.env, get_agent_positions(self.env))):104 self._finish_agent(handle)105 106 def _finish_agent(self, handle):107 self.active_agents.remove(handle)108 self.obs_builder._finish_agent(handle)109 110 def update_started(self):111 for agent in self.env.agents:112 if agent.handle not in list(self.active_agents):113 if (agent.state in self.valid_states):114 self._start_agent(agent.handle)115 116 def _start_agent(self, handle):117 self.active_agents.add(handle)118 self.obs_builder._start_agent(handle)119 def update_net_params(self, net_params):120 self.net.load_state_dict(net_params)121 def get_net_params(self, device=None):122 state_dict = self.net.state_dict()...

Full Screen

Full Screen

NetworkLoadAgentLauncher.py

Source:NetworkLoadAgentLauncher.py Github

copy

Full Screen

...16 for handle in range(len(self.env.agents)):17 if (self.env.agents[handle].status == RailAgentStatus.DONE_REMOVED \18 or self.env.obs_builder.deadlock_checker.is_deadlocked(handle))\19 and self.ready_to_depart[handle] == 1:20 self._finish_agent(handle)21 while self.send_more > 0:22 best_handle = -123 for handle, agent in enumerate(self.env.agents):24 if self.ready_to_depart[handle] == 0 and \25 (best_handle == -1 or self.load[best_handle] > self.load[handle]):26 best_handle = handle27 if best_handle == -1:28 self.send_more -= 100000029 break30 self._start_agent(best_handle)31 def is_ready(self, handle):32 return self.ready_to_depart[handle] != 033 def _finish_agent(self, handle):34 self.send_more += 135 self.ready_to_depart[handle] = 236 self.load -= self.pairwise_load[handle]37 def _start_agent(self, handle):38 self.send_more -= 139 self.ready_to_depart[handle] = 140 self.load += self.pairwise_load[handle]41# can be optimized, i guess42def _calc_pairwise_load(env):43 n_agents = len(env.agents)44 pairwise_load = np.zeros((n_agents, n_agents), dtype=np.int)45 paths = [_build_shortest_path(env, handle) for handle in range(n_agents)]46 for i, j in itertools.combinations(range(n_agents), 2):47 pairwise_load[i, j] = pairwise_load[j, i] = len(paths[i] & paths[j])...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run autotest automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful